我通过ffmpeg开始视频传输,如下所示:
ffmpeg -f video4linux2 -i /dev/video0 -vcodec libx264 -preset ultrafast -crf 20 -tune zerolatency -s 800x600 -r 25 -b:v 0.9M -sdp_file video.sdp -f rtp rtp://192.168.10.24:5010 我是这样复制的:
ffplay -protocol_whitelist file,udp,rtp video.sdp 一切都运行得很好。然后我中断传输,几秒钟后我恢复。ffplay不会立即开始重现,但会出现错误:
....
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 14 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 33 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 41 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 49 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 33 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 27 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 14 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 48 times
[sdp @ 0x6ebf80] RTP: dropping old packet received too lateB f=1/1
Last message repeated 34 times
...... 一段时间后,播放恢复,但它太长了。有没有一种方法可以消除或最小化这种性质的错误的发生,当传入的流被挂起时,可以选择或其他什么吗?阅读手册ffmpeg没有任何有价值的关于这没有纳瑞尔....(
发布于 2019-02-02 16:47:47
好的,我也遇到了同样的问题,并且花了一个小时的时间。深入研究了ffmpeg代码;在libavformat/rtpdec.c中
if ((s->seq == 0 && !s->queue) || s->queue_size <= 1) {
/* First packet, or no reordering */
return rtp_parse_packet_internal(s, pkt, buf, len);
} else {
uint16_t seq = AV_RB16(buf + 2);
int16_t diff = seq - s->seq;
if (diff < 0) {
/* Packet older than the previously emitted one, drop */
av_log(s->ic, AV_LOG_WARNING,
"RTP: dropping old packet received too late\n");
return -1;
} else if (diff <= 1) {它提到了no reordering。因此,我跟进了queue_size,在libavformat/rtsp.c中谈到了reordering_queue_size,并在文档https://ffmpeg.org/ffmpeg-protocols.html#rtsp中展示了
-reorder_queue_size
Set number of packets to buffer for handling of reordered packets.它不是显式的,但是如果您添加-reorder_queue_size 0,它就解决了这个问题,因为它会停止对数据包进行排序。我验证并解决了我的问题。我可以打断消息来源。2分钟后重新启动,它就能正常工作了
主要是因为作为udp和实时我不需要任何命令,它应该只播放通过
希望这也能解决你的问题
https://stackoverflow.com/questions/47301718
复制相似问题