0

There is a padding (default black) under the audio visualiser in the script below ,how could one change the color of this padding ? enter image description hereI tried adding option "overlay :colors= Blue" but received an error= "Option 'colors' not found"

fmpeg -y -i music.mp3 -loop 1 -i whiteImage.jpg -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p,format=yuv420p[v];[1:v][v]overlay=0:200[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output_bg.mp4

1 Answer 1

1

Use

ffmpeg -y -i music.mp3 -loop 1 -i image -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p,format=yuva420p,split=2[w][b];[b]format=yuv420p,drawbox=c=blue:t=fill[b];[b][w]overlay[wv];[1:v][wv]overlay=0:200:shortest=1[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy output_bg.mp4

The showwaves will make the background transparent if the filter can output to a frame format with alpha. yuv420p does not have alpha, so the value of the format filter should be changed to a format that does, like yuva420p. Then this picture is cloned; one copy is made opaque and has a color drawn on it. The other copy with the transparent BG is overlaid on top. Finally, this result is overlaid on the image.

It's better to limit the video stream within the overlay filter, if possible. So, -shortest removed.

1
  • thanks for the script but running it, gives the following error :-Stream specifier 'v' in filtergraph description [0:a]showwaves=s=1280x175:colors=Red:mode=p2p,format=yuva420p,split=2[w][b];[b]format=yuv420p,drawbox=c=blue:t=fill[b];[b][v]overlay[wv];[1:v][wv]overlay=0:200:shortest=1[outv] matches no streams.
    – srt111
    Mar 4, 2019 at 14:31

Your Answer

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

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