nomaam
nomaam

Reputation: 1263

Combine filters for watermark and video speed using FFmpeg

I am using FFmpeg to speed up a video and add a watermark. The watermark is a percentage of the video size.

To speed up I am using

ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

And to add a watermark, I am using

ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[video][logo]overlay=5:H-h-5" -c:a copy output.mp4

Both work well on their own. I am trying to combine them into a single command. There are many questions/answers regarding similar problems that I could find, however they seem to either be outdated or I just can't get them to work.

To combine filters I have read to just add a comma, but that doesn't seem to work:

ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[video][logo]overlay=5:H-h-5,[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

The command will run without errors, and add the watermark, but the audio/video filter is not being applied.

How can I do it?

Upvotes: 0

Views: 299

Answers (1)

llogan
llogan

Reputation: 134073

Combined command:

ffmpeg -i input.mp4 -i watermark.png -filter_complex "[1][0]scale2ref=w=oh*mdar:h=ih*0.1[logo][video];[video][logo]overlay=5:H-h-5,setpts=0.5*PTS;[0:a]atempo=2.0" output.mp4

Connect linear filters with a comma. Connect filterchains with a semicolon. See FFmpeg Filtering Intro.

Upvotes: 1

Related Questions