[FFmpeg-user] Error decoding RTSP stream using h264_cuvid vcodec

Nishant Trivedi nishant at paravision.ai
Tue Mar 9 23:46:41 EET 2021


Hello,

I am trying to decode a RTSP video stream using ffmpeg while using
h264_cuvid vcodec to take advantage of hardware acceleration on a machine
with NVIDIA GPU. I am seeing an error with the message Unknown encoder
'h264_cuvid'. I've made sure that I compiled ffmpeg with cuvid enabled.
Here is the output of "ffmpeg -version" command:
$ ffmpeg -version
ffmpeg version n4.1.6-5-g7f0db52c53 Copyright (c) 2000-2020 the FFmpeg
developers
built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
configuration: --enable-cuda-sdk --enable-cuvid --enable-nvenc
--enable-nonfree --enable-libnpp --enable-protocol=file
--enable-protocol=rtsp --enable-protocol=hls --enable-openssl
--extra-cflags=-I/usr/local/cuda/include
--extra-ldflags=-L/usr/local/cuda/lib64
libavutil      56. 22.100 / 56. 22.100
libavcodec     58. 35.100 / 58. 35.100
libavformat    58. 20.100 / 58. 20.100
libavdevice    58.  5.100 / 58.  5.100
libavfilter     7. 40.101 /  7. 40.101
libswscale      5.  3.100 /  5.  3.100
libswresample   3.  3.100 /  3.  3.100

To rule out problems with the stream, I checked it using ffplay and I'm
able to visualize it. But when I run the following command
ffmpeg -rtsp_transport tcp -hide_banner -loglevel debug -stimeout 1000000
-rtsp_flags prefer_tcp -allowed_media_types video -i
rtsp://<url>/onvif/profile1/media.smp -vsync 0 -err_detect explode
-surfaces 8 -vcodec h264_cuvid output.avi
I consistently get the encoder error. Removing the vcodec argument works
but I lose out on hardware acceleration. I'm attaching the full debug
output of the ffmpeg command herewith.

I dug around for possible resolutions but didn't find anything meaningful.
Appreciate any help on this.

Thanks,
- Nishant.
-------------- next part --------------
Splitting the commandline.
Reading option '-rtsp_transport' ... matched as AVOption 'rtsp_transport' with argument 'tcp'.
Reading option '-hide_banner' ... matched as option 'hide_banner' (do not show program banner) with argument '1'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Reading option '-stimeout' ... matched as AVOption 'stimeout' with argument '1000000'.
Reading option '-rtsp_flags' ... matched as AVOption 'rtsp_flags' with argument 'prefer_tcp'.
Reading option '-allowed_media_types' ... matched as AVOption 'allowed_media_types' with argument 'video'.
Reading option '-i' ... matched as input url with argument 'rtsp://<url>/onvif/profile1/media.smp'.
Reading option '-vsync' ... matched as option 'vsync' (video sync method) with argument '0'.
Reading option '-err_detect' ...Routing option err_detect to both codec and muxer layer
 matched as AVOption 'err_detect' with argument 'explode'.
Reading option '-surfaces' ... matched as AVOption 'surfaces' with argument '8'.
Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_cuvid'.
Reading option 'output.avi' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option hide_banner (do not show program banner) with argument 1.
Applying option loglevel (set logging level) with argument debug.
Applying option vsync (video sync method) with argument 0.
Successfully parsed a group of options.
Parsing a group of options: input url rtsp://<url>/onvif/profile1/media.smp.
Successfully parsed a group of options.
Opening an input file: rtsp://<url>/onvif/profile1/media.smp.
[tcp @ 0x55951d8790c0] No default whitelist set
[tcp @ 0x55951d8790c0] Original list of addresses:
[tcp @ 0x55951d8790c0] Address <add> port <port>
[tcp @ 0x55951d8790c0] Interleaved list of addresses:
[tcp @ 0x55951d8790c0] Address <add> port <port>
[tcp @ 0x55951d8790c0] Starting connection attempt to <add> port <port>
[tcp @ 0x55951d8790c0] Successfully connected to <add> port <port>
[rtsp @ 0x55951d876a80] SDP:
v=0
o=- 0 0 IN IP4 <IP>
s=Media Presentation
i=samsung
c=IN IP4 0.0.0.0
b=AS:6216
t=0 0
a=control:rtsp://<url>/onvif/profile1/media.smp
a=range:npt=now-
m=video 45032 RTP/AVP 26
b=AS:6144
a=rtpmap:26 JPEG/90000
a=control:rtsp://<url>/onvif/profile1/media.smp/trackID=v
a=cliprect:0,0,1080,1920
a=framesize:26 1920-1080
a=framerate:2.0
m=application 45036 RTP/AVP 107
b=AS:8
a=rtpmap:107 vnd.onvif.metadata/90000
a=control:rtsp://<url>/onvif/profile1/media.smp/trackID=m
a=recvonly

