user1895639
user1895639

Reputation: 21

ffmpeg multiplexing 4 videos into 1 and drawtext problems

I have four videos that I would like to multiplex into 1 video and put text in the upper left of each quadrant. I can successfully mux the videos such that vid1 is in the upper left, vid2 is in the upper right, vid3 in the lower left, and vid4 in the lower right.

I cannot, however, get even simple text to show up with the drawtext command.

I would like to put the name of the original video file in each quadrant.

At the moment my command is this:

ffmpeg.exe -i "vid1.mp4" -i "vid2.mp4" -i "vid3.mp4" -i "vid4.mp4"  -filter_complex "[0:0]scale=iw/2:ih/2,pad=iw*2:ih*2[a];[1:0]scale=iw/2:ih/2[b];[2:0]scale=iw/2:ih/2[c];[3:0]scale=iw/2:ih/2[d];[a][b]overlay=w[x];[x][c]overlay=0:h[y];[y][d]overlay=w:h" -vf [0]drawtext=fontsize=12:fontcolor=white:fontfile="/Windows/Fonts/arial.ttf":text="vid1":x=35:y=35[out] "4UP_Video.mov"

If I remove the drawtext command I get the same result: nice 4-Up video but no text. My assumption is that for the other quadrants I would add another drawtext command with the input stream #, e.g.

[1]drawtext ...

Any help is appreciated!

Upvotes: 2

Views: 1586

Answers (1)

llogan
llogan

Reputation: 133833

Add the drawtext filters to your current filterchain instead of making a new one.

ffmpeg.exe -i vid1.mp4 -i vid2.mp4 -i vid3.mp4 -i vid4.mp4 -filter_complex "[0:0]scale=iw/2:ih/2,pad=iw*2:ih*2[a];[1:0]scale=iw/2:ih/2[b];[2:0]scale=iw/2:ih/2[c];[3:0]scale=iw/2:ih/2[d];[a][b]overlay=w[x];[x][c]overlay=0:h[y];[y][d]overlay=w:h,drawtext=fontsize=12:fontcolor=white:fontfile=/Windows/Fonts/arial.ttf:text='vid1':x=35:y=35,drawtext=fontsize=12:fontcolor=white:fontfile=/Windows/Fonts/arial.ttf:text='vid2':x=(w/2)+35:y=35,drawtext=fontsize=12:fontcolor=white:fontfile=/Windows/Fonts/arial.ttf:text='vid3':x=35:y=(h/2)+35,drawtext=fontsize=12:fontcolor=white:fontfile=/Windows/Fonts/arial.ttf:text='vid4':x=(w/2)+35:y=(h/2)+35" 4UP_Video.mov

Please ask future ffmpeg usage questions at superuser.com. Stack Overflow is limited to programming only.

Upvotes: 1

Related Questions