shoku
shoku

Reputation: 33

Correct syntax for ffmpeg filter combination?

I'm playing with ffmpeg to generate a pretty video out of an mp3 + jpg.

I've managed to generate a video that takes a jpg as a background, and adds a waveform complex filter on top of it (and removes the black bg as an overlay).

This works: ffmpeg -y -i 1.mp3 -loop 1 -i 1.jpg -filter_complex "[0:a]showwaves=s=1280x720:mode=cline,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4

I've been trying to add text somewhere in the generated video too. I'm trying the drawtext filter. I can't get this to work however, so it seems I don't understand the syntax, or how to combine filters.

This doesn't work: ffmpeg -y -i 1.mp3 -loop 1 -i 1.jpg -filter_complex "[0:a]showwaves=s=1280x720:mode=line,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay[outv]" -filter_complex "[v]drawtext=text='My custom text test':[email protected]: fontsize=30:font=Arvo:x=(w-text_w)/5:y=(h-text_h)/5[out]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4

Would love some pointers!

Upvotes: 2

Views: 1319

Answers (1)

Gyan
Gyan

Reputation: 92948

Filteres operating in series should be chained together

ffmpeg -y -i 1.mp3 -loop 1 -i 1.jpg \
 -filter_complex "[0:a]showwaves=s=1280x720:mode=line,colorkey=0x000000:0.01:0.1,
                       format=yuva420p[v];
                  [1:v][v]overlay,
                          drawtext=text='My custom text test':[email protected]:
                          fontsize=30:font=Arvo:x=(w-text_w)/5:y=(h-text_h)/5[outv]"
 -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4

(You applied the drawtext onto the output of showwaves; it can be directly applied on the overlay output)

Upvotes: 2

Related Questions