How to use -filter_complex and -vf together in ffmpeg?

Viewed 734

I want to use -filter_complex and -vf together in one line but I can't do that and get error.

First code:

ffmpeg -i 1.mp4 -filter_complex "[0:v]setpts=0.87*PTS[v];[0:a]atempo=1.15[a]" -map "[v]" -map "[a]" e1.mp4

Second code:

ffmpeg -i 1.mp4 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" e1.mp4

So I combine two code above together. Combined code:

ffmpeg -i 1.mp4 -filter_complex "[0:v]setpts=0.87*PTS[v];[0:a]atempo=1.15[a]" -map "[v]" -map "[a]" -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black" e1.mp4

I can can't run code I get the error:

-vf/-af/-filter and -filter_complex cannot be used together for the same stream.
1 Answers

Just use -filter_complex:

ffmpeg -i input.mp4 -filter_complex "[0:v]scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:color=black,setpts=0.87*PTS;[0:a]atempo=1.15" output.mp4

See FFmpeg Filtering Introduction and the additional documentation in the link.

Related