Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
182 stars 127 forks source link

h264 encoding issue #325

Closed Donnyp751 closed 3 months ago

Donnyp751 commented 8 months ago

I'm running into an issue decoding my RTSP stream with certain endpoints. I originally thought it was an issue with the endpoints, as it would work with many different tools, like IPCentcom, VLC, and gstreamer. But using other NVR softwares like Milestone, Avigilon, and BlueIris I'm having problems getting the video stream to decode. Not seeing any errors from gstreamer, or in the network communications have made troubleshooting difficult. I have been running some test pipelines to try to reproduce this issue, and I'm coming across an error when setting up a pipeline with h264parse failing to parse the stream. I'm not sure if this is related to the other issue I'm having with endpoints not understanding the video, but it seems related. Here is the error I received when I setup my pipeline with h264 parse in it.

0:00:32.200035670 3912 0x74d39208 INFO basesrc gstbasesrc.c:3023:gst_base_src_loop: marking pending DISCONT 0:00:32.201981670 3912 0x74d39208 INFO GST_EVENT gstevent.c:918:gst_event_new_caps: creating caps event video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)baseline, width=(int)1920, height=(int)1080, framerate=(fraction)15/1 0:00:32.213384003 3912 0x74e3ab38 WARN rtpsession gstrtpsession.c:2436:gst_rtp_session_chain_send_rtp_common: Can't determine running time for this packet without knowing configured latency 0:00:32.266165670 3912 0x74e3aba8 WARN h264parse gsth264parse.c:1525:gst_h264_parse_handle_frame: broken/invalid nal Type: 1 Slice, Size: 12908 will be dropped

I have been crafting up test pipelines to try to reproduce this issue with gst-launch, and not just my application and have not been able to so far. However when I setup a test pipeline with h264 parse with gst-launch, I came across something interesting in the caps. imxvpuenc_h264 only supports a stream-format of byte-stream, but if I run the following pipeline, h264 parse detects the stream-format as avc instead of byte stream. is this to be expected or is there an issue with the parser, or the encoder?

GST_DEBUG=4 gst-launch-1.0 -vm imxv4l2videosrc ! video/x-raw, format=I420, width=1920, height=1080 ! queue ! imxvpuenc_h264 ! queue ! rtph264pay ! queue ! rtph264depay ! h264parse ! fakesink

Caps from rtph264depay, and h264parse video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)01424028ffe1000b67424028a680780227e54001000468ce3c80, level=(string)4, profile=(string)constrained-baseline, width=(int)1920, height=(int)1080, framerate=(fraction)0/1, coded-picture-structure=(string)frame, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true

I would have expected the stream-format to be the same as after the encoder.

Any ideas on troubleshooting this would be apricated.

Thanks, Donald Posterick

Donnyp751 commented 3 months ago

Explicitly setting the GOP size, and IDR interval seemed to resolve the original issue.