

23.976fps is inaccurate and should always be written as 24000/1001. Setting -scenecut -1 is not a valid option or if it is I have found it nowhere in either x264’s or FFmpeg’s documentation. Using the no-scenecut option will turn off scene detection for that codec. It will also set the default maximum GOP value to 250 and the minimum GOP value to 25. x264 will, by default, create a keyframe when it detects a scene change. I go a bit beyond what is required for regular desktop playback and use the no-scenecut option in conjunction with the -g parameter. Section two – Keyframe distanceĮnsuring that your keyframe distance is always the same you can use the -g parameter. It is not uncommon for FFmpeg to duplicate the first frame. If that happens then if possible contact the content creator and ask them to fix their source content. Depending upon the content you get do not be surprised if frames are duplicated and/or dropped during encoding. This is used in conjunction with the -vsync parameter using the 1 option which will retime the PTS/DTS timestamps accordingly. This must be the same as the input frame rate to eliminate judder. r is used to specify the output frame rate. To achieve proper playback with FFmpeg you need to use two options. If they are not in the correct order you can have playback problems like content jumping forwards, backwards, and even possible problems with basic playback. Section one – Constant frame rateĬonstant frame rate is important because players like to have the PTS/DST timestamps they are decoding generated like clockwork. Are you sure that the frame rate is constant? Were you told that the content is progressive and not interlaced? Were you given information about keyframe distance or what color space the video is in? Can you trust that any of that is accurate? I can’t and you shouldn’t. I have a basic rule when encoding content and that is to never trust the input. Streaming media, at it’s core, requires three basic things.Ģ) An even keyframe distance which is also known as a Group of Pictures or GOP.Ĥ) Finding a better bitrate for your content.ħ) Proper encoding for your target audiences. In this post I hope to help shed some light on what does and does not work. I’ve been in the streaming media industry since 2008 and have seen a lot of misinformation regarding both FFmpeg and libx264. This entry was posted in Video Technologies and tagged ffmpeg, x264 by Marco Barnig.
#Ffmpeg crf setting series
The ffmpeg settings for the fifth test series are : The numer of reference frames was changed to the values 4, 8 and 16 for the two presets veryslow and medium (4 is the minimum number of reference frames of the main profile). The ffmpeg settings for the fourth test series are : The numer of reference frames was changed to the values 1, 2, 4, 8 and 16. The ffmpeg settings for the third test series are :

The X264 settings of the different presets are :

If you specify a preset, the changes it makes will be applied before all other parameters are applied. Presets are designed to reduce the work needed to generate sane, efficient commandlines to trade off compression efficiency against encoding speed. The three presets veryslow, medium and ultrafast have been used. The ffmpeg settings for the second test series are : Visually the quality difference between the movies with an CRF = 20 and CRF = 32 is not perceptible. The value of the Constant Rate Factor (CRF) was changed from 20 to 32, in steps of 3. The ffmpeg settings for the first test series are :
