@@ -346,7 +346,7 @@ def scenedetect(
346346)
347347@click .pass_context
348348def help_command (ctx : click .Context , command_name : str ):
349- """Print help for command (` help [command]`) ."""
349+ """Print full help reference ."""
350350 assert isinstance (ctx .parent .command , click .MultiCommand )
351351 parent_command = ctx .parent .command
352352 all_commands = set (parent_command .list_commands (ctx ))
@@ -989,6 +989,9 @@ def export_html_command(
989989 image_height : ty .Optional [int ],
990990):
991991 """Export scene list to HTML file. Requires save-images unless --no-images is specified."""
992+ # TODO: Rename this command to save-html to align with other export commands. This will require
993+ # that we allow `export-html` as an alias on the CLI and via the config file for a few versions
994+ # as to not break existing workflows.
992995 ctx = ctx .obj
993996 assert isinstance (ctx , CliContext )
994997
@@ -1011,7 +1014,7 @@ def export_html_command(
10111014 "-o" ,
10121015 metavar = "DIR" ,
10131016 type = click .Path (exists = False , dir_okay = True , writable = True , resolve_path = False ),
1014- help = "Output directory to save videos to. Overrides global option -o/--output if set .%s"
1017+ help = "Output directory to save videos to. Overrides global option -o/--output.%s"
10151018 % (USER_CONFIG .get_help_string ("list-scenes" , "output" , show_default = False )),
10161019)
10171020@click .option (
@@ -1084,7 +1087,7 @@ def list_scenes_command(
10841087 "-o" ,
10851088 metavar = "DIR" ,
10861089 type = click .Path (exists = False , dir_okay = True , writable = True , resolve_path = False ),
1087- help = "Output directory to save videos to. Overrides global option -o/--output if set .%s"
1090+ help = "Output directory to save videos to. Overrides global option -o/--output.%s"
10881091 % (USER_CONFIG .get_help_string ("split-video" , "output" , show_default = False )),
10891092)
10901093@click .option (
@@ -1259,7 +1262,7 @@ def split_video_command(
12591262 "-o" ,
12601263 metavar = "DIR" ,
12611264 type = click .Path (exists = False , dir_okay = True , writable = True , resolve_path = False ),
1262- help = "Output directory for images. Overrides global option -o/--output if set .%s"
1265+ help = "Output directory for images. Overrides global option -o/--output.%s"
12631266 % (USER_CONFIG .get_help_string ("save-images" , "output" , show_default = False )),
12641267)
12651268@click .option (
@@ -1445,30 +1448,76 @@ def save_images_command(
14451448 ctx .save_images = True
14461449
14471450
1451+ @click .command ("save-qp" , cls = _Command )
1452+ @click .option (
1453+ "--filename" ,
1454+ "-f" ,
1455+ metavar = "NAME" ,
1456+ default = None ,
1457+ type = click .STRING ,
1458+ help = "Filename format to use.%s" % (USER_CONFIG .get_help_string ("save-qp" , "filename" )),
1459+ )
1460+ @click .option (
1461+ "--output" ,
1462+ "-o" ,
1463+ metavar = "DIR" ,
1464+ type = click .Path (exists = False , dir_okay = True , writable = True , resolve_path = False ),
1465+ help = "Output directory to save QP file to. Overrides global option -o/--output.%s"
1466+ % (USER_CONFIG .get_help_string ("save-qp" , "output" , show_default = False )),
1467+ )
1468+ @click .option (
1469+ "--disable-shift" ,
1470+ "-d" ,
1471+ is_flag = True ,
1472+ flag_value = True ,
1473+ default = None ,
1474+ help = "Disable shifting frame numbers by start time.%s"
1475+ % (USER_CONFIG .get_help_string ("save-qp" , "disable-shift" )),
1476+ )
1477+ @click .pass_context
1478+ def save_qp_command (
1479+ ctx : click .Context ,
1480+ filename : ty .Optional [ty .AnyStr ],
1481+ output : ty .Optional [ty .AnyStr ],
1482+ disable_shift : ty .Optional [bool ],
1483+ ):
1484+ """Save cuts as keyframes (I-frames) for video encoding.
1485+
1486+ The resulting QP file can be used with the `--qpfile` argument in x264/x265."""
1487+ ctx = ctx .obj
1488+ assert isinstance (ctx , CliContext )
1489+
1490+ save_qp_args = {
1491+ "filename_format" : ctx .config .get_value ("save-qp" , "filename" , filename ),
1492+ "output_dir" : ctx .config .get_value ("save-qp" , "output" , output ),
1493+ "shift_start" : not ctx .config .get_value ("save-qp" , "disable-shift" , disable_shift ),
1494+ }
1495+ ctx .add_command (cli_commands .save_qp , save_qp_args )
1496+
1497+
14481498# ----------------------------------------------------------------------
1449- # Commands Omitted From Help List
1499+ # CLI Sub-Command Registration
14501500# ----------------------------------------------------------------------
14511501
1452- # Info Commands
1502+ # Informational
14531503scenedetect .add_command (about_command )
14541504scenedetect .add_command (help_command )
14551505scenedetect .add_command (version_command )
14561506
1457- # ----------------------------------------------------------------------
1458- # Commands Added To Help List
1459- # ----------------------------------------------------------------------
1460-
1461- # Input / Output
1462- scenedetect .add_command (export_html_command )
1463- scenedetect .add_command (list_scenes_command )
1507+ # Input
14641508scenedetect .add_command (load_scenes_command )
1465- scenedetect .add_command (save_images_command )
1466- scenedetect .add_command (split_video_command )
14671509scenedetect .add_command (time_command )
14681510
1469- # Detection Algorithms
1511+ # Detectors
14701512scenedetect .add_command (detect_adaptive_command )
14711513scenedetect .add_command (detect_content_command )
14721514scenedetect .add_command (detect_hash_command )
14731515scenedetect .add_command (detect_hist_command )
14741516scenedetect .add_command (detect_threshold_command )
1517+
1518+ # Output
1519+ scenedetect .add_command (export_html_command )
1520+ scenedetect .add_command (save_qp_command )
1521+ scenedetect .add_command (list_scenes_command )
1522+ scenedetect .add_command (save_images_command )
1523+ scenedetect .add_command (split_video_command )
0 commit comments