FFMPEG 无法在 avformat_find_stream_info 中打开 RTSP 源的编解码器

FFMPEG 无法在 avformat_find_stream_info 中打开 RTSP 源的编解码器

当版本高于 2.8.15 时,使用 FFMPEG 时我会遇到问题(不是边界 - 只是 v3 和 v4 不起作用)。ffprobe 也不起作用。

版本 3:

ffprobe -rtsp_transport tcp rtsp://user:password@ipaddress:5544/live0.264

返回:

[h264 @ 0xcd6e70] Overread VUI by 8 bits
[rtsp @ 0xcd3b10] Failed to open codec in av_find_stream_info
[NULL @ 0xcd6e70] Overread VUI by 8 bits
[h264 @ 0xcd6e70] Overread VUI by 8 bits
[rtsp @ 0xcd3b10] Could not find codec parameters for stream 0 (Video: h264 (High), none(progressive)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://user:password@ipaddress:5544/live0.264':
  Metadata:
    title           : Session Streamed by LIBZRTSP
    comment         : live0.264
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), none(progressive), 90k tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s

ffmpeg -f rtsp -rtsp_transport tcp -y -i "rtsp://user:password@ipaddress:5544/live0.264" -f image2 -vframes 1 -vsync 2 -pix_fmt yuvj420p "/home/james/photo_$(date +%Y.%m.%d_%H:%M:%S).jpg"

返回

[h264 @ 0x1634680] Overread VUI by 8 bits
[rtsp @ 0x16312f0] Failed to open codec in av_find_stream_info
[NULL @ 0x1634680] Overread VUI by 8 bits
[h264 @ 0x1634680] Overread VUI by 8 bits
[rtsp @ 0x16312f0] Could not find codec parameters for stream 0 (Video: h264 (High), none(progressive)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://user:password@ipaddress:5544/live0.264':
  Metadata:
    title           : Session Streamed by LIBZRTSP
    comment         : live0.264
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), none(progressive), 90k tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, mono, s16, 64 kb/s
[buffer @ 0x177e510] Unable to parse option value "0x0" as image size
[buffer @ 0x177e510] Unable to parse option value "-1" as pixel format
[buffer @ 0x177e510] Unable to parse option value "0x0" as image size
[buffer @ 0x177e510] Error setting option video_size to value 0x0.
[graph 0 input from stream 0:0 @ 0x177e490] Error applying options to the filter.
Error opening filters!

版本 4 相同,只是它提到 avformat_find_stream_info 而不是 av_find_stream_info

但...

版本 2.8.15:

ffmpeg -f rtsp -rtsp_transport tcp -y -i "rtsp://user:password@ipaddress:5544/live0.264" -f image2 -vframes 1 -vsync 2 -pix_fmt yuvj420p "/home/james/photo_$(date +%Y.%m.%d_%H:%M:%S).jpg"

返回:

[h264 @ 0x2243e80] Overread VUI by 8 bits
    Last message repeated 5 times
Invalid UE golomb code
    Last message repeated 1 times
Guessed Channel Layout for  Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://user:password@ipaddress:5544/live0.264':
  Metadata:
    title           : Session Streamed by LIBZRTSP
    comment         : live0.264
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: h264 (High), yuvj420p(pc, bt709), 1920x1080, 10 fps, 10 tbr, 90k tbn, 180k tbc
    Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
[h264 @ 0x242bd60] Overread VUI by 8 bits
    Last message repeated 2 times
Output #0, image2, to '/home/james/photo_2019.04.04_10:17:03.jpg':
  Metadata:
    title           : Session Streamed by LIBZRTSP
    comment         : live0.264
    encoder         : Lavf56.40.101
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 10 fps, 10 tbn, 10 tbc
    Metadata:
      encoder         : Lavc56.60.100 mjpeg
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Invalid UE golomb code
frame=    1 fps=0.0 q=9.5 Lsize=N/A time=00:00:00.10 bitrate=N/A
video:146kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

但绝对有效并返回正确的照片。

为了诊断目的,我还从相机中输出了较低分辨率的流:rtsp://user:password@ipaddress:5544/live1.264 适用于所有版本!

有什么方法可以让我查看 steam 信息并发现差异吗?

是因为 RTSP 流无效,但可用于 v2(而拒绝用于 v3)吗?还是有其他问题,我可以通过更改参数来修复?

任何关于如何在至少 v3 版本上运行它的指导都将不胜感激。

不幸的是,这些摄像机看起来像 PIR 警报传感器,并通过以太网供电,因此市场上实际上没有其他选择。

谢谢,如果您需要其他信息请告诉我?

更新时间:2019 年 4 月 4 日 17:20 伦敦: 我尝试了相机中的流设置,发现当我将流设置为 720p 时,更高分辨率的流可以正常工作。但是,一旦我切换回 1080p,它就会再次失败。不确定这是否有帮助。

答案1

相机正在生成无效的 VUI,这是 SPS 的一部分。您需要修补 ffmpeg 以更好地处理此错误,或者相机制造商需要通过固件更新来修复它。

相关内容