I have an mp3 song that I am making a video for, I also have a background image.

My command that doesn't work.

ffmpeg -i song.mp3 -i image.jpg -filter_complex \  "[0:a]showwaves=s=3840x200:mode=line[sw];" \
-map "[out]" -map 0:a video.mp4

I'm trying to read the documentation and understand how to just put the image as a background, overlay the Soundwaves on the Image and keep the audio. Can someone help me understand how to do this?

  • Added bonus would be showwaves customization with color and histogram
    – devssh
    Apr 29, 2020 at 3:37
  • Could you please try this: ffmpeg -loop 1 -i image.jpg -i song.mp3 -c:v libx264 -tune stillimage -c:a aac -b:a 192k -pix_fmt yuv420p -shortest video.mp4
    – geoai777
    Apr 29, 2020 at 14:57

1 Answer 1


Use the overlay filter to put the showwaves on top of image.jpg:

ffmpeg -i song.mp3 -i image.jpg -filter_complex "[0:a]showwaves=s=3840x200:mode=line:colors=red|yellow[sw];[1][sw]overlay=(W-w)/2:(H-h)/2:format=auto,format=yuv420p[v]" -map "[v]" -map 0:a -movflags +faststart video.mp4
  • Adjust showwaves colors with the colors option. Each channel will have its own color, so in this example, if song.mp3 is stereo, the left channel is red and the right channel is yellow.

  • If you just want a single waveform of all channels add the aformat filter before showwaves, as in aformat=channel_layouts=mono,showwaves=s=3840x200:mode=line:colors=00ff00.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.