Skip to content

Commit 9d0af3c

Browse files
committed
[docs] Update + run docs/generate_cli_docs.py
1 parent 1bcc7ee commit 9d0af3c

File tree

2 files changed

+311
-204
lines changed

2 files changed

+311
-204
lines changed

docs/cli.rst

Lines changed: 96 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ Detectors
143143
``detect-adaptive``
144144
========================================================================
145145

146-
Perform adaptive detection algorithm on input video.
146+
Find fast cuts using diffs in HSL colorspace (rolling average).
147147

148148
Two-pass algorithm that first calculates frame scores with :ref:`detect-content <command-detect-content>`, and then applies a rolling average when processing the result. This can help mitigate false detections in situations such as camera movement.
149149

@@ -214,19 +214,19 @@ Options
214214
``detect-content``
215215
========================================================================
216216

217-
Perform content detection algorithm on input video.
217+
Find fast cuts using differences in HSL (filtered).
218218

219219
For each frame, a score from 0 to 255.0 is calculated which represents the difference in content between the current and previous frame (higher = more different). A cut is generated when a frame score exceeds :option:`-t/--threshold <-t>`. Frame scores are saved under the "content_val" column in a statsfile.
220220

221221
Scores are calculated from several components which are also recorded in the statsfile:
222222

223-
- *delta_hue*: Difference between pixel hue values of adjacent frames.
223+
- *delta_hue*: Difference between pixel hue values of adjacent frames.
224224

225-
- *delta_sat*: Difference between pixel saturation values of adjacent frames.
225+
- *delta_sat*: Difference between pixel saturation values of adjacent frames.
226226

227-
- *delta_lum*: Difference between pixel luma (brightness) values of adjacent frames.
227+
- *delta_lum*: Difference between pixel luma (brightness) values of adjacent frames.
228228

229-
- *delta_edges*: Difference between calculated edges of adjacent frames. Typically larger than other components, so threshold may need to be increased to compensate.
229+
- *delta_edges*: Difference between calculated edges of adjacent frames. Typically larger than other components, so threshold may need to be increased to compensate.
230230

231231
Once calculated, these components are multiplied by the specified :option:`-w/--weights <-w>` to calculate the final frame score ("content_val"). Weights are set as a set of 4 numbers in the form (*delta_hue*, *delta_sat*, *delta_lum*, *delta_edges*). For example, "--weights 1.0 0.5 1.0 0.2 --threshold 32" is a good starting point for trying edge detection. The final sum is normalized by the weight of all components, so they need not equal 100%. Edge detection is disabled by default to improve performance.
232232

@@ -246,7 +246,7 @@ Options
246246

247247
.. option:: -t VAL, --threshold VAL
248248

249-
Threshold (float) that frame score must exceed to trigger a cut. Refers to "content_val" in stats file.
249+
The max difference (0.0 to 255.0) that adjacent frames score must exceed to trigger a cut. Lower values are more sensitive to shot changes. Refers to "content_val" in stats file.
250250

251251
Default: ``27.0``
252252

@@ -258,7 +258,7 @@ Options
258258

259259
.. option:: -l, --luma-only
260260

261-
Only use luma (brightness) channel. Useful for greyscale videos. Equivalent to setting "-w 0 0 1 0".
261+
Only use luma (brightness) channel. Useful for greyscale videos. Equivalent to setting -w="0 0 1 0".
262262

263263
.. option:: -k N, --kernel-size N
264264

@@ -268,7 +268,13 @@ Options
268268

269269
.. option:: -m TIMECODE, --min-scene-len TIMECODE
270270

271-
Minimum length of any scene. Overrides global option :option:`-m/--min-scene-len <scenedetect -m>`. TIMECODE can be specified in frames (:option:`-m=100 <-m>`), in seconds with `s` suffix (:option:`-m=3.5s <-m>`), or timecode (:option:`-m=00:01:52.778 <-m>`).
271+
Minimum length of any scene. Overrides global option :option:`-m/--min-scene-len <scenedetect -m>`.
272+
273+
.. option:: -f MODE, --filter-mode MODE
274+
275+
Mode used to enforce :option:`-m/--min-scene-len <-m>` option. Can be one of: merge, suppress.
276+
277+
Default: ``Mode.MERGE``
272278

273279

274280
.. _command-detect-hash:
@@ -283,12 +289,13 @@ Find fast cuts using perceptual hashing.
283289

284290
The perceptual hash is taken of adjacent frames, and used to calculate the hamming distance between them. The distance is then normalized by the squared size of the hash, and compared to the threshold.
285291

286-
Saved as the `hash_dist` metric in a statsfile.
292+
Saved as the ``hash_dist`` metric in a statsfile.
287293

288294

289295
Examples
290296
------------------------------------------------------------------------
291297

298+
292299
``scenedetect -i video.mp4 detect-hash``
293300

294301
``scenedetect -i video.mp4 detect-hash --size 32 --lowpass 3``
@@ -297,6 +304,7 @@ Examples
297304
Options
298305
------------------------------------------------------------------------
299306

