wiki:

Encode

/

FFV1

FFV1 encoding cheatsheet

FFV1 version 1

The following list contains encoding parameters for FFV1 (version 1):

Name FFmpeg argument Valid values Comments
Coder -coder 0, 1 0=Golomb Rice, 1=Range Coder, 2=Range Coder (with custom state transition table)
Context -context 0, 1 0=small, 1=large
GOP size -g integer >= 1 For archival use, GOP-size should be "1".

Examples

  1. Copy audio "as-is" and use FFV1.1 as video codec. Audio stream kept as-is.

Parameters are GOP-size=1, coder=1, context=1:

ffmpeg -i <input_video> \
    -acodec  copy       \
    -vcodec  ffv1       \
    -level   1          \
    -coder   1          \
    -context 1          \
    -g       1          \
    <output_video>

FFV1 version 3

The following list contains encoding parameters for FFV1 (version 3).

Name FFmpeg argument Valid values Comments
Coder -coder 0, 1 0=Golomb-Rice, 1=Range Coder, 2=Range Coder (with custom state transition table)
Context -context 0, 1 0=small, 1=large
GOP size -g integer >= 1 For archival use, GOP-size should be "1".
Version -level 1, 3 Select which FFV1 version to use.
Threads -threads integer >= 1 The number of threads to use while processing. Adjust this to match how many of your available CPU cores you want to use.
Slices -slices 4, 6, 9, 12, 16, 24, 30 Each frame is split into this number of slices. This affects multithreading performance, as well as filesize: Increasing the number of slices might speed up performance, but also increases the filesize.
Error correction/detection -slicecrc 0, 1 0=off, 1=on. Enabling this option adds CRC information to each slice. This makes it possible for a decoder to detect errors in the bitstream, rather than blindly decoding a broken slice.
Multi-pass encoding -pass 1, 2 1=1st pass, 2=2nd pass. FFV1.3 is able to be encoded in multiple passes, to increase compression efficiency. It requires encoding the file twice, though: The 1st pass is to analyze the video source data and logging the results, and the 2nd pass uses this previously gathered information to achieve a higher compression ratio. More information about multi-pass encoding can be read up in the Wikipedia article about "Variable bitrate" (VBR).
Multi-pass logfile -passlogfile a filename prefix This is the prefix of the logfile used for storing the information gathered during previous passes in multi-pass encoding mode. Additional info about passlogfile can be found in FFmpeg's documentation about video options.

Examples

  • Copy audio "as-is" and use FFV1.3 as video codec.

Parameters are 8 threads, coder=1, context=1, GOP-size=1, 24 slices and slice-CRC on:

ffmpeg -i <input_video>     \
    -acodec   copy          \
    -vcodec   ffv1 -level 3 \
    -threads  8             \
    -coder    1             \
    -context  1             \
    -g        1             \
    -slices  24             \
    -slicecrc 1             \
    <output_video>
  • Encode using 2-pass mode, with audio kept as-is:

1st pass:

ffmpeg -i <input_video>     \
    -an                     \
    -vcodec ffv1 -level 3   \
    -pass 1                 \
    -passlogfile my_passlog \
    -f nut /dev/null

2nd pass:

ffmpeg -i <input_video>     \
    -acodec copy            \
    -vcodec ffv1 -level 3   \
    -pass 2                 \
    -passlogfile my_passlog \
    <output_video>

Read from existing file

In order to check which parameters an FFV1 video was encoded with, you can use the following command:

ffprobe -i <input_video> -debug 1

FFV1 version 1

[ffv1 @ 0x385bb80] ver:1 keyframe:1 coder:0 ec:0 slices:1 bps:8

FFV1 version 3

The output for FFV1.3 might look as follows:

[ffv1 @ 0x22444e0] global: ver:3.4, coder:0, colorspace: 0 bpr:10 chroma:1(1:0), alpha:0 slices:3x2 qtabs:2 ec:1 intra:0 CRC:0x613FED4D

That line translates to this:

Name Label FFmpeg argument Value Comment
ver Version -level major-version:3
minor-version:4
-leveldetermines major-version.
Minor-version is encoder-internal and read only.
coder Coder -coder 0 0=Golomb Rice, 1=Range Coder, 2=Range Coder (with custom state transition table)
colorspace Color space 0 0=YCbCr ("YUV"), 1=JPEG2000_RCT ("RGB")
bpr Bits per sample -pix_fmt 10 bits For example with "yuv422p10le"
slices Slice count -slices 3x2 = 6 Shows the layout of slices as "width x height"
ec Error correction -slicecrc 1 0=OFF, 1=ON
intra Intra-frame only -g 0 0=GOP greater than 1, 1=GOP is 1
Last modified 22 months ago Last modified on Sep 13, 2015, 10:46:58 PM