Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
Thread Tools | Search this Thread | Display Modes |
7th February 2022, 12:33 | #1 | Link |
Registered User
Join Date: May 2003
Posts: 107
|
H.264 encoding: enabling Open GOP? Disadvantages when decrease Keyframe Interval?
I am investigating optimal encoding parameters for encoding movies and for playback on screen/TV.
I set as default: VBR wit bitrate=2500 Profile=High Level: 5.1 Preset=Slow This looks good so far. But I consider some fine tuning for some of the parameters and overwrite the defaults: Therefore some questions: 1.) Should I enable "Open GOP" or not? As far as I can see one can set the keyframe interval even when Open GOP is disabled. So it must be independent. Am i corect? 2.) What are the disadvantages of decreasing the maximum Keyframe Interval? Occasionally I plan to later cut some intervals from the resulting video. But cutting is only perfect and recommended at keyframes. So if I want to be able to cut precisely at scene changes I need to have as much keyframes as possible. The increase in video file size in negligible as I found out. So why not decreasing the maximum keyframe interval from 250 (=default?) to 30? 3.) The default number of B-Frames is (I guess) 2. Is this value optimal? I read in an older article a recommendation to disable "B pyramid". Is this nowadays still true? |
7th February 2022, 18:42 | #2 | Link | ||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Why level 5.1? You mean 4.1 I hope.
Anything HD/FULL HD should not exceed 4.1, especially at that bitrate. If you set it higher, hardware players might not play it at all. I'm talking about TVs, consoles etc. For simple playback on your own couch? Yes, definitely. The only ones who use closed gop are hardware playout ports that require strict constraints on the GOP pattern, but this is not your case and your TV at home won't care. Quote:
Quote:
Quote:
Quote:
About the bitrate, please please please consider using --crf instead of fixed bitrate. Unless you need it for some particular reason, crf will achieve better results in almost every scenario. Try with --crf 18 and go up from there if you think the file is too big. Last edited by FranceBB; 7th February 2022 at 18:45. |
||||
7th February 2022, 20:34 | #3 | Link |
Registered User
Join Date: Oct 2002
Location: France
Posts: 2,316
|
Personnaly, if i'm not targeting Blu-Ray, but just be compliant with hardware device player, i let the keyframe at his default value. I agree with a lot of things with FranceBB, but not this one...
Keyframe=framerate is small and reduce efficiency of other things, but unfortunately it's mandatory for Blu-Ray. Bitrate 2500 is VERY low (i hope you don't try on encode FHD content), you'll need all the tweaks you can to increase quality, so, absolutely yes, open GOP. When they implemented it, the devs said it produces around 10% quality improve. And also keep B pyramid (i'm curious about this "article"), keep mbtree (case need disabling is very specific). Sometimes people who made tests and give advices, are doing, without knowing, wrong things.
__________________
My github. Last edited by jpsdr; 7th February 2022 at 20:45. |
8th February 2022, 00:12 | #4 | Link | |
Moderator
Join Date: Jan 2006
Location: Portland, OR
Posts: 4,770
|
Quote:
|
|
8th February 2022, 11:00 | #5 | Link | |||
Registered User
Join Date: May 2003
Posts: 107
|
Thank you for comments for far.
First of all: I plan to encode movies for playing - on computers/notebooks and/or - copying the video files on USB flash drive and plug them into USB port in TVs BlueRay players are not the target Quote:
I have never experienced any problems when playing videos with 5.1 on computers or TVs. Quote:
Quote:
Assume I reduce the max keyframe interval from 250 to 30 at encoding time: how much more video file space (in percent) would be required when the quality should be the same? ...for a "normal" average movie? Give an estimation Last edited by mike23; 8th February 2022 at 11:03. |
|||
8th February 2022, 14:04 | #6 | Link | ||||
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Quote:
Quote:
A remark: I have never done this with any muxer other than ommcp.exe which is the paid Omneon Muxer by Harmonic, so I have no idea which muxers actually support this and how many players will actually honor the precharge value. Quote:
Quote:
Assume the following sequence produced with --no-scenecut --keyint 12 --bframes 2 --bitrate 50000: pict_type=I pict_type=B pict_type=B pict_type=P pict_type=B pict_type=B pict_type=P pict_type=B pict_type=B pict_type=P pict_type=B pict_type=B it has: pkt_size=728158 I pkt_size=270192 B pkt_size=272571 B pkt_size=478986 P pkt_size=291032 B pkt_size=292296 B pkt_size=476047 P pkt_size=127445 B pkt_size=125467 B pkt_size=287332 P pkt_size=114072 B pkt_size=147912 B pkt_size=634226 I So we have: 728158 for I frames 476047 for P (partially predicted) frames 270192 for B (bi-predictive) frames so an I frame is 728158÷476047 = 1.5 times larger than a P frame and 728158÷270192 = 2.7 times larger than a B frame... Nah, we agree on this one too! In fact: I agree and I would never ever do it for my personal encodes, I was just pointing out to him that if he really wanted to reduce the keyframe value, he might as well do it as the standard indicates rather than randomly xD Still, for things I wanna watch on my couch, I would never do that. Last edited by FranceBB; 8th February 2022 at 14:09. |
||||
14th June 2022, 03:15 | #8 | Link |
Registered User
Join Date: Apr 2022
Posts: 28
|
Sorry for the necro, but for what it's worth, I have had issues seeking x264's open GOP output! But:
1. Only with AMD HW decoders. 2. Didn't matter how it was muxed, whether or how it was interleaved, fragmented, etc. It always happened. mp4 made with either mp4box or ffmpeg, mkv, raw .h264 (seeking issues honestly expected there) - it didn't matter. 3. Particularly if it was used for streaming, even without an AMD HW decoder involved. It affected any/all seeks, fairly consistently, and it always froze on the same exact frames. It would "start" playing on what I suspect were IDRs that didn't need any "missing" refs, and play for a few frames or a few seconds or sometimes longer, up until the last B/P-frame that didn't have a ref outside the nearest IDR, and then freeze frame until the next IDR. Playing the file beginning to end had no issues, even as an elementary stream. I should try it again, or find one of the old files if I kept one, and check VLC's debug window again. I think it mentioned some kind of picture buffer something or another, even though it was Level 4.1, 1440x1080, with ref=5, automatically set by specifying L4.1 High. Well within DPB limits, and again, working fine if played beginning to end anyways. I'd say the demuxer was consistently being really dumb and not seeking appropriately to grab the needed references, but .mkv/.mp4 were the same, and I suspect the decoder itself was throwing them out! Forcing CPU decoding with LAV did work, and mpv didn't seem to fare any better than VLC. Re-encoding with the same settings and disabling open GOP made the issues go away, at a single digit % (or honestly even MB) increase in file-size, in a file that was already <200 MB. HEVC (x265) worked just fine with open GOP (default) on the other hand, even for streaming, and even with all the b-frames and refs you could want. Of course, streaming HEVC means limiting your audience to Edge and Safari... |
14th June 2022, 08:51 | #9 | Link | |
Broadcast Encoder
Join Date: Nov 2013
Location: Royal Borough of Kensington & Chelsea, UK
Posts: 2,904
|
Quote:
Yeah software decoding is always gonna work |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|