Bug Report H.264 Level is being set incorrectly for Levels greater than 4.1 (or so)

Boildown

Active Member
I haven't directly tested this myself, but there's evidence in a few recent help requests:

General forum search: https://obsproject.com/forum/search/2846111/?q=>+level+limit+(245760)&o=date

Some specific posts where I've seen it:
https://obsproject.com/forum/threads/minor-issue-with-local-recording.39860/#post-179933
https://obsproject.com/forum/thread...smoothness-and-audio.38380/page-2#post-176412
https://obsproject.com/forum/threads/40-fps-loss-in-game-when-streaming.38972/#post-176403

This really shouldn't be happening. OBS is setting the wrong level, or x264's auto calculator is doing it wrong, or its hard-coded to level 4.1 in some cases.

More about H.264 Level: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC#Levels
 

R1CH

Forum Admin
Developer
x264 allows parameters to exceed level limits rather than capping at the specified level. It doesn't seem to matter since everything plays it back just fine anyway.
 

Sapiens

Forum Moderator
I'm pretty sure x264 calculates it automatically, and the warnings should only affect playback on hardware that doesn't support higher than 4.1 anyway.
 

Boildown

Active Member
I think some of the "I heard audio but no video on playback" threads are caused by the level not being set correctly.

I found a utility that may work around this: http://coolsoft.altervista.org/en/h264leveleditor
I'll have to try it out later, but I'm not sure if it works on .mp4 or .flv containers, they only mention .mkv and .avi.

I'm pretty sure x264 calculates it automatically, and the warnings should only affect playback on hardware that doesn't support higher than 4.1 anyway.

I think OBS should calculate it correctly, or let x264 calculate it correctly. Right now I suspect OBS is just putting a blanket "4.1" stamp on everything. If you're going to put a blanket level stamp on all video, make it 5.2 at least, IMO. That way it'll play on all PCs, only the mobile devices might choke on it.

I don't remember seeing this in my NVEnc encoded logs, which are saved at 1080p60, which is level 4.2. So this might be specific to x264. Another thing I'll have to check.

Here's what avidemux has to say about the H.264 Level setting: http://www.avidemux.org/admWiki/doku.php?id=tutorial:h.264#output

Here's something from Handbrake: https://forum.handbrake.fr/viewtopic.php?f=6&t=19368

The weird thing is that x264 should set the Level correctly if no Level is specified. Is OBS specifying a Level for some reason instead of letting x264 autodetect it?
 
Last edited:

Boildown

Active Member
All the NVEnc-encoded archives still on my hard drive have the level set correctly to 4.2 (they are all 1080p60). The only x264 encoded archive files I still have from before I started recording with NVEnc were losslessly cut using avidemux, and I can't be sure that avidemux didn't re-write the Level information in them, but they were all correct as well. But none of those were 1080p60, they were all 720p60 or 1080p30.

So I'll have to make specific recordings using x264 to test this further. Clearly when using NVEnc the Level is being set correctly at 1080p60 at least.

The H.264 Level Editor utility wasn't very useful because it could only find the Level information when I configured its buffer to be greater than the file size, and the upper limit of its buffer was only 100MB. It doesn't take long to exceed that when recording 1080p60 at useful bitrates.
 
Top