This command, make videos to be padded first and then scale them afterwards. However, i want exactly the opposite, first to scale them and then to pad them. How I can do that?
rm a_*.mp4; for vids in *.mp4; do ffmpeg -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i "$vids" -ss 0:00:00 -to 00:00:03 -vf "format=nv12, pad=1080:1920:ow/2:oh/2:color=red, hwupload, scale_vaapi=w=1920:h=1080:format=nv12" -c:v hevc_vaapi -video_track_timescale 90000 -rc_mode CQP -global_quality 20 -an "a_${vids/.*}.mp4"; done;
The error message is that:
Impossible to convert between the formats supported by the filter 'Parsed_scale_vaapi_2' and the filter 'auto_scale_1'
I tried this too but failed:
rm a_*.mp4; for vids in *.mp4; do ffmpeg -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i "$vids" -ss 0:00:00 -to 00:00:03 -vf "hwupload, scale_vaapi=w=1920:h=1080:format=nv12, hwdownload, pad=1080:1920:ow/2:oh/2:color=red" -c:v hevc_vaapi -video_track_timescale 90000 -rc_mode CQP -global_quality 20 -an "a_${vids/.*}.mp4"; done;
UPDATE
I succeded with scale but not with scale_vaapi:
rm a_*.mp4; for vids in *.mp4; do ffmpeg -hwaccel vaapi -hwaccel_output_format yuv420p -vaapi_device /dev/dri/renderD128 -i "$vids" -ss 0:00:00 -to 00:00:03 -vf "format=nv12, scale=height=1920:width=1080, pad=height=1920:width=1080:color=red,hwupload" -c:v hevc_vaapi -video_track_timescale 90000 -rc_mode CQP -global_quality 20 -an "a_${vids/.*}.mp4"; done;
ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -vaapi_device /dev/dri/renderD128 -i input.mp4 -ss 0:00:00 -to 00:00:03 -vf "scale_vaapi=w=1920:h=1080:format=nv12,hwdownload, pad=2048:1080:ow/2:oh/2:color=red,hwupload" -c:v hevc_vaapi -video_track_timescale 90000 -rc_mode CQP -global_quality 20 -an output.mp4
. Try with the following input:ffmpeg -y -f lavfi -i testsrc=size=384x216:rate=1:duration=10 -pix_fmt yuv420p input.mp4
. I can't test it because I am not running linux.Impossible to convert between the formats supported by the filter 'transpose' and the filter 'auto_scale_0'
input.mp4
that was created withffmpeg -y -f lavfi -i testsrc=size=384x216:rate=1:duration=10 -pix_fmt yuv420p input.mp4
? I can't test it...transpose
filter for example, is added automatically because the rotation metadata is not zero. Possible solution is adding-noautorotate
and copy the rotation metadata (we may also usetranspose_vaapi
, if we know that we have to rotate). We don't have your MP4 files, so we can't reproduce the issues. Without any information about the input files, I find your question to be too general.