
There is a key near the top of the output that describes each letter that precedes the name of the format, encoder, decoder, or codec: $ ffmpeg -encoders List all available decoders in your ffmpeg build: ffmpeg -decodersĭisplay options specific to, and information about, a particular encoder: ffmpeg -h encoder=mpeg4ĭisplay options specific to, and information about, a particular decoder: ffmpeg -h decoder=aacĭisplay information about all hardware acceleration(s) supported by your current ffmpeg build: ffmpeg -hwaccels

List all supported encoders in your ffmpeg build: ffmpeg -encoders List all supported codecs in your ffmpeg build: ffmpeg -codecs List all supported formats in your ffmpeg build: ffmpeg -formatsĭisplay options specific to, and information about, a particular muxer: ffmpeg -h muxer=matroskaĭisplay options specific to, and information about, a particular demuxer: ffmpeg -h demuxer=matroska Select whatever suits you, and take note of container restrictions. If you compiled ffmpeg with NPP (Nvidia Performance Primitives) enabled under the NVIDIA Video SDK directive, you can select cuvid here.

hwaccel: Here, you can select the hardware acceleration decode method you wish to use. In our example, we have selected a 2.4 MB/s variable bitrate by default, as the nvenc_h264 encoder uses variable rate encoding unless its' explicitly disabled (via the -cbr option that enforces constant-rate encoding). In our case, we are copying the audio as is and we don't re-encode. acodec: Use this to select the audio encoder to use. You will also notice that we have passed the -profile:v option to the video encoder ( h264_nvenc) to select the high quality preset. Low-latency, 2-pass quality rate control factor as we are doing a two-pass high quality encode. In the example above, we are passing -rc (the rate control factor) recognized by the h264_nvenc encoder, and selecting the Here, pass absolute options to the video encoder. In the case where both the video and the audio codec support the same argument, such as this, then wrap this argument with a declaration, as shown: -preset:v would apply for the video encoder whereas -preset:a would apply for the audio encoder. preset: Some video and audio encoders will support the preset argument. In the example above, we have selected h264_nvenc. The same applies to the output video too. If you are already in the path relative to the file's position, then use that relative path. i: Here is your input file's absolute path. The second should be an option passed directly to ffmpeg, such as a debug value (if needed). The first will always be ffmpeg (the binary name in the system path or absolute path to ffmpeg depending on your deployment). NVENC's h264 and h265_nvenc based encoders natively support two-pass encoding, and this should be pretty straight-forward: ffmpeg -loglevel debug -hwaccel cuvid -i "input_file" -c:v h264_nvenc -preset llhq -profile:v high -rc ll_2pass_quality -an -b:v 2.4M -pass 1 -2pass -1 "output_file"įfmpeg -loglevel debug -hwaccel cuvid -i "input_file" -c:v h264_nvenc -preset llhq -profile:v high -rc ll_2pass_quality -acodec copy -b:v 2.4M -pass 2 -2pass -1 -y "output_file"

Trying two-pass with the h264_vaapi encoder: ffmpeg -loglevel debug -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "input_file" -vf 'format=nv12,hwupload' -pass 1 -map 0:0 -map 0:1 -threads 8 -aspect 16:9 -y -f matroska -an -c:v h264_vaapi -b 7.5M "/dev/null"įfmpeg -loglevel debug -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i "input_file" -vf 'format=nv12,hwupload' -pass 2 -map 0:0 -map 0:1 -threads 8 -aspect 16:9 -y -f matroska -acodec copy -c:v h264_vaapi -b 7.5M "output_file" avconv -v 55 -y -vaapi_device /dev/dri/renderD128 -hwaccel vaapi -hwaccel_output_format vaapi -i "input_file" -c:a copy -vf 'format=nv12|vaapi,hwupload' -c:v h264_vaapi -bf 2 -b 12500k "output_file" If you're already familiar with both pipelines, carry on. For both ffmpeg and libav, refer to this on what these arguments do. Libav takes its' arguments in a slightly different way. FFmpeg and libav's playbook: Advanced encoding options with hardware-based acceleration, NVIDIA's NVENC and Intel's VAAPI-based encoder.Ĭontinuing from this guide to building ffmpeg and libav with NVENC and VAAPI enabled, this snippet will cover advanced options that you can use with ffmpeg and libav on both NVENC and VAAPI hardware-based encoders.Īs usual, we supply the usual arguments when we want to encode with VAAPi-based encoders: ffmpeg -loglevel debug -hwaccel vaapi -vaapi_device /dev/dri/renderD128 -i input_file -vf 'format=nv12,hwupload' -threads 8 -aspect 16:9 -y -f matroska -acodec copy -vcodec h264_vaapi -qp 19 -bf 2 "output_file"
