I'm using ffmpeg to stream output to an RTP endpoint. This works fine with audio and video, but fails when using the -ss
flag. The command I'm using is
ffmpeg
-fflags +genpts
-re
-v info
-protocol_whitelist pipe,tls,file,http,https,tcp,rtp
-i in.mp4
-map
0:v:0
-c:v libx264
-pix_fmt yuv420p
-tune zerolatency
-preset ultrafast
-g 30
-keyint_min 30
-map 0:a:0
-c:a libopus
-ab 128k
-ac 2
-ar 48000
-f tee
[select=v:f=rtp:ssrc=2222:payload_type=101]rtp://1.1.1.1:44973?rtcpport=44663|[select=a:f=rtp:ssrc=1111:payload_type=100]rtp://1.1.1.1:47974?rtcpport=46683'
This command works fine. If I add -ss 5
just before -i in.mp4
, ffmpeg flips out. The rtp receiving side reports PLI for every frame, and the ffmpeg output indicates something is wrong:
frame= 0 fps=0.0 q=0.0 size=N/A time=-577014:32:22.77 bitrate=N/A speed=N/A
Also, when running with debug logs, ffmpeg reports cur_dts is invalid many times.
If I output to a file instead of rtp, everything seems to work. Any advice on how to handle this would be most appreciated!
question from:
https://stackoverflow.com/questions/65850430/ffmpeg-fails-to-output-rtp-when-setting-start-time-ss 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…