After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 668627 - [h264parse] conversion avc/au to byte-stream/au broken
[h264parse] conversion avc/au to byte-stream/au broken
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other All
: Normal normal
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-25 00:58 UTC by Jonas Larsson
Modified: 2012-02-01 13:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
h264 stream in mp4 container that cannot be parsed properly (300.92 KB, video/mp4)
2012-01-25 00:58 UTC, Jonas Larsson
Details

Description Jonas Larsson 2012-01-25 00:58:32 UTC
Created attachment 206046 [details]
h264 stream in mp4 container that cannot be parsed properly

Conversion from packetized au aligned avc streams to au aligned byte streams is broken.

* For avc, split_packetized is always set to TRUE with the comment: "if input != output, and input is avc, must split before anything else".
* avc packets are split in gst_h264_parse_chain and NALUs passed separately to baseparse chain
* baseparse chain calls gst_h264_parse_check_valid_frame with one NALU from packet
* check_valid_frame knows that it has a complete NALU and returns success
* NAL collection code is useless when input is packetized. gst_h264_parse_collect_nal doesn't function and its return value is ignored in check_valid_frame.
* baseparse think we have a full frame and pushes it. In reality we have one NALU only.
* pushed "frame" *always* consist of one NALU. Regardless of negotiated alignment (au/nal) we always get nal. src caps is lying which causes downstream elements to fail.

The attached sample triggers these problems:

gst-launch -v filesrc location=output.mp4 ! qtdemux ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=au ! fakesink

* result is nal aligned, not au
* many pushed buffers/nals lacks timestamps
* SPS/PPS from codec_data are injected before first IDR NALU (4th), in the middle of first AU. According to spec, AU delimiter is always first NAL in AU if present. SPS/PPS should go after it, before the two SEIs that reference the SPS/PPS.
Comment 1 Mark Nauwelaerts 2012-02-01 13:13:52 UTC
Indeed, looks like the optimized processing for packetized broke a few things.  Following should unbreak this, and also mind the SEI.

On 0.10 branch (also pushed on master branch):

commit 114a1bb55f2c255f115ac268047ccf909beb8e9f
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Wed Feb 1 12:23:23 2012 +0100

    h264parse: also mind SEI position for config data insertion
    
    Fixes #668627.

commit b91d543086eb72ea8a46e57dc1c848d59b057627
Author: Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
Date:   Wed Feb 1 12:03:04 2012 +0100

    h264parse: unbreak optimized packetized NALU collection processing
    
    ... in that it was so optimized it did not consider grouping NALU into AU
    altogether.
    
    Fixes #668627.