Log in

View Full Version : Invalid SEI with latest x264?


Blue_MiSfit
8th December 2020, 20:05
My ABR packager (Unified Streaming Packager) blew up recently after an update from an old x264 build to the latest master from the videolan git repo. I tried the stable branch and get the same results.

The error is:


precondition failed 'bits_to_decode(is) >= payload_size * 8 && "Invalid sei_message"' in sei_util.hpp:88 (fmp4::parse_sei_rbsp)


Not sure what _exactly_ this means, but clearly the tool is having trouble parsing the SEI.

Looks like the only SEI in the files in question is the x264 custom user data SEI that signals the encoding settings. I don't have a tool to dump that directly, but parsed via mediainfo it looks like this:

Old x264 (works)

"Encoded_Library": "x264 - core 157",
"Encoded_Library_Name": "x264",
"Encoded_Library_Version": "core 157",
"Encoded_Library_Settings": "cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=48 / keyint_min=4 / scenecut=0 / intra_refresh=0 / rc_lookahead=48 / rc=abr / mbtree=1 / bitrate=1400 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=2100 / vbv_bufsize=2800 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00",


New x264 (does not work)

"Encoded_Library": "x264 - core 161 r3020 d198931",
"Encoded_Library_Name": "x264",
"Encoded_Library_Version": "core 161 r3020 d198931",
"Encoded_Library_Settings": "cabac=1 / ref=8 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=9 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=12 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / stitchable=1 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=48 / keyint_min=4 / scenecut=0 / intra_refresh=0 / rc_lookahead=48 / rc=abr / mbtree=1 / bitrate=1400 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=2100 / vbv_bufsize=2800 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00",


Other than the new version writing a slightly longer SEI (presumably based on the git sha or something) there's no difference.

Has anyone seen this before?

I'm going to try adjusting ffmpeg to just not write this SEI, hopefully that will fix it, but even so this seems odd..

Blue_MiSfit
9th December 2020, 19:59
Turns out the error message from our packager was probably a red herring. I'm still chasing whether this is an x264 issue or Unified Streaming issue. I was able to work around it by reducing thread count. Blanking the x264 custom SEI had zero effect.

We were using 12 threads, and this broke with our encoding settings for 480p and 720p... Reducing to 4 and 8 respectively worked around the issue.

Blue_MiSfit
10th December 2020, 22:23
This was actually a packager issue. Our beloved x264 is fine :)