307+
300308
.. option:: -t VAL, --threshold VAL
301309

302310
Max distance between hash values (0.0 to 1.0) of adjacent frames. Lower values are more sensitive to changes.
@@ -317,7 +325,7 @@ Options
317325

318326
.. option:: -m TIMECODE, --min-scene-len TIMECODE
319327

320-
Minimum length of any scene. Overrides global option :option:`-m/--min-scene-len <scenedetect -m>`. TIMECODE can be specified in frames (:option:`-m=100 <-m>`), in seconds with `s` suffix (:option:`-m=3.5s <-m>`), or timecode (:option:`-m=00:01:52.778 <-m>`).
328+
Minimum length of any scene. Overrides global min-scene-len (-m) setting. TIMECODE can be specified as exact number of frames, a time in seconds followed by s, or a timecode in the format HH:MM:SS or HH:MM:SS.nnn.
321329

322330

323331
.. _command-detect-hist:
@@ -332,12 +340,13 @@ Find fast cuts by differencing YUV histograms.
332340

333341
Uses Y channel after converting each frame to YUV to create a histogram of each frame. Histograms between frames are compared to determine a score for how similar they are.
334342

335-
Saved as the `hist_diff` metric in a statsfile.
343+
Saved as the ``hist_diff`` metric in a statsfile.
336344

337345

338346
Examples
339347
------------------------------------------------------------------------
340348

349+
341350
``scenedetect -i video.mp4 detect-hist``
342351

343352
``scenedetect -i video.mp4 detect-hist --threshold 0.1 --bins 240``
@@ -346,6 +355,7 @@ Examples
346355
Options
347356
------------------------------------------------------------------------
348357

358+
349359
.. option:: -t VAL, --threshold VAL
350360

351361
Max difference (0.0 to 1.0) between histograms of adjacent frames. Lower values are more sensitive to changes.
@@ -354,13 +364,13 @@ Options
354364

355365
.. option:: -b NUM, --bins NUM
356366

357-
The number of bins to use for the histogram calculation
367+
The number of bins to use for the histogram calculation.
358368

359-
Default: ``16``
369+
Default: ``256``
360370

361371
.. option:: -m TIMECODE, --min-scene-len TIMECODE
362372

363-
Minimum length of any scene. Overrides global option :option:`-m/--min-scene-len <scenedetect -m>`. TIMECODE can be specified in frames (:option:`-m=100 <-m>`), in seconds with `s` suffix (:option:`-m=3.5s <-m>`), or timecode (:option:`-m=00:01:52.778 <-m>`).
373+
Minimum length of any scene. Overrides global min-scene-len (-m) setting. TIMECODE can be specified as exact number of frames, a time in seconds followed by s, or a timecode in the format HH:MM:SS or HH:MM:SS.nnn.
364374

365375

366376
.. _command-detect-threshold:
@@ -371,7 +381,7 @@ Options
371381
``detect-threshold``
372382
========================================================================
373383

374-
Perform threshold detection algorithm on input video.
384+
Find fade in/out using averaging.
375385

376386
Detects fade-in and fade-out events using average pixel values. Resulting cuts are placed between adjacent fade-out and fade-in events.
377387

@@ -425,7 +435,9 @@ Commands
425435
``export-html``
426436
========================================================================
427437

428-
Export scene list to HTML file. Requires save-images unless --no-images is specified.
438+
Export scene list to HTML file.
439+
440+
To customize image generation, specify the :ref:`save-images <command-save-images>` command before :ref:`export-html <command-export-html>`. This command always uses the result of the preceeding :ref:`save-images <command-save-images>` command, or runs it with the default config values unless ``--no-images`` is set.
429441

430442

431443
Options
@@ -438,9 +450,9 @@ Options
438450

439451
Default: ``$VIDEO_NAME-Scenes.html``
440452

441-
.. option:: --no-images
453+
.. option:: -n, --no-images
442454

443-
Export the scene list including or excluding the saved images.
455+
Do not include images with the result.
444456

445457
.. option:: -w pixels, --image-width pixels
446458

@@ -450,6 +462,10 @@ Options
450462

451463
Height in pixels of the images in the resulting HTML table.
452464

465+
.. option:: -s, --show
466+
467+
Automatically open resulting HTML when processing is complete.
468+
453469

454470
.. _command-list-scenes:
455471

@@ -462,13 +478,26 @@ Options
462478
Create scene list CSV file (will be named $VIDEO_NAME-Scenes.csv by default).
463479

464480

481+
Examples
482+
------------------------------------------------------------------------
483+
484+
485+
Default:
486+
487+
``scenedetect -i video.mp4 list-scenes``
488+
489+
Without cut list (RFC 4180 compliant CSV):
490+
491+
``scenedetect -i video.mp4 list-scenes --skip-cuts``
492+
493+
465494
Options
466495
------------------------------------------------------------------------
467496

468497

469498
.. option:: -o DIR, --output DIR
470499

