首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ffmpeg rtp流错误: RTP:丢弃收到的旧数据包太迟

ffmpeg rtp流错误: RTP:丢弃收到的旧数据包太迟
EN

Stack Overflow用户
提问于 2017-11-15 15:31:21
回答 1查看 2.9K关注 0票数 3

我通过ffmpeg开始视频传输,如下所示:

代码语言:javascript
复制
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    

我是这样复制的:

代码语言:javascript
复制
ffplay -protocol_whitelist file,udp,rtp video.sdp    

一切都运行得很好。然后我中断传输,几秒钟后我恢复。ffplay不会立即开始重现,但会出现错误:

代码语言:javascript
复制
....
[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没有任何有价值的关于这没有纳瑞尔....(

EN

回答 1

Stack Overflow用户

发布于 2019-02-02 16:47:47

好的,我也遇到了同样的问题,并且花了一个小时的时间。深入研究了ffmpeg代码;在libavformat/rtpdec.c

代码语言:javascript
复制
    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中展示了

代码语言:javascript
复制
-reorder_queue_size

    Set number of packets to buffer for handling of reordered packets.

它不是显式的,但是如果您添加-reorder_queue_size 0,它就解决了这个问题,因为它会停止对数据包进行排序。我验证并解决了我的问题。我可以打断消息来源。2分钟后重新启动,它就能正常工作了

主要是因为作为udp和实时我不需要任何命令,它应该只播放通过

希望这也能解决你的问题

票数 6
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47301718

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档