video_helper.cli_argparse module

Video Helper — argparse-based command-line interface.

Thin wrapper around the pure functions in video_helper.main that exposes the whole toolkit as subcommands under a single video-helper entry point. Written with argparse from the standard library so the CLI works out of the box on any Python install that has the package installed — no extra dependency required.

Subcommands

  • validate — probe a video file / URL for validity (boolean)

  • dimensions — dump width/height/duration/frame_rate/has_sound as JSON

  • duration — print the duration in seconds of a video

  • convert — re-encode / resize / drop audio

  • chunk — extract a [start, end] slice

  • black — synthesize a silent solid-black clip

  • image-loop — loop a still image into a silent clip

  • concat — concatenate several videos head-to-tail

  • overlay — overlay a still image on a video (watermark / cursor)

  • extract-audio — dump the audio track of a video

  • mux-audio — mux a separate audio track onto a video

  • burn-subs — burn .srt / .vtt / .ass into the frames

  • srt2vtt — SRT → WebVTT with color-preserving CSS

  • extract-frames— stream frames to disk (one PNG per sampled frame)

Usage Example

>>> #   video-helper validate      --input clip.mp4
>>> #   video-helper dimensions    --input clip.mp4
>>> #   video-helper duration      --input clip.mp4
>>> #   video-helper convert       --input in.mov --output out.mp4 --width 640 --height 480
>>> #   video-helper chunk         --input in.mp4 --start 10 --end 20 --output cut.mp4
>>> #   video-helper black         --duration 3 --width 1920 --height 1080 --output buffer.mp4
>>> #   video-helper image-loop    --image title.png --duration 4 --output title.mp4 --width 1920 --height 1080
>>> #   video-helper concat        --inputs a.mp4 b.mp4 c.mp4 --output final.mp4
>>> #   video-helper overlay       --input clip.mp4 --image logo.png --output watermarked.mp4 --x 10 --y 10
>>> #   video-helper extract-audio --input clip.mp4 --output audio.wav
>>> #   video-helper mux-audio     --input silent.mp4 --audio voice.wav --output final.mp4
>>> #   video-helper burn-subs     --input clip.mp4 --subs subs.srt --output captioned.mp4
>>> #   video-helper srt2vtt       --input subs.srt
>>> #   video-helper extract-frames --input clip.mp4 --output-dir frames/ --frame-step 5

Author

Warith Harchaoui, Ph.D. — https://linkedin.com/in/warith-harchaoui/

video_helper.cli_argparse.build_parser()[source]

Assemble the top-level video-helper argument parser.

Returns:

Fully wired parser with every subcommand attached.

Return type:

argparse.ArgumentParser

video_helper.cli_argparse.main(argv=None)[source]

Entry point invoked by video-helper (see [project.scripts]).

Parameters:

argv (sequence of str, optional) – Arguments to parse. Defaults to sys.argv[1:] when None.

Returns:

Process exit code (0 on success).

Return type:

int