Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: madada on October 14, 2019, 09:49:03 PM

Title: Number of x264 reference frames beyond H.264 level setting
Post by: madada on October 14, 2019, 09:49:03 PM
Hello,

I've been busy encoding low-resolution footage with good encoding efficiency, and I noticed that some of my output files do not abide the H.264 level I set them to.
I encoded my video with Avidemux using x264 to a frame size (resolution) of 720x540 pixels and set the H.264 level ("IDC Level") to 3.0 and the x264 preset to "slower". This preset uses 8 reference frames but H.264 level 3.0 only allows 5 reference frames at the chosen resolution (see also https://planetcalc.com/3321/ (https://planetcalc.com/3321/)).
When encoding the same footage the same way using Handbrake, I noticed that it reduced the number of reference frames correctly despite the preset when selecting level 3.0.
Can this be fixed so that Avidemux behaves like Handbrake does? Or is the less experienced user expected to leave the level setting always at auto? In my case, being able to restrain the level and then know that the encoder will act accordingly, really helps playback on older devices like old iPads (some of which require Main Profile Level 3.0).

Greetings,
M.
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: eumagga0x2a on October 14, 2019, 11:27:16 PM
Quote from: madada on October 14, 2019, 09:49:03 PM
I encoded my video with Avidemux using x264 to a frame size (resolution) of 720x540 pixels and set the H.264 level ("IDC Level") to 3.0 and the x264 preset to "slower". This preset uses 8 reference frames but H.264 level 3.0 only allows 5 reference frames at the chosen resolution (see also https://planetcalc.com/3321/ (https://planetcalc.com/3321/)).

Due to decoded picture buffer size constraints?

QuoteWhen encoding the same footage the same way using Handbrake, I noticed that it reduced the number of reference frames correctly despite the preset when selecting level 3.0.
Can this be fixed so that Avidemux behaves like Handbrake does?

Of course it can as soon as someone actually implements it.

QuoteOr is the less experienced user expected to leave the level setting always at auto? In my case, being able to restrain the level and then know that the encoder will act accordingly, really helps playback on older devices like old iPads (some of which require Main Profile Level 3.0).

Avidemux relies on x264_encoder_open() to perform the necessary checks (which doesn't care).
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: Rangeles on October 16, 2019, 12:02:06 PM
What are the odds of this being implemented anytime soon?
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: eumagga0x2a on October 17, 2019, 12:34:14 AM
No estimate possible. Generally, if you need a feature, the best way to make it happen is writing it yourself. On my part, I'm curious about how Handbrake handles this, might be something well suited to help procrastinate important stuff.
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: eumagga0x2a on October 18, 2019, 07:54:15 AM
Should be fixed by [x264] Try to enforce IDC level conformance, code stolen from Handbrake (https://github.com/mean00/avidemux2/commit/2c46b661efb34c875035644bf688290235f33e3f). Please verify with a future nightly.
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: madada on October 18, 2019, 04:41:12 PM
Wow that's great!
Thanks for the effort. I'll be looking out for the next Nightly to try.
Title: Re: Number of x264 reference frames beyond H.264 level setting
Post by: madada on October 20, 2019, 07:50:13 PM
Just tried the latest nightly that was released today (x64, Windows).
It works great now!

Thank you very much for providing this fix so soon!

M.