[FFmpeg-user] Error: Impossible to convert between the formats...(Nvidia codecs)
Dennis Mungai
dmngaie at gmail.com
Sat Jul 9 14:10:59 EEST 2022
On Sat, 9 Jul 2022 at 14:01, Ben Parham <behfarteam at gmail.com> wrote:
> Thank you, Dennis. By removing _pix_fmt the issue was solved.
> But when I change the preset from p2 to p3 or p4, I face this error:
>
> [hevc @ 000001ebb41bdc40] hardware accelerator failed to decode picture
> [hevc @ 000001ebb41bb440] Could not find ref with POC 24
> [rtsp @ 000001ebb42500c0] Invalid DTS: 126000 PTS: 118800 in output stream
> 0:0, replacing by guess
> Error while decoding stream #0:0: Generic error in an external library
> [hevc @ 000001ebb41bbc40] No decoder surfaces left
> [hevc @ 000001ebb41bbc40]
> decoder->cvdl->cuvidDecodePicture(decoder->decoder, &ctx->pic_params)
> failed -> CUDA_ERROR_INVALID_VALUE: invalid argument
>
> Could you help me to fix this error please?
>
Sure, I can.
By design, ffmpeg's NVDEC implementation is required to allocate surfaces
to handle bitstreams with advanced features such as B-frames, interlaced
content, etc.
However, the pre-allocated surfaces may not be enough in some cases, and
that can be fixed by setting the -extra_hw_frames {n} option, with n > 2.
See this ticket for more details: https://trac.ffmpeg.org/ticket/7562
Try this out:
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda
-extra_hw_frames 3
rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags
+low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2
-pix_fmt yuv420p -tune hq -rc vbr -vb 700k -maxrate 800k -minrate
200k -bufsize 800k -g 25 -acodec copy -strict -2 -flags +global_header
-f rtsp "rtsp://localhost:8000/stream"
And report back.
More information about the ffmpeg-user
mailing list