If you want to take the guesswork out of finding a better bitrate then it is best to analyze the file to find one. It is in my script in case I decide to use a different codec and it supports a minimum bitrate. Note that -minrate has no effect with x264. I like to make sure that my content uses all of the bells and whistles for delivering bitrate based content including -buffsize, -maxrate, and even -minrate. If you do not specify a profile it will default to high. If you do not specify a preset it will default to medium. If you do not specify a bitrate for x264 then it will default to CRF 23. I have seen people attempt to create VOD content and perform live streaming using Constant Rate Factor which is also known as CRF. This is equivalent to the no-scenecut option provided by libx264. You can also use the FFmpeg -sc_threshold 0 parameter to disable scene detection and is video codec neutral. If this option is not used then keyframes will be misaligned for ABR content and segment sizes will be unpredictable. When done properly that will be zero scenecut=0. If you inspect an output file with MediaInfo and did not use the no-scenecut option you will see scenecut=40. The examples below are inaccurate on purpose for ease of reading. 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.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |