video – FFmpeg/RTSP/h264 – Could not find codec parameters for stream 0

I compiled static FFmpeg to capture a frame from an RTSP stream (from a Hikvision CCTV) to an image. The stream is over TCP can be played using VLC, but I’m having a hard time with FFmpeg since ffmpeg always ended up with Could not find codec parameters for stream 0.

I’ve tried -analyzeduration 10M -probesize 10M yet not making a difference.

Is there any way to solve this?

My x264 config:

--disable-opencl

My FFmpeg configuration:

--disable-everything --disable-autodetect --enable-pic --enable-static --enable-gpl --enable-version3 --enable-libx264 --enable-demuxer=hls --enable-demuxer=rtsp --enable-demuxer=h264 --enable-decoder=h264 --enable-parser=h264 --enable-encoder=mjpeg --enable-muxer=image2 --enable-protocol=pipe --enable-protocol=tcp --enable-protocol=http --enable-decoder=aac --enable-parser=aac --enable-protocol=file --enable-protocol=udp --enable-protocol=rtmp

ffprobe seems manage to decode a frame once a while:

[pairman@pairface ffmpeg-7.1]$ ./ffprobe rtsp://**.**.**.56:554/pag://**.**.**.50:7302:009422:0:MAIN:TCP?streamform=rtp -rtsp_transport tcp
ffprobe version 7.1 Copyright (c) 2007-2024 the FFmpeg developers
  built with gcc 14 (GCC)
  configuration: --arch=x86_64 --target-os=linux --prefix=/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target --pkg-config-flags=--static --extra-cflags="-I/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/include -Os" --extra-cxxflags="-I/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/include -Os" --extra-ldflags="-L/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/lib -Wl,-s " --extra-libs="-lpthread -lm" --extra-ldexeflags=-static --bindir=/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/bin --disable-manpages --disable-doc --disable-everything --disable-autodetect --enable-pic --enable-static --enable-gpl --enable-version3 --enable-libx264 --enable-demuxer=hls --enable-demuxer=rtsp --enable-demuxer=h264 --enable-decoder=h264 --enable-parser=h264 --enable-encoder=mjpeg --enable-muxer=image2 --enable-protocol=pipe --enable-protocol=tcp --enable-protocol=http --enable-decoder=aac --enable-parser=aac --enable-protocol=file --enable-protocol=udp --enable-protocol=rtmp
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[h264 @ 0xd5de000] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0xd5de000] decode_slice_header error
[h264 @ 0xd5de000] no frame!
[h264 @ 0xd5de000] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0xd5de000] decode_slice_header error
[h264 @ 0xd5de000] no frame!
[h264 @ 0xd5de000] non-existing PPS 0 referenced
    Last message repeated 1 times
[h264 @ 0xd5de000] decode_slice_header error
[h264 @ 0xd5de000] no frame!
Input #0, rtsp, from 'rtsp://**.**.**.56:554/pag://**.**.**.50:7302:009422:0:MAIN:TCP?streamform=rtp':
  Metadata:
    title           : HIK Media Server V3.5.54
    comment         : HIK Media Server Session Description : standard
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Baseline), yuvj420p(pc, bt709, progressive), 1920x1080, 25 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp

But ffmpeg fails (click here for a verbose one):

[pairman@pairface ffmpeg-7.1]$ ./ffmpeg -i rtsp://**.**.**.56:554/pag://**.**.**.50:7302:009422:0:MAIN:TCP?streamform=rtp -rtsp_transport tcp -an -vframes 1 -f image2 -
ffmpeg version 7.1 Copyright (c) 2000-2024 the FFmpeg developers
  built with gcc 14 (GCC)
  configuration: --arch=x86_64 --target-os=linux --prefix=/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target --pkg-config-flags=--static --extra-cflags="-I/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/include -Os" --extra-cxxflags="-I/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/include -Os" --extra-ldflags="-L/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/target/lib -Wl,-s " --extra-libs="-lpthread -lm" --extra-ldexeflags=-static --bindir=/home/pairman/Downloads/bw/Xdcheckin-FFmpeg/bin --disable-manpages --disable-doc --disable-everything --disable-autodetect --enable-pic --enable-static --enable-gpl --enable-version3 --enable-libx264 --enable-demuxer=hls --enable-demuxer=rtsp --enable-demuxer=h264 --enable-decoder=h264 --enable-parser=h264 --enable-encoder=mjpeg --enable-muxer=image2 --enable-protocol=pipe --enable-protocol=tcp --enable-protocol=http --enable-decoder=aac --enable-parser=aac --enable-protocol=file --enable-protocol=udp --enable-protocol=rtmp
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.100 / 61. 19.100
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
[rtsp @ 0x32784e80] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, rtsp, from 'rtsp://**.**.**.56:554/pag://**.**.**.50:7302:009422:0:MAIN:TCP?streamform=rtp':
  Metadata:
    title           : HIK Media Server V3.5.54
    comment         : HIK Media Server Session Description : standard
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264, none, 90k tbr, 90k tbn
  Stream #0:1: Audio: aac, 48000 Hz, stereo, fltp
Output #0, image2, to 'pipe:':
[out#0/image2 @ 0x3280c280] Output file does not contain any stream
Error opening output file -.
Error opening output files: Invalid argument

Read more here: Source link