user2108258
user2108258

Reputation: 843

Add audio visualization overlay to video with FFMpeg

Wondering if its possible to add audio visualization to a video. I've found some filters from this site https://lukaprincic.si/development-log/ffmpeg-audio-visualization-tricks Most examples seem to be with an image and audio file and not a video file.

I've tried the following but it just yields a video with audio but no visualization.

ffmpeg -stream_loop -1 -i cassette-edit.mp4 -i test-audio.mp3 -filter_complex "[1:a]showwaves=s=1920x1080:mode=line:colors=white:draw=full,format=rgba[out]" -shortest -map "[out]" -map 0:v -map 1:a 'Cassette Dreams - w visualizer.mp4' -y

Upvotes: 0

Views: 1402

Answers (1)

kesh
kesh

Reputation: 5463

Try

ffmpeg -stream_loop -1 -i cassette-edit.mp4 -i test-audio.mp3 -filter_complex "
    [1:a]showwaves=s=1920x1080:mode=line:colors=white:draw=full[vwave];
    [0:v][vwave]overlay=format=auto[out]
  " -shortest -map "[out]" -map 1:a 'Cassette Dreams - w visualizer.mp4' -y

(as a one-liner, removing all extraneous whitespaces)

[edit] no need for colorkey as showwave appears to output transparent background. Also try format=auto option on overlay.

Reference: ffmpeg wiki

Upvotes: 1

Related Questions