GStreamer to FFmpeg: MEDIA_ERR_DECODE – Super User

I’m using GStreamer to receive an RTP MPEG-2 Transport Stream, decode it, re-encode it as H.264, and send it over UDP to FFmpeg for MPEG-DASH output. However, I’m encountering a MEDIA_ERR_DECODE issue when trying to play the generated DASH stream.

udpsrc address={multicast-address} port=6310 do-timestamp=true timeout=60000000000 buffer-size=1310172 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)MP2P,payload=96" ! rtpbin name=recv_rtp ! rtpjitterbuffer latency=500 ! queue leaky=downstream max-size-time=5000000000 max-size-buffers=0 max-size-bytes=0 ! watchdog timeout=10000 ! rtpmp2pdepay ! mpegpsdemux name=demux demux.video_e0 ! mpegvideoparse ! queue leaky=downstream max-size-time=5000000000 max-size-buffers=0 max-size-bytes=0 ! decodebin ! videoconvert ! video/x-raw,format=RGBA ! deinterlace method=vfir fields=top ! videoconvert ! videorate drop-only=true ! video/x-raw,framerate=25/1 ! openh264enc bitrate=49152 gop-size=5 ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=nal ! rndbuffersize max=65000 ! queue leaky=downstream max-size-time=5000000000 max-size-buffers=0 max-size-bytes=0 ! udpsink host=127.0.0.1 port=6311 sync=false max-lateness=0

FFmpeg Command:

ffmpeg -loglevel debug -probesize 32 -analyzeduration 0 -i udp://127.0.0.1:6311?buffer-size=1310172 -fflags +nobuffer -flags low_delay -err_detect ignore_err -c:v copy -c:a copy -movflags +frag_keyframe+empty_moov+default_base_moof -pix_fmt yuv420p -preset ultrafast -tune zerolatency -window_size 30 -extra_window_size 15 -use_template 1 -use_timeline 0 -streaming 1 -adaptation_sets "id=0,streams=v id=1,streams=a" -utc_timing_url "http://time.akamai.com/?iso" -write_prft 1 -index_correction 1 -seg_duration 4 -frag_duration 0.2 -frag_type duration -flags +global_header -format_options "movflags=cmaf" -ldash 1 -target_latency 2.0 -http_persistent 1 -f dash manifest.mpd

Issue:

When trying to play the DASH stream in a browser-based player I got A MEDIA_ERR_DECODE occured: Resetting the MediaSource

Conclusion:

According to the MDN Web documentation and the HTML specification, a MEDIA_ERR_DECODE occurs when the attempt to decode media data—previously determined to be usable—results in an error. This typically happens due to corrupt frames, missing keyframes, incorrect timestamps, or format inconsistencies in the stream.

Question:

What changes can I make in my FFmpeg command to avoid these decoding issues and ensure a more stable playback experience?

Any help or suggestions would be greatly appreciated. Thanks in advance! 🙌

Read more here: Source link