ffmpeg h264有趣的明亮视频失败?

ffmpeg h264有趣的明亮视频失败?,ffmpeg,udp,video-streaming,h.264,mpeg2-ts,Ffmpeg,Udp,Video Streaming,H.264,Mpeg2 Ts,我正在使用我找到的信息尝试使用ffmpeg流媒体 服务器 ffmpeg -f dshow -i video="john":audio="doe" -vcodec libx264 -preset ultrafast -tune zerolatency -acodec aac -f mpegts udp://localhost:1234 客户 ffmpeg -i udp://localhost:1234?listen test.mp4 客户端实际上会实时播放视频,但出于测试目的,我现在正

我正在使用我找到的信息尝试使用ffmpeg流媒体

  • 服务器

    ffmpeg -f dshow -i video="john":audio="doe" -vcodec libx264
    -preset ultrafast -tune zerolatency -acodec aac -f mpegts udp://localhost:1234
    
  • 客户

    ffmpeg -i udp://localhost:1234?listen test.mp4
    
客户端实际上会实时播放视频,但出于测试目的,我现在正在将输出写入一个文件

有趣的部分来了。我开始流(视频和音频)在一个黑暗的房间,一切都很好我打开房间的灯,客户哭了很多错误。我后来检查了输出,它确实是非常损坏的光打开部分。这背后的原因可能是什么?如果有帮助的话,我会把错误贴在这里

一些错误:

udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 845.6kbits/s dup=1250 drop=0 speed=1.08x
    Last message repeated 1 times
[h264 @ 0000026c4af69400] Invalid NAL unit 1, skipping.7.61 bitrate= 864.7kbits/s dup=1441 drop=0 speed=1.07x
[h264 @ 0000026c4af69400] Invalid level prefix
[h264 @ 0000026c4af69400] error while decoding MB 18 8
[h264 @ 0000026c4af69400] concealing 911 DC, 911 AC, 911 MV errors in P frame
[h264 @ 0000026c4af4b780] Invalid NAL unit 1, skipping.
[h264 @ 0000026c4af4b780] negative number of zero coeffs at 10 14
[h264 @ 0000026c4af4b780] error while decoding MB 10 14
[h264 @ 0000026c4af4b780] concealing 679 DC, 679 AC, 679 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0
    Last message repeated 1 times
[h264 @ 0000026c4ba1e1c0] Invalid NAL unit 1, skipping.8.21 bitrate= 858.0kbits/s dup=1460 drop=0 speed=1.07x
[h264 @ 0000026c4ba1e1c0] out of range intra chroma pred mode
[h264 @ 0000026c4ba1e1c0] error while decoding MB 34 18
[h264 @ 0000026c4ba1e1c0] concealing 495 DC, 495 AC, 495 MV errors in P frame
[h264 @ 0000026c4bb16840] top block unavailable for requested intra mode
[h264 @ 0000026c4bb16840] error while decoding MB 10 0
[h264 @ 0000026c4bb16840] concealing 160 DC, 160 AC, 160 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0
[h264 @ 0000026c4bb16cc0] Invalid NAL unit 0, skipping.8.58 bitrate= 853.9kbits/s dup=1463 drop=0 speed=1.06x
[h264 @ 0000026c4bb16cc0] corrupted macroblock 16 28 (total_coeff=-1)
[h264 @ 0000026c4bb16cc0] error while decoding MB 16 28
[h264 @ 0000026c4bb16cc0] concealing 113 DC, 113 AC, 113 MV errors in P frame
[h264 @ 0000026c4bb17140] cbp too large (84) at 12 0
[h264 @ 0000026c4bb17140] error while decoding MB 12 0
[h264 @ 0000026c4bb17140] concealing 160 DC, 160 AC, 160 MV errors in P frame
[mpegts @ 0000026c4aeb8d80] PES packet size mismatch
[h264 @ 000002646f0d2f80] cbp too large (118) at 23 1422.25 bitrate= 659.5kbits/s dup=368 drop=0 speed=1.33x
[h264 @ 000002646f0d2f80] error while decoding MB 23 14
[mpegts @ 000002646e578d80] PES packet size mismatch
[h264 @ 000002646f0d2f80] concealing 666 DC, 666 AC, 666 MV errors in P frame
[h264 @ 000002646f0d0f80] concealing 160 DC, 160 AC, 160 MV errors in P frame
[aac @ 000002646e64d640] Number of bands (59) exceeds limit (43).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 000002646e64d640] Multiple frames in a packet.
[aac @ 000002646e64d640] Reserved bit set.
[aac @ 000002646e64d640] Number of bands (31) exceeds limit (29).
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 000002646e5e11c0] concealing 160 DC, 160 AC, 160 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 633.1kbits/s dup=368 drop=0 speed=1.35x
    Last message repeated 2 times
编辑:作为建议,我将这些参数添加到服务器

