Image sequence into uncompressed 8-bit video

Problem

Transcode an image sequence into an uncompressed 8-bit video file.

Solution

ffmpeg \
    -f image2 \
    -framerate 24 \
    -i input_file_%06d.ext \
    -c:v rawvideo \
    -pix_fmt uyvy422 \
    output_file

General command

ffmpeg \
    -f image2 \
    -framerate frames_per_second \
    -i input_file_regex.ext \
    -c:v rawvideo \
    -pix_fmt uyvy422 \
    output_file

Command syntax

ffmpeg
starts the command
-f image2
forces the image file de-muxer for single image files
-framerate frames_per_second
sets the frame rate
-i input_file_%06d.ext
path, name and extension of the input files
-c:v rawvideo
video codec rawvideo is set
-pix_fmt uyvy422
a pixel format for «uncompressed» 8-bit video is chosen
output_file
path, name and extension of the output file

Discussion

An «uncompressed» «YUV» video file is, scientifically speaking, a video file with Y′CBCR colour space and 4:2:2 chroma subsampling. This is not the Y′UV colour space used for PAL video. One of the possible pixel formats for 8-bit video is uyvy422.

The parameters witch apply to the input files must precede them. Therefore the option -f image2 must precede the image sequence given as input.

The frame rate of sound film is 24 fps (frames per second) and the default frame rate of image2 is 25 fps.

The regex %06d matches six digits long numbers, possibly with leading zeroes. This allows to read in ascending order, one image after the other, the full sequence inside one folder. The command must of course match the naming convention actually used. And for image sequences starting at 086400 (captured at 24 fps with a timecode starting at 01:00:00:00) or at 090000 (captured at 25 fps with a timecode starting at 01:00:00:00), add the flag -start_number 086400 or -start_number 090000 before -i input_file_%06d.ext.

The extension for TIFF files is .tif or maybe .tiff; the extension for DPX files is .dpx (or eventually .cin for old Cineon files). Other file formats are possible.

The video codec is specified by -codec:video, which may be abbreviated as -c:v (or -codec:v or -c:video). We advise to avoid the alias -vcodec.


2018–05–18