FFmpeg linux解包解码rtsp流编码h.264/h.265 mp4视频报错问题排查(没解决)

Posted Dontla

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了FFmpeg linux解包解码rtsp流编码h.264/h.265 mp4视频报错问题排查(没解决)相关的知识,希望对你有一定的参考价值。

无论是在ubuntu虚拟机上,还是英伟达jetson盒子上,用官方编译好的ffmpeg解包解码转码封装海康rtsp视频流,就会出现这样问题(3090显卡x64机器上测试问题倒少一点,只有开头绿屏问题)

root@nvidia-desktop:/userdata/ffmpeg-n5.1.2-7-ga6e26053c2-linuxarm64-gpl-shared-5.1/bin# ./ffmpeg -y -i rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream -vcodec hevc -f mp4 2.mp4
ffmpeg version n5.1.2-7-ga6e26053c2-20221124 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.2.0 (crosstool-NG 1.25.0.90_cf9beb1)
  configuration: --prefix=/ffbuild/prefix --pkg-config-flags=--static --pkg-config=pkg-config --cross-prefix=aarch64-ffbuild-linux-gnu- --arch=aarch64 --target-os=linux --enable-gpl --enable-version3 --disable-debug --enable-shared --disable-static --enable-iconv --enable-libxml2 --enable-zlib --enable-libfreetype --enable-libfribidi --enable-gmp --enable-lzma --enable-fontconfig --enable-libvorbis --enable-opencl --enable-libpulse --enable-libvmaf --enable-libxcb --enable-xlib --enable-amf --enable-libaom --enable-libaribb24 --enable-avisynth --disable-chromaprint --enable-libdav1d --disable-libdavs2 --disable-libfdk-aac --enable-ffnvcodec --enable-cuda-llvm --enable-frei0r --enable-libgme --enable-libkvazaar --enable-libass --enable-libbluray --enable-libjxl --enable-libmp3lame --enable-libopus --enable-mbedtls --enable-librist --enable-libssh --enable-libtheora --enable-libvpx --enable-libwebp --enable-lv2 --disable-libmfx --disable-openal --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-librav1e --enable-librubberband --disable-schannel --enable-sdl2 --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtwolame --enable-libuavs3d --enable-libdrm --disable-vaapi --enable-libvidstab --enable-vulkan --enable-libshaderc --enable-libplacebo --enable-libx264 --enable-libx265 --disable-libxavs2 --enable-libxvid --enable-libzimg --enable-libzvbi --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldflags=-pthread --extra-ldexeflags='-pie -Wl,-rpath=\\$\\$ORIGIN -Wl,-rpath=\\$\\$ORIGIN/../lib' --extra-libs='-ldl -lgomp' --extra-version=20221124
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 1 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 52 packets
[h264 @ 0x55665c1e80] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x55665c1e80] error while decoding MB 0 30, bytestream 85622
[h264 @ 0x55665c1e80] concealing 4609 DC, 4609 AC, 4609 MV errors in I frame
Input #0, rtsp, from 'rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream':
  Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, 25 fps, 25 tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (pcm_alaw (native) -> aac (native))
