The following ffmpeg command decodes a h265 rtsp video stream in hardware using qsv, lowers resolution from 4k to 1080p, fps from 20 to 5 and tries to save the video as rawvideo using the pix_fmt yuv420p.
ffmpeg -hide_banner -loglevel warning -hwaccel qsv -c:v hevc_qsv -use_wallclock_as_timestamps 1 -fflags nobuffer -rtsp_transport tcp -stimeout 5000000 -i rtsp://admin:secret@10.20.1.14:554 -vf fps=fps=5,vpp_qsv=w=1280:h=720 -c:v h264_qsv -g 25 -profile:v main -b:v 1M -an -f rawvideo -pix_fmt yuv420p test_output.yuv
The problem is that the hardware decoder uses nv12 as it's internal format, which results in the warning:
Incompatible pixel format 'yuv420p' for codec 'h264_qsv', auto-selecting format 'nv12'
The intention here is to pass the raw video on to another process which will do object detection and only supports yuv420p. I tried using vaapi instead of qsv but this gave me the same problem. How can I convert the pix_format using ffmpeg?