gstreamer – Why is FFmpeg creating an inconsistent number of fragments in MPEG-DASH?
Context:
I’m using GStreamer to receive an RTP MPEG-TS stream from a multicast camera, process it, and forward it via UDP to FFmpeg, which then generates low-latency MPEG-DASH segments.
Problem:
I expect exactly 20 fragments per 4-second segment (frag_duration=0.2, seg_duration=4), but FFmpeg sometimes creates 15, 18, or 23 fragments instead.
Gstreamer Pipeline
udpsrc address= port= do-timestamp=true timeout=60000000000 buffer-size=1310172 caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)MP2T,payload=103" ! rtpbin name=recv_rtp ! rtpjitterbuffer ! queue ! watchdog timeout=10000 ! rtpmp2tdepay tts=true ! queue ! tsparse set-timestamps=true ! tsdemux wait-pcr=false ! h264parse ! video/x-h264,stream-format=byte-stream,alignment=nal ! rndbuffersize max=65000 ! queue ! udpsink host=127.0.0.1 port=6311 max-lateness=0
here is my 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 -g 10 -keyint_min 10 -sc_threshold 0 -movflags +frag_keyframe+empty_moov+default_base_moof -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
Running MP4Box -info .m4s shows an inconsistent number of fragments per segment.
The number of fragments varies, though frag_duration is fixed at 0.2s.
I want exactly equal number of fragments to ensure smooth playback. Any insights into the cause of this variation and possible solutions would be greatly appreciated.
Thanks in advance!
Read more here: Source link