Press [q] to stop, [?] for help
[aac @ 0x556661b010] Too many bits 8832.000000 > 6144 per frame requested, clamping to max
[h264 @ 0x556661c0d0] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x556661c0d0] error while decoding MB 0 30, bytestream 85622
[h264 @ 0x556661c0d0] concealing 4609 DC, 4609 AC, 4609 MV errors in I frame
rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream: corrupt decoded frame in stream 0
x265 [info]: HEVC encoder version 3.5+67-49ab9e83b
x265 [info]: build info [Linux][GCC 12.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: NEON
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 8 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 3 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 25 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to '2.mp4':
  Metadata:
    title           : Media Presentation
    encoder         : Lavf59.27.100
  Stream #0:0: Video: hevc (hev1 / 0x31766568), yuvj420p(pc, bt709, progressive), 1920x1080, q=2-31, 25 fps, 12800 tbn
    Metadata:
      encoder         : Lavc59.37.100 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, mono, fltp, 48 kb/s
    Metadata:
      encoder         : Lavc59.37.100 aac
[rtsp @ 0x55665bd860] max delay reached. need to consume packetate=   0.4kbits/s speed=0.571x    
[rtsp @ 0x55665bd860] RTP: missed 52 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 2 packets
[h264 @ 0x556661c0d0] Increasing reorder buffer to 1
[h264 @ 0x556661c0d0] error while decoding MB 3 64, bytestream -5
[h264 @ 0x556661c0d0] concealing 526 DC, 526 AC, 526 MV errors in P frame
[rtsp @ 0x55665bd860] max delay reached. need to consume packetrate=   0.1kbits/s speed=0.715x    
[rtsp @ 0x55665bd860] RTP: missed 539 packets
[h264 @ 0x5566707070] error while decoding MB 9 52, bytestream -7
[h264 @ 0x5566707070] concealing 1960 DC, 1960 AC, 1960 MV errors in P frame
rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream: corrupt decoded frame in stream 00 speed=0.582x    
[rtsp @ 0x55665bd860] max delay reached. need to consume packetrate=   0.1kbits/s dup=25 drop=0 speed=0.367x    
[rtsp @ 0x55665bd860] RTP: missed 1094 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 154 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 18 packets
[h264 @ 0x5566b21ac0] cabac decode of qscale diff failed at 37 41
[h264 @ 0x5566b21ac0] error while decoding MB 37 41, bytestream -1
[h264 @ 0x5566b21ac0] concealing 3252 DC, 3252 AC, 3252 MV errors in P frame
[h264 @ 0x556661c0d0] error while decoding MB 96 6, bytestream -5
[h264 @ 0x556661c0d0] concealing 7393 DC, 7393 AC, 7393 MV errors in P frame
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 15 packets
[h264 @ 0x5566bde660] error while decoding MB 36 13, bytestream -5
[h264 @ 0x5566bde660] concealing 6613 DC, 6613 AC, 6613 MV errors in P frame
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 18 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 18 packets
[h264 @ 0x55666e2d10] error while decoding MB 8 66, bytestream -11
[h264 @ 0x55666e2d10] concealing 281 DC, 281 AC, 281 MV errors in P frame
[h264 @ 0x55666f4ec0] error while decoding MB 10 66, bytestream -9
[h264 @ 0x55666f4ec0] concealing 279 DC, 279 AC, 279 MV errors in P frame
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 20 packets
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 2 packets
[h264 @ 0x5566707070] error while decoding MB 10 66, bytestream -5
[h264 @ 0x5566707070] concealing 279 DC, 279 AC, 279 MV errors in P frame
[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 1320 packets
rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream: corrupt decoded frame in stream 0=0 speed=0.384x    
rtsp://admin:abc12345@192.168.1.67/h264/ch1/main/av_stream: corrupt decoded frame in stream 0=0 speed=0.375x    
^C^C^CReceived > 3 system signals, hard exiting
root@nvidia-desktop:/userdata/ffmpeg-n5.1.2-7-ga6e26053c2-linuxarm64-gpl-shared-5.1/bin# ^C
root@nvidia-desktop:/userdata/ffmpeg-n5.1.2-7-ga6e26053c2-linuxarm64-gpl-shared-5.1/bin# 

总共有好几个报错,但不知道哪个是关键错误

[rtsp @ 0x55665bd860] max delay reached. need to consume packet
[rtsp @ 0x55665bd860] RTP: missed 1 packets
[h264 @ 0x55665c1e80] left block unavailable for requested intra4x4 mode -1
[h264 @ 0x55665c1e80] error while decoding MB 0 30, bytestream 85622
[h264 @ 0x55665c1e80] concealing 4609 DC, 4609 AC, 4609 MV errors in I frame

20221126 我在虚拟机ubuntu上测,也一样问题,把github上release的不同版本的库都测试一遍,也都一样

算了还是直接用gpu吧,cpu解编码先不管它先

以上是关于FFmpeg linux解包解码rtsp流编码h.264/h.265 mp4视频报错问题排查(没解决)的主要内容,如果未能解决你的问题,请参考以下文章

没有解码/编码的FFmpeg remux

android 怎么播放rtsp流

流媒体解码及H.264编码推流

音视频系列6:rtsp模拟流解码

ffmpeg 推流相关指令

使用ffmpeg命令推送rtsp流,不包含SPS和PPS帧