471-
Output directory to save videos to. Overrides global option :option:`-o/--output <scenedetect -o>` if set.
500+
Output directory to save videos to. Overrides global option :option:`-o/--output <scenedetect -o>`.
472501

473502
.. option:: -f NAME, --filename NAME
474503

@@ -532,16 +561,14 @@ Options
532561
``save-images``
533562
========================================================================
534563

535-
Create images for each detected scene.
536-
537-
Images can be resized
564+
Extract images from each detected scene.
538565

539566

540567
Examples
541568
------------------------------------------------------------------------
542569

543570

544-
``scenedetect -i video.mp4 save-images``
571+
``scenedetect -i video.mp4 save-images --num-images 5``
545572

546573
``scenedetect -i video.mp4 save-images --width 1024``
547574

@@ -554,7 +581,7 @@ Options
554581

555582
.. option:: -o DIR, --output DIR
556583

557-
Output directory for images. Overrides global option :option:`-o/--output <scenedetect -o>` if set.
584+
Output directory for images. Overrides global option :option:`-o/--output <scenedetect -o>`.
558585

559586
.. option:: -f NAME, --filename NAME
560587

@@ -611,6 +638,38 @@ Options
611638
Width (pixels) of images.
612639

613640

641+
.. _command-save-qp:
642+
643+
.. program:: scenedetect save-qp
644+
645+
646+
``save-qp``
647+
========================================================================
648+
649+
Save cuts as keyframes (I-frames) for video encoding.
650+
651+
The resulting QP file can be used with the ``--qpfile`` argument in x264/x265.
652+
653+
654+
Options
655+
------------------------------------------------------------------------
656+
657+
658+
.. option:: -f NAME, --filename NAME
659+
660+
Filename format to use.
661+
662+
Default: ``$VIDEO_NAME.qp``
663+
664+
.. option:: -o DIR, --output DIR
665+
666+
Output directory to save QP file to. Overrides global option :option:`-o/--output <scenedetect -o>`.
667+
668+
.. option:: -d, --disable-shift
669+
670+
Disable shifting frame numbers by start time.
671+
672+
614673
.. _command-split-video:
615674

616675
.. program:: scenedetect split-video
@@ -626,10 +685,16 @@ Examples
626685
------------------------------------------------------------------------
627686

628687

688+
Default:
689+
629690
``scenedetect -i video.mp4 split-video``
630691

692+
Codec-copy mode (not frame accurate):
693+
631694
``scenedetect -i video.mp4 split-video --copy``
632695

696+
Customized filenames:
697+
633698
``scenedetect -i video.mp4 split-video --filename \$VIDEO_NAME-Clip-\$SCENE_NUMBER``
634699

635700

@@ -639,7 +704,7 @@ Options
639704

640705
.. option:: -o DIR, --output DIR
641706

642-
Output directory to save videos to. Overrides global option :option:`-o/--output <scenedetect -o>` if set.
707+
Output directory to save videos to. Overrides global option :option:`-o/--output <scenedetect -o>`.
643708

644709
.. option:: -f NAME, --filename NAME
645710

@@ -653,7 +718,7 @@ Options
653718

654719
.. option:: -c, --copy
655720

656-
Copy instead of re-encode. Faster but less precise. Equivalent to: :option:`--args="-map 0:v:0 -map 0:a? -map 0:s? -c:v copy -c:a copy" <--args>`
721+
Copy instead of re-encode. Faster but less precise.
657722

658723
.. option:: -hq, --high-quality
659724

@@ -692,11 +757,11 @@ Options
692757

693758
Set start/end/duration of input video.
694759

695-
Values can be specified as frames (NNNN), seconds (NNNN.NNs), or timecode (HH:MM:SS.nnn or MM:SS.nnn). For example, to process only the first minute of a video:
760+
Values can be specified as seconds (SSSS.nn), frames (NNNN), or timecode (HH:MM:SS.nnn). For example, to process only the first minute of a video:
696761

697-
``scenedetect -i video.mp4 time --end 1:00``
762+
``scenedetect -i video.mp4 time --end 00:01:00``
698763

699-
``scenedetect -i video.mp4 time --duration 60s``
764+
``scenedetect -i video.mp4 time --duration 60.0``
700765

701766
Note that --end and --duration are mutually exclusive (i.e. only one of the two can be set). Lastly, the following is an example using absolute frame numbers to process frames 0 through 1000:
702767

@@ -709,7 +774,7 @@ Options
709774

710775
.. option:: -s TIMECODE, --start TIMECODE
711776

712-
Time in video to start detection. TIMECODE can be specified as number of frames (:option:`--start=100 <--start>` for frame 100), time in seconds (:option:`--start=100.0 <--start>` for 100 seconds), or timecode (:option:`--start=00:01:40 <--start>` for 1m40s).
777+
Time in video to start detection. TIMECODE can be specified as seconds (:option:`--start=100.0 <--start>`), frames (:option:`--start=100 <--start>`), or timecode (:option:`--start=00:01:40.000 <--start>`).
713778

714779
.. option:: -d TIMECODE, --duration TIMECODE
715780

0 commit comments

Comments
 (0)