GNOME Bugzilla – Bug 664123
[h264parse] Conversion from AVC to byte stream fails for nal_length_size != 4
Last modified: 2011-11-16 10:05:53 UTC
Created attachment 201455 [details] [review] Patch to force memcpy dst offset to 4 for avc-> byte-stream wrapping Sample clip http://dl.dropbox.com/u/27392332/content/3G2/H264_AAC/H264_352x240_15fps_0300kbps_AAC-HE_096kbps_44khz_ST.3g2 gst-launch filesrc location=H264_352x240_15fps_0300kbps_AAC-HE_096kbps_44khz_ST.3g2 ! qtdemux ! h264parse ! fakesink ERROR: from element /GstPipeline:pipeline0/GstH264Parse:h264parse0: No valid frames found before end of stream The reason can be found in gst_h264_parse_wrap_nal Here a new buffer is allocated and filled with the byte-stream start code (0x00000001), then the original buffer is memcpyd into the new buffer with starting offset h264parse->nal_length_size. In the sample clip and many others, nal_length_size != 4 . In this case it's 2. That is, the last two bytes of the written start code is overwritten so later on it can't sync to the stream. No frames are detected. When wrapping the nal avc -> byte-stream, always write the start code and put the nal after it regardless of nal_length_size.
Thanks, committed. commit 5099ff23afb85539fa0f226598b358547c00fc27 Author: Jonas Larsson <jonas@hallerud.se> Date: Wed Nov 16 10:56:24 2011 +0100 h264parse: outgoing byte stream prefix always has size 4 Fixes #664123.