Helo
Helo

Reputation: 1064

ffmpeg overlay on multiple outputs

I'm using ffmpeg 3.4.1 to transcode a highres video file into several lower resolutions with a logo in the corner:

ffmpeg -i "test.mxf" -i "logo.png" ^
-filter_complex "[0:v][1:v] overlay" ^
-s 640x480 -c:v libx264 -b:v 1000K -c:a aac -b:a 96k "test.640x480K.1000K.logo.mp4" ^
-s 1280x720 -c:v libx264 -b:v 2200K -c:a aac -b:a 192k "test.1280x720K.2200K.logo.mp4"

But this way there is only a logo in the first output file.

I have tried using map, this gives me logos in both output files but then the sound disappears:

ffmpeg -i "test.mxf" -i "logo.png" ^
-filter_complex "[0:v][1:v] overlay [output1]; [0:v][1:v] overlay [output2]" ^
-map [output1] -s 640x480 -c:v libx264 -b:v 1000K -c:a aac -b:a 96k "test.640x480K.1000K.logo.mp4" ^
-map [output2] -s 1280x720 -c:v libx264 -b:v 2200K -c:a aac -b:a 192k "test.1280x720K.2200K.logo.mp4"

What am I doing wrong?

I would like to do 5 outputs in one go to avoid running ffmpeg 5 times in succession. It ought to be more efficient/faster to do it in one go.

Upvotes: 2

Views: 817

Answers (1)

Gyan
Gyan

Reputation: 93339

Use

ffmpeg -i "test.mxf" -i "logo.png" ^
-filter_complex "[0:v][1:v] overlay,split=2[a][b]" ^
-map [a] -map 0:a -s 640x480 -c:v libx264 -b:v 1000K -c:a aac -b:a 96k "test.640x480K.1000K.logo.mp4" ^
-map [b] -map 0:a -s 1280x720 -c:v libx264 -b:v 2200K -c:a aac -b:a 192k "test.1280x720K.2200K.logo.mp4"

Upvotes: 2

Related Questions