[rtsp @ 0x55951d876a80] video codec set to: mjpeg
[rtsp @ 0x55951d876a80] setting jitter buffer size to 0
[rtsp @ 0x55951d876a80] hello state=0
[mjpeg @ 0x55951d87c000] marker=d8 avail_size_in_buf=137286
[mjpeg @ 0x55951d87c000] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x55951d87c000] marker=e0 avail_size_in_buf=137284
[mjpeg @ 0x55951d87c000] marker parser used 16 bytes (128 bits)
[mjpeg @ 0x55951d87c000] marker=db avail_size_in_buf=137266
[mjpeg @ 0x55951d87c000] index=0
[mjpeg @ 0x55951d87c000] qscale[0]: 4
[mjpeg @ 0x55951d87c000] index=1
[mjpeg @ 0x55951d87c000] qscale[1]: 9
[mjpeg @ 0x55951d87c000] marker parser used 132 bytes (1056 bits)
[mjpeg @ 0x55951d87c000] marker=c4 avail_size_in_buf=137132
[mjpeg @ 0x55951d87c000] marker parser used 0 bytes (0 bits)
[mjpeg @ 0x55951d87c000] marker=c0 avail_size_in_buf=136712
[mjpeg @ 0x55951d87c000] Changing bps from 0 to 8
[mjpeg @ 0x55951d87c000] sof0: picture: 1920x1080
[mjpeg @ 0x55951d87c000] component 0 2:2 id: 0 quant:0
[mjpeg @ 0x55951d87c000] component 1 1:1 id: 1 quant:1
[mjpeg @ 0x55951d87c000] component 2 1:1 id: 2 quant:1
[mjpeg @ 0x55951d87c000] pix fmt id 22111100
[mjpeg @ 0x55951d87c000] Format yuvj420p chosen by get_format().
[mjpeg @ 0x55951d87c000] marker parser used 17 bytes (136 bits)
[mjpeg @ 0x55951d87c000] escaping removed 854 bytes
[mjpeg @ 0x55951d87c000] marker=da avail_size_in_buf=136693
[mjpeg @ 0x55951d87c000] marker parser used 135839 bytes (1086712 bits)
[mjpeg @ 0x55951d87c000] marker=d9 avail_size_in_buf=2
[mjpeg @ 0x55951d87c000] decode frame unused 2 bytes
[rtsp @ 0x55951d876a80] Probe buffer size limit of 5000000 bytes reached
[rtsp @ 0x55951d876a80] Setting avg frame rate based on r frame rate
Input #0, rtsp, from 'rtsp://<url>/onvif/profile1/media.smp':
  Metadata:
    title           : Media Presentation
    comment         : samsung
  Duration: N/A, start: 0.436000, bitrate: N/A
    Stream #0:0, 17, 1/90000: Video: mjpeg, 1 reference frame, yuvj420p(pc, bt470bg/unknown/unknown, center), 1920x1080 [SAR 1:1 DAR 16:9], 0/1, 2 fps, 2 tbr, 90k tbn, 90k tbc
Successfully opened the file.
Parsing a group of options: output url output.avi.
Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_cuvid.
Successfully parsed a group of options.
Opening an output file: output.avi.
Unknown encoder 'h264_cuvid'


More information about the ffmpeg-user mailing list