如何修复 FFmpeg 中的“数据包不匹配 -92141241 11 214124”错误?

问题描述 投票:0回答:1

如何修复“数据包不匹配 -92141241 11 214124”错误。
我要回答我自己的问题,因为短语“数据包大小不匹配”经常出现在与 ffmpeg 相关的帖子中,但我没有看到令人满意的解决方案。
我的命令是:

ffmpeg -rw_timeout 1000000 -i rtmp://ip/appName/StreamName -vn -ar 16000 -ac 1 -f segment -segment_format wav -segment_time 3 %d.wav

错误是:

[segment e X5b4a87e55e0 Upening I.wav for writing
[segment @ Øx5634a87e53e0] Opening '2.wav' for writing
[segment @ 8x5634a87e53e0] Opening '3.wav' for writing
[segment @ Øx5634a87e53e0] Opening '4.wav' for writing
[segment @ Øx5634a87e53e0] Opening '5.wav' for writing
[segment @ 8x5634a87e53e0] Opening '6.wav' for writing
[segment @ Øx5634a87e53e0] Opening '7.wav' for writing
[segment @ Øx5634a87e53eØ] Opening '8.wav' for writing
[segnent @ 0x5634a87e53e0] Opening '9.wav' for writing
[segnent @ 0x5634a87e53e0J Opening '10.wav' for writing
[segment @ Øx5634a87e53eØJ Opening '11.wav' for writing
[segment @ Øx5634a87e53eØ] Opening '12.wav' for writing
[segment @ Øx5634a87e53eØ] Opening '13.wav' for writing
[segment @ Øx5634a87e53eØ] Opening '14.wav' for writing
[segment @ 0x5634a87e53e0] Opening '15.wav' for writing
[segment @ Øx5634a87e53e0] Opening '16.wav' for writing
[segment @ 0x5634a87e53e0] Opening '17.wav' for writing
[flv @ 0x5634a87df740J Packet mismatch -92244280 11 167729
[flv @ 0x5634a87df740] Packet mismatch -594165790 48656 216385
[flv @ ex5634a87df740] Packet mismatch -289696512 49936 2663212
[flv @ 0x5634a87df740] Packet mismatch -606269659 56848 323169
[flv @ 0x5634a87df740] Packet mismatch -1989457532 419680 372849
[flv @ 0x5634a87df740] Packet mismatch -1243998453 49937 422786

我该如何修复?

谢谢!

ffmpeg
1个回答
0
投票

原因

参考

“在flv_read_packet函数中,在Packet不匹配发生之前,rtmp read返回EIO,avio_r8返回0,因此var type,size和dts等于0, 此时 avio_feof 读取下一个 rtmp 数据包,在函数 goto 标记离开后大小等于 0,var 最后等于前四个字节 发生数据包不匹配后,rtmp读取数据包是正确的 所以rtmp级别是正确的而flv级别是错误的 avio_r8 和 avio_rb32 无法返回失败状态 因为flv包错误,无法读取正确的大小”

如何解决这个问题

在解析flv标签之前确保IOContext缓冲区有数据,或者你可以检查

type
不为0。但不要忘记调用
avio_feof()
以确保
eof
标志被清除,否则你可能会陷入无限循环。

© www.soinside.com 2019 - 2024. All rights reserved.