How to extract a video frame using NVIDIA card I want to extract a frame from the h264 video stream using NVIDIA card. 
First of all we need to decode this stream via h264_cuvid decoder: 


  ffmpeg -hwaccel cuvid -c:v h264_cuvid -i ...


As I understand currently we can't extract a video frame using only NVIDIA card in FFmpeg as this functional doesn't exist, like doesn't exist a codec like mjpeg_nvenc or something else. Please correct me if I wrong. 

I think we should be able to decode a video stream on the NVIDIA card then extract a frame via CPU codec, for example, mjpeg:


  ffmpeg -hwaccel cuvid -c:v h264_cuvid -i video_source -vcodec mjpeg
  -vframes 1 /tmp/frame.jpg


In this case we will get the following error:


  Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'  
  Error reinitializing
  filters!  Failed to inject frame into filter network: Function not
  implemented


NVIDIA decode video to NV12(by default) or NV21 pixel format and it's not appropriate format for the mjpeg codec. Please also correct me if I wrong. 
Let's try to change the output resolution and convert the pixel format via scale_npp to yuvj420p as mjpeg codes support it:


  ffmpeg -hwaccel cuvid -c:v h264_cuvid -i video_source -vcodec mjpeg
  -vf "hwupload_cuda,scale_npp=w=1024:h=70:format=nv12:interp_algo=lanczos,hwdownload,format=yuvj420p" -vframes 1 /tmp/frame.jpg


I got the same error:


  Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scaler_0'  
  Error reinitializing
  filters!  Failed to inject frame into filter network: Function not
  implemented


According the FFmpeg documentation format conversation isn't supported: "Note that automatic format negotiation and conversion is not yet supported for hardware frames"

How to decode an input h264 stream via h264_cuvid decoder then convert the decoded video pixel format to yuvj420p and extract a frame via mjpeg codec?  Or please share your thoughts how to extract a frame from a video stream with decoding or decoding and encoding on NVIDIA card to any picture format.
Since the video bitstream is being decoded on the GPU, CUDA upload isn't required.

Command with format conversion is

ffmpeg -hwaccel cuvid -c:v h264_cuvid -resize 1024x70 -i video_source \
       -vf "scale_npp=format=yuv420p,hwdownload,format=yuv420p" \
       -pix_fmt yuvj420p -color_range 2 -vframes 1 -y /tmp/frame.jpg