-b:v 1M -bufsize 2M
现在错误基本上消失了。除了有一次好像是在我关上灯的时候发生的,尽管我试了4-5次都没能再现出来

错误:

udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 845.6kbits/s dup=1250 drop=0 speed=1.08x
    Last message repeated 1 times
[h264 @ 0000026c4af69400] Invalid NAL unit 1, skipping.7.61 bitrate= 864.7kbits/s dup=1441 drop=0 speed=1.07x
[h264 @ 0000026c4af69400] Invalid level prefix
[h264 @ 0000026c4af69400] error while decoding MB 18 8
[h264 @ 0000026c4af69400] concealing 911 DC, 911 AC, 911 MV errors in P frame
[h264 @ 0000026c4af4b780] Invalid NAL unit 1, skipping.
[h264 @ 0000026c4af4b780] negative number of zero coeffs at 10 14
[h264 @ 0000026c4af4b780] error while decoding MB 10 14
[h264 @ 0000026c4af4b780] concealing 679 DC, 679 AC, 679 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0
    Last message repeated 1 times
[h264 @ 0000026c4ba1e1c0] Invalid NAL unit 1, skipping.8.21 bitrate= 858.0kbits/s dup=1460 drop=0 speed=1.07x
[h264 @ 0000026c4ba1e1c0] out of range intra chroma pred mode
[h264 @ 0000026c4ba1e1c0] error while decoding MB 34 18
[h264 @ 0000026c4ba1e1c0] concealing 495 DC, 495 AC, 495 MV errors in P frame
[h264 @ 0000026c4bb16840] top block unavailable for requested intra mode
[h264 @ 0000026c4bb16840] error while decoding MB 10 0
[h264 @ 0000026c4bb16840] concealing 160 DC, 160 AC, 160 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0
[h264 @ 0000026c4bb16cc0] Invalid NAL unit 0, skipping.8.58 bitrate= 853.9kbits/s dup=1463 drop=0 speed=1.06x
[h264 @ 0000026c4bb16cc0] corrupted macroblock 16 28 (total_coeff=-1)
[h264 @ 0000026c4bb16cc0] error while decoding MB 16 28
[h264 @ 0000026c4bb16cc0] concealing 113 DC, 113 AC, 113 MV errors in P frame
[h264 @ 0000026c4bb17140] cbp too large (84) at 12 0
[h264 @ 0000026c4bb17140] error while decoding MB 12 0
[h264 @ 0000026c4bb17140] concealing 160 DC, 160 AC, 160 MV errors in P frame
[mpegts @ 0000026c4aeb8d80] PES packet size mismatch
[h264 @ 000002646f0d2f80] cbp too large (118) at 23 1422.25 bitrate= 659.5kbits/s dup=368 drop=0 speed=1.33x
[h264 @ 000002646f0d2f80] error while decoding MB 23 14
[mpegts @ 000002646e578d80] PES packet size mismatch
[h264 @ 000002646f0d2f80] concealing 666 DC, 666 AC, 666 MV errors in P frame
[h264 @ 000002646f0d0f80] concealing 160 DC, 160 AC, 160 MV errors in P frame
[aac @ 000002646e64d640] Number of bands (59) exceeds limit (43).
Error while decoding stream #0:1: Invalid data found when processing input
[aac @ 000002646e64d640] Multiple frames in a packet.
[aac @ 000002646e64d640] Reserved bit set.
[aac @ 000002646e64d640] Number of bands (31) exceeds limit (29).
Error while decoding stream #0:1: Invalid data found when processing input
[h264 @ 000002646e5e11c0] concealing 160 DC, 160 AC, 160 MV errors in P frame
udp://localhost:1234?listen: corrupt decoded frame in stream 0trate= 633.1kbits/s dup=368 drop=0 speed=1.35x
    Last message repeated 2 times
错误减少是因为我提高了比特率?(顺便说一下,我不知道默认比特率)。Bright解码失败是因为它携带了更多的信息,数据?(在原始视频中相同,但可能文件编码的明亮帧较重)

在客户端(我看到您使用的是FFmpeg),添加:

因此,您的CLI将如下所示:

ffmpeg -flags2 showall -i udp://localhost:1234?listen test.mp4
这允许渲染第一个关键帧之前的帧,而不是将其丢弃


一些无人机摄像头(DJI)产生的画面具有相同的问题,只能通过该标志进行纠正。

如果您从灯亮起开始,是否存在此问题?还是只有从黑暗过渡到光明?同样,如果你快速地将相机指向一个全新的场景,你有问题吗?@Brad问题存在于灯光开启时,关闭时消失。啊,好吧,那么i-frames就没有问题了。对不起,帮不上忙了。。。这超出了我所知的深度。强制使用固定比特率怎么样?在一定的比特率以上问题是否可以重现?可能是打包的问题,而且随着灯光的亮起,需要更多的比特来编码你的场景?@Brad请检查编辑。