Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing packets error when streaming rtsp to rtmp using ffmpeg

I'm using ffmpeg to do RTSP to RTMP streaming, the input is an sdp file describing one video stream and one audio stream, when I test the RTSP using ffplay,it works fine

ffplay -protocol_whitelist "file,udp,rtp" -strict -2 -i media.sdp

but when I switch to ffmpeg to do streaming, I got lot of packet missing errors

ffmpeg -protocol_whitelist "file,udp,rtp" -strict -2  -i media.sdp   -c copy -f flv "rtmp://liveaddress"

error log:

[sdp @ 000001f1f4cea400] max delay reached. need to consume packet
[sdp @ 000001f1f4cea400] RTP: missed 321 packets
[sdp @ 000001f1f4cea400] max delay reached. need to consume 
[sdp @ 000001f1f4cea400] RTP: missed 14 packets
[sdp @ 000001f1f4cea400] max delay reached. need to consume packet
[sdp @ 000001f1f4cea400] RTP: missed 7 packets

the sdp file:

SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=No Name
t=0 0
a=tool:libavformat 58.12.100
m=video 5555 RTP/AVP 96
c=IN IP4 127.0.0.1
b=AS:2000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z0LAINoBQBbsBagICAoAAAfSAAOpgR4wZUA=,aM4fIA==; profile-level-id=42c020
m=audio 6666 RTP/AVP 96
c=IN IP4 127.0.0.1
b=AS:125
a=rtpmap:96 MPEG4-GENERIC/44100/2
a=fmtp:96 profile-level-id=1;mode=AAC-hbr;sizelength=13;indexlength=3;indexdeltalength=3; config=1210
like image 235
ArL Avatar asked Oct 27 '25 05:10

ArL


2 Answers

After some research on the web, I have found a solution: add a -buffer_size command arg to ffmpeg cause my H264 video from RTSP server has variable bit rate I guess.

like image 59
ArL Avatar answered Oct 30 '25 10:10

ArL


I had a similar problem, solved with -rtsp_transport tcp -protocol_whitelist rtp,file,udp,tcp command line options for ffmpeg

like image 24
Paolo Redaelli Avatar answered Oct 30 '25 09:10

Paolo Redaelli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!