[FFmpeg-user] Error: Impossible to convert between the formats...(Nvidia codecs)

Dennis Mungai dmngaie at gmail.com
Sat Jul 9 13:11:10 EEST 2022


On Sat, 9 Jul 2022 at 12:45, DEF <shaker.doc at gmail.com> wrote:

> On Sat, 9 Jul 2022 at 08:25, Ben Parham <behfarteam at gmail.com> wrote:
> >
> > Hello,
> >
> > I try to use Nvidia codecs in live transcoding. The input stream is from
> an
> > IP camera (Hikvision) and its color format is "*yuvj420p*". My command
> is:
> >
> > ffmpeg.exe -y -hwaccel cuda -hwaccel_output_format cuda -rtsp_transport
> tcp
> > -i "rtsp://admin:Pass1@192.168.1.1" -flags +low_delay -vcodec hevc_nvenc
> > -s 1920x1080 -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"
>
> Check out documenation at
>
> https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/
>
> Use -vsync 0 option with decode to prevent FFmpeg from creating output
> YUV with duplicate and extra frames.
> This seems to be the commonest runtime issue.
>
> Try
> ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda
> 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"
>
>
> Def
>

The error may have to do with the specified pixel format filter in the
command line, specifically  " -pix_fmt yuv420p".
Remove that and retest with a command such as this one:

ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda
rtsp_transport tcp -i "rtsp://admin:Pass1@192.168.1.1" -flags
+low_delay -vcodec hevc_nvenc -vf scale_cuda=1920:1080 -preset p2
-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"

With CUDA/NVDEC hwaccel, the default pixel format will be CUDA. Inserting a
request for another format via "-pix_fmt yuv420p" as is would fail, as it
introduces the need for hwdownload and format conversion which isn't
automatic.
Please retest and report back.


More information about the ffmpeg-user mailing list