h264parse: Fragmented mp4 causes Nal units to be wrongly parsed as Nal type 0, ref_idc 0
Version: 1.18.5
gst-launch-1.0 playbin uri=file://attached_file.mp4
causes
Setting pipeline to PAUSED ... Pipeline is PREROLLING ... Got context from element 'vaapisink0': gst.vaapi.Display=context, gst.vaapi.Display=(GstVaapiDisplay)"(GstVaapiDisplayGLX)\ vaapidisplayglx0"; ERROR: from element /GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode vaapidecode0: No valid frames decoded before end of stream Additional debug info: gstvideodecoder.c(1161): gst_video_decoder_sink_event_default ():/GstPlayBin:playbin0/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin0/GstVaapiDecodeBin:vaapidecodebin0/GstVaapiDecode:>vaapidecode0: no valid frames found ERROR: pipeline doesn't want to preroll. Setting pipeline to NULL ... Freeing pipeline ...
After enabling logs, it can be seen:
h264parse gsth264parse.c:2653:gst_h264_parse_set_caps:<h264parse0> profile 4d0001 0:00:00.373674118 28356 0x7f5c541c6230 DEBUG h264parse gsth264parse.c:2661:gst_h264_parse_set_caps:<h264parse0> nal length size 4 0:00:00.373678870 28356 0x7f5c541c6230 DEBUG codecparsers_h264 gsth264parser.c:242:gst_h264_parse_nalu_header: Nal type 0, ref_idc 0 0:00:00.373683925 28356 0x7f5c541c6230 DEBUG h264parse gsth264parse.c:722:gst_h264_parse_process_nal:<h264parse0> processing nal of type 0 Unknown, size 22 0:00:00.373688216 28356 0x7f5c541c6230 DEBUG codecparsers_h264 gsth264parser.c:242:gst_h264_parse_nalu_header: Nal type 0, ref_idc 0
This file is played normally with ffplay, vlc, chrome, firefox. FFMPEG gives no warnings about incorrect mp4, and every Nal unit has the correct type when dumped