FFmpeg: h264_qsv encoder and crf issues

9,002

The QSV encoder doesn't have a parameter called CRF. The equivalent ratecontrol method is LA_ICQ.

https://software.intel.com/en-us/articles/common-bitrate-control-methods-in-intel-media-sdk:

The default rate control for x264 (FFmpeg's default h264 implementation) is CRF. This allows bitrate fluctuations to maintain a target quality level. Media SDK's ICQ and LA_ICQ are the best match for this class of algorithm.


To invoke it, a command of the form is needed:

ffmpeg -i in.mp4 -c:v h264_qsv -global_quality 10 -look_ahead 1 out.mp4

look_ahead should be 1. global_quality can be from 1 to 51. Lower value represents better quality. ~25 should be equivalent to x264 CRF 23.

Share:
9,002

Related videos on Youtube

KennyG1092
Author by

KennyG1092

Updated on September 18, 2022

Comments

  • KennyG1092
    KennyG1092 over 1 year

    I just found out about FFmpeg when recording gameplay on Bandicam using H.264 (Intel Quick Sync) codec. Unfortunately one of my videos ended up being recorded in an AVI wrapper and I wanted to transcode it to MP4 in a somewhat lossless manner

    The reason why I want to change wrappers is because Adobe Premiere Pro CC 2017 somehow does not handle AVIs well, and when I export using H.264 and MP4 as wrapper the whole video just looks broken.

    So, I grab FFmpeg and try to transcode my video with the following command:

    ffmpeg -i vid.avi -c:v h264_qsv -crf 10 -r 50 -c:a aac -b:a 192k -ac 2 vid.mp4
    

    The error that comes up in yellow is:

    Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (vid.mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.

    I'm pretty confident H.264 (Intel Quick Sync) has CRF support, or I could be very wrong and mixed up H.264 (QSV) and libx264, which obviously does support CRF.

    Anything around this? I have FFmpeg ver. 20170921-183fd30, 64-bit, static.

    Edit: Workaround rn is to go back to libx264 and run faster, veryfast or superfast, but I'd still like to save quite a bit of time by using Intel Quick Sync.

  • KennyG1092
    KennyG1092 over 6 years
    Alright, thanks. To clarify, a global_quality setting of 0 is lossless, similar to h.264's 0 CRF???
  • Gyan
    Gyan over 6 years
    No. I don't think this encoder has a lossless mode.