gpt4 book ai didi

ffmpeg rtp 流错误 : RTP: dropping old packet received too late

转载 作者:行者123 更新时间:2023-12-04 16:46:51 27 4
gpt4 key购买 nike

我像这样通过 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 没什么值得的,这没有 naryl .... ((((

最佳答案

好的,所以我遇到了同样的问题并花了一个小时的时间。深入研究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) {

它谈到没有重新排序。所以我跟进了 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 和实时我不需要任何命令,它应该只播放通过的内容

希望这也能解决您的问题

关于ffmpeg rtp 流错误 : RTP: dropping old packet received too late,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47301718/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com