CLI

Video transcoding

Transcode videos with Chunkify CLI. Convert to MP4, WebM, HLS formats, customize transcoder settings, and generate thumbnails.

You can use the Chunkify CLI to transcode a local video, a URL, or a source ID if it has already been uploaded to Chunkify.

Usage example

chunkify -i video.mp4 -o video_1080p.mp4 -f mp4_h264 -s 1920x1080 --crf 21

It will upload the video to Chunkify, transcode it to MP4 H.264, and download it to your local disk.

By default, the number of transcoders and their type will be selected automatically according to the input and output specifications. To define them yourself, use --transcoders and --vcpu like this:

chunkify -i video.mp4 \
         -o video_720p.mp4 \
         -f mp4_h264 \
         -s 1280x720 \
         --crf 24 \
         --transcoders 10 \
         --vcpu 8

When transcoding the same local video multiple times, we use the source already created on Chunkify so you won't need to upload the video more than once.

You can also transcode a video that is publicly available via HTTP:

chunkify -i https://cdn/video.mp4 -o video_1080p.mp4 -f mp4_h264 -s 1920x1080 --crf 21

If a video has already been uploaded to Chunkify, you can simply use the source ID as the input:

chunkify -i src_33aoGbF6fyY49qUVebIeNaxZJ34 \
         -o video_av1_1080p.mp4 \
         -f mp4_av1 \
         -s 1920x1080 \
         --crf 34 \
         --preset 7

If --format is omitted but --output is set, we will match the file extension to the appropriate format:


  • .mp4 → mp4_h264
  • .webm → webm_vp9
  • .m3u8 → hls_h264
  • .jpg → jpg

Sometimes, it's better to know what the input specifications are before transcoding. Use --input without setting --format, and it will only upload or make available the source video:

chunkify -i chunkify-animation-logo.mp4

  ██   ▗▄▄▖▗▖ ▗▖▗▖ ▗▖▗▖  ▗▖▗▖ ▗▖▗▄▄▄▖▗▄▄▄▖▗▖  ▗▖
██    ▐▌   ▐▌▄▐▌▐▌ ▐▌▐▛▚▖▐▌▐▌▗▞▘  █  ▐▌▗▖  ▝▚▞▘
  ██  ▝▚▄▄▖▐▌ ▐▌▝▚▄▞▘▐▌  ▐▌▐▌ ▐▌▗▄█▄▖▐▌     ▐▌

Chunkify CLI version: dev
https://chunkify.dev

────────────────────────────────────────────────

▮ Source: chunkify-animation-logo.mp4
  Duration: 00:03 Size: 61KB Video: h264, 400x400, 149KB/s, 24.00fps

────────────────────────────────────────────────

Source ID: src_33dLly8jh7bQxVJ5L9LeMG3FAVc

Now you can perfectly adapt your transcoding settings to your needs with a second command by either setting --input to the source ID or the same local file (if uploaded from disk).

HLS Packaging

Chunkify supports 3 HLS formats: hls/h264, hls/h265, and hls/av1.

Keyframes must be aligned for all renditions, so you must use the same values for --gop, --x264keyint (H.264), and --x265keyint (H.265). For hls/av1, only --gop is necessary.

chunkify -i video.mp4 \
         -o video_540p.m3u8 \
         -f hls_h264 \
         -s 540x0 \
         -g 120 \
         --x264keyint 120 \
         --vb 800k \
         --ab 128k

Once the video is transcoded, the CLI will return a summary including the HLS Manifest ID, which we will use for the next command:

chunkify -i video.mp4 \
         -o video_720p.m3u8 \
         -f hls_h264 \
         -s 720x0 \
         -g 120 \
         --x264keyint 120 \
         --vb 1200k \
         --ab 128k \
         --hls-manifest-id hls_33atK0NkjF3lz6qUNi3GLwYdi0m

The video bitrate and/or audio bitrate are mandatory for HLS output

Now we have 2 renditions that belong to the same manifest:

manifest.m3u8
video_540p.mp4
video_540p.m3u8
video_720p.mp4
video_720p.m3u8

Generate Thumbnails

To generate thumbnails every 10 seconds:

chunkify -i video.mp4 -o thumbnails.jpg -f jpg -s 320x0 --interval 10

If many thumbnails are required, it's recommended to generate a sprite image instead of multiple individual images. A sprite image is a single image containing many thumbnails arranged in a grid, which is more efficient when there are hundreds of them to download for displaying a preview.

chunkify -i video.mp4 -o sprite.jpg -f jpg -s 160x0 --interval 5 --sprite

For all JPG outputs, an images.vtt file is generated, which can be loaded by an HTML5 player to display a mini preview when hovering over the player progress bar

The VTT filename is always images.vtt. Here is how it looks:

WEBVTT


00:00:00.000 --> 00:00:05.000
sprite-00000.jpg#xywh=0,0,160,160

00:00:05.000 --> 00:00:10.000
sprite-00000.jpg#xywh=160,0,160,160

00:00:10.000 --> 00:00:15.000
sprite-00000.jpg#xywh=320,0,160,160