GNOME Bugzilla – Bug 682589
h264parse parse data error when AVC head only 2 bytes
Last modified: 2012-08-28 09:26:06 UTC
use this cmd pipeline: kulou1.mp4 is a video from youtube, and can not be played, so I download it for checking. gst-launch filesrc location=/workspace/avdata/kulou1.mp4 num-buffers=1000 ! qtdemux ! h264parse ! capsfilter caps=" video/x-h264, stream-format=(string)byte-stream" ! filesink location=./mykulou.h264 --gst-debug=*264*:5 -v 0.11 verison is not ok. Otherwisse 0.10 version works good. And I checked the H264 file dumped by 0.10 version, and I find that the AVC header is only two bytes. But the verison 0.11 treated it as 4 bytes, so it will parse out error data. The attachment is the mp4 file , h264 data dumped by 0.11 gstreamer, h264 data dumped by 0.10 gstreamer
Created attachment 222292 [details] Only h264 files, mp4 is too large
Could you provide some of the input data? This might work: gst-launch-0.10 filesrc location=foo.mp4 ! qtdemux name=d d.video_00 ! gdppay ! filesink location=foo-h264.gdp And then head --bytes=500k foo-h264.gdp > foo-h264-avc-start.gdp And then attach foo-h264-avc-start.gdp ? Unless you can make the full .mp4 available somewhere else, which would be helpful too.
Created attachment 222505 [details] This is the gdp file of first 500 bytes of the mp4 file
Hello Müller . I run this cmd : gst-launch-0.10 filesrc location=kulou.mp4 ! qtdemux name=d d.video_00 ! gdppay ! filesink location=kulou-h264.gdp head --bytes=500k kulou-h264.gdp > kulou-h264-avc-start.gdp And I got the gdp file , just see the attachment. Thank you.
Hello all, I resoloved this problems. In gst\videoparsers]gsth264parse.c static GstBuffer * gst_h264_parse_wrap_nal (GstH264Parse * h264parse, guint format, guint8 * data, guint size) { ...... //old is this //buf = gst_buffer_new_allocate (NULL, nl + size, NULL); //change to this buf = gst_buffer_new_allocate (NULL, 4 + size, NULL); ...... } Because the first 4 bytes are 00 00 00 01. If the nl is 2, the data buffer is not enough, and will drop the last 2 bytes. So change it to 4 will be OK. In the gstreamer-0.10 version, the codes like this: /* make a buffer consisting of a 4-byte start code following by * (a copy of) given nal data */ static GstBuffer * gst_h264_parse_make_nal (GstH264Parse * h264parse, const guint8 * data, guint len) { GstBuffer *buf; buf = gst_buffer_new_and_alloc (4 + len); GST_WRITE_UINT32_BE (GST_BUFFER_DATA (buf), 1); memcpy (GST_BUFFER_DATA (buf) + 4, data, len); return buf; } Hope it will be useful to you, and release the 0.11 stable version as soon as possible. Thanks.
Thanks, fixed along aforementioned lines. commit 4f2bcc324389fa32216baece1786389914f3a2f4 Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> Date: Tue Aug 28 11:07:41 2012 +0200 h264parse: ensure sufficiently sized buffer when wrapping NAL Noted by <zhangyanping210@yahoo.com.cn> Fixes https://bugzilla.gnome.org/show_bug.cgi?id=682589