Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.5k views
in Technique[技术] by (71.8m points)

webrtc - ffmpeg fails to output rtp when setting start time (-ss)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...