[FFmpeg-user] Impossible to convert between the formats - but why?

James Girotti james.girotti at gmail.com
Mon Jan 22 21:33:26 EET 2018

> Is there a way I could get more insights on what particularly trigger this
> message?

You could increase your loglevel, that will give you some hints as to
what's happening. Try "-loglevel 48", which is debug level so there will be
a lot of output.

You don't really need to do that though. I can tell you what's wrong. Using
"-hwaccel cuvid" is only necessary when doing full hardware transcoding as
it causes your frames to be in GPU memory only. With partial hardware
transcoding, you would have to use the filter "hwdownload" to get them from
then from GPU->CPU memory. It's more complex than that, but that's where
I'll leave it. TLDR: for this case not using "-hwaccel cuvid" is sufficient
and likely easier.

You have two options:

remove "-hwaccel cuvid" from your commandline or

add '-vf hwdownload,format=nv12,format=yuvj420p" (You could choose a
different final format if you like, but you have to use nv12 first.)

So it would be something like:

1. ffmpeg -c:v h264_cuvid -i foo -c:v mjpeg bar.mjpeg

2. ffmpeg -hwaccel cuvid -c:v h264_cuvid -i foo -c:v mjpeg -vf
"hwdownload,format=nv12,format=yuvj420p" bar.mjpeg

Hope that helps.

More information about the ffmpeg-user mailing list