[FFmpeg-user] FFMPEG cuda hwaccell error

Dennis Mungai dmngaie at gmail.com
Tue Jun 18 01:36:45 EEST 2019


On Tue, 18 Jun 2019 at 01:20, Nishant Trivedi <nishant at ever.ai> wrote:

> Hello,
>
> I'm trying to decode a video stream for one of my projects using the
> following command:
>
> *ffmpeg -hide_banner -hwaccel cuda -nostats -i
> rtmp://<ip>:<port>/myapp/mystream -filter_complex [0]fps=fps=1[s0] -map
> [s0] -f rawvideo -pix_fmt rgb24 pipe:*
>
> I'm getting the following error:
>
> *[h264 @ 0x55e36ef5ca00] Error creating a NVDEC decoder: 1*
> *[h264 @ 0x55e36ef5ca00] Using more than 32 (37) decode surfaces might
> cause nvdec to fail.*
> *[h264 @ 0x55e36ef5ca00] Try lowering the amount of threads. Using 16 right
> now.*
> *[h264 @ 0x55e36ef5ca00] Failed setup for format cuda: hwaccel
> initialisation returned error.*
>
> I traced this error down to this
> <https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvdec.c#L339>
> line
> so clearly there's something wrong with my setup but being a newbie in
> FFMPEG I don't know what it is. I'd very much appreciate if someone can
> help me out with this issue. Full log output follows:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *Input #0, flv, from 'rrtmp://<ip>:<port>/myapp/mystream:  Metadata:
> major_brand     : qt    minor_version   : 512    compatible_brands: qt
> encoder         : Lavf58.20.100    server          :
> SRS/2.0.263(ZhouGuowen)    srs_primary     : SRS/2.0release    srs_authors
>     : winlin,wenjie.zhao    server_version  : 2.0.263  Duration: N/A,
> start: 0.010000, bitrate: 2791 kb/s    Stream #0:0: Video: h264 (High),
> yuv420p(progressive), 1920x1080, 2791 kb/s, 30 fps, 29.97 tbr, 1k tbnStream
> mapping:  Stream #0:0 (h264) -> fps  fps -> Stream #0:0 (rawvideo)Press [q]
> to stop, [?] for help[h264 @ 0x55e36ef5ca00] Error creating a NVDEC
> decoder: 1[h264 @ 0x55e36ef5ca00] Using more than 32 (37) decode surfaces
> might cause nvdec to fail.[h264 @ 0x55e36ef5ca00] Try lowering the amount
> of threads. Using 16 right now.[h264 @ 0x55e36ef5ca00] Failed setup for
> format cuda: hwaccel initialisation returned error.Output #0, rawvideo, to
> 'pipe:':  Metadata:    major_brand     : qt    minor_version   : 512
> compatible_brands: qt    server_version  : 2.0.263    server          :
> SRS/2.0.263(ZhouGuowen)    srs_primary     : SRS/2.0release    srs_authors
>     : winlin,wenjie.zhao    encoder         : Lavf58.20.100    Stream #0:0:
> Video: rawvideo (RGB[24] / 0x18424752), rgb24, 1920x1080, q=2-31, 49766
> kb/s, 1 fps, 1 tbn, 1 tbc    Metadata:      encoder         : Lavc58.35.100
> rawvideo*
>
> Best,
> --
> Nishant.
>
>
Hello there,

Note that cuda hwaccel is an alias to the newer nvdec implementation, and
to my knowledge, has no way of setting up decoder surface limits.

Here's a workaround you can try:

*ffmpeg -threads 4 -hide_banner -c:v h264_cuvid -surfaces 8 -nostats -i
rtmp://<ip>:<port>/myapp/mystream -filter_complex [0]fps=fps=1[s0] -map
[s0] -f rawvideo -pix_fmt rgb24 pipe:*

Two changes:

1. Call up the h264_cuvid decoder directly, and apply a surface limit count
of 8. This should be adequate.
2. Limit the thread count.


More information about the ffmpeg-user mailing list