[x264-devel] x264 producing (possibly) malformed stream

mashiat.sarker at gmail.com mashiat.sarker at gmail.com
Fri Dec 21 22:24:51 CET 2012


Hi guys

We have been having some issues with muxing a certain h264 stream 
(transcoded by x264) using l-smash. So I looked into l-smash and tried 
to pin-point the exact issue. It looks like x264 produces a stream that 
is not strictly spec-compliant. To be precise, muxing fails in 
lsmash_check_h264_parameter_set_appendable() function in l-smash 
codebase where it checks for duplicate sps_id; below the comment "/* 
Forbidden to duplicate SPS that has the same seq_parameter_set_id with 
different form within the same configuration record. */". So I felt like 
x264 would be the right place to report this issue.

The original file can be found here:
https://dl.dropbox.com/u/32117554/blue_christmas_-_elvis_presley_56058545_original

Encoding to h264 was performed using ffmpeg on demuxed video stream 
using the following command-lines (2-pass):

ffmpeg -y -copyts -i blue_christmas_-_elvis_presley_56058545_original 
-pix_fmt yuv420p -map 0:0 -vf 
sws_flags=lanczos;yadif=0:-1,scale=trunc((((oh*iw)/ih)*sar)/2)*2:720 
-vcodec libx264 -crf 20 -preset medium -x264opts 
min-keyint=30:keyint=90:vbv-bufsize=12500:vbv-maxrate=3750:qpmin=5 
-level 3.1 -profile:v high -pass 1 -passlogfile 
blue_christmas_-_elvis_presley_56058545_original000.h264 -r 2997/100 -f 
h264 /dev/null

ffmpeg -y -copyts -i blue_christmas_-_elvis_presley_56058545_original 
-pix_fmt yuv420p -map 0:0 -vf 
sws_flags=lanczos;yadif=0:-1,scale=trunc((((oh*iw)/ih)*sar)/2)*2:720 
-vcodec libx264 -b:v 1655000 -preset medium -x264opts 
min-keyint=30:keyint=90:vbv-bufsize=12500:vbv-maxrate=3750:qpmin=5 
-level 3.1 -profile:v high -pass 2 -passlogfile 
blue_christmas_-_elvis_presley_56058545_original000.h264 -r 2997/100 -f 
h264 
/home/shakkhar/Downloads/blue_christmas_-_elvis_presley_56058545_original000.h264

The muxing command used with l-smash looks like this:
muxer --interleave 1000 --optimize-pd -i 
blue_christmas_-_elvis_presley_56058545_original000.h264?fps=2997/100 -i 
blue_christmas_-_elvis_presley_56058545_original.aac?encoder-delay=2048 
-o output.mp4

Points to be noted:
- MP4Box can mux the stream
- If I encode with default x264 settings (-crf 25 and default everything 
else)  the resulting stream is good and can be muxed with l-smash

The version of the programs we are using here are:

ffmpeg version N-48071-gfb3f28e

shakkhar at shakkhar-work:~/x264$ git branch -v
* master 1cffe9f Fix possible issues with out-of-spec QP values Fixes a 
possible regression in r2228.

L-SMASH isom/mov multiplexer rev694  b7ef91b

Here is the x264 encoded stream (presumably malformed as declared by 
l-smash muxer):
https://dl.dropbox.com/u/32117554/blue_christmas_-_elvis_presley_56058545_original000.h264

Let me know if you guys need anything else or have any suggestion.

-Shakkhar


More information about the x264-devel mailing list