Skip to content

Instantly share code, notes, and snippets.

@joachimesque
Created October 26, 2018 20:43
Show Gist options
  • Save joachimesque/82894eded981bce8c3db5c0e29a69987 to your computer and use it in GitHub Desktop.
Save joachimesque/82894eded981bce8c3db5c0e29a69987 to your computer and use it in GitHub Desktop.
get ffmpeg to generate an animation of the frequencies of an audio file on top of a static image, useful for podcasts and such
ffmpeg -i test.wav -y -loop 1 -i bg.jpg -filter_complex \
"[0:a]showfreqs=cmode=separate:mode=bar:ascale=cbrt:fscale=log:s=600x600:colors=#ffffff[tmp]; \
[tmp]alphaextract,format=yuv420p,split=3[box][up][down]; \
[up]crop=in_w:in_h/2:0:0[up]; \
[down]crop=in_w:in_h/2:0:in_h/2,vflip[down];[up][down]vstack[tmp]; \
[tmp]gblur=sigma=10,curves=master='0/0 0.49/0 0.51/1 1/1',format=rgba[tmp]; \
[box]drawbox=w=600:h=600:c=#ffffff:t=fill:replace=1,format=rgba[box]; \
[box][tmp]alphamerge[tmp]; \
[tmp]crop=in_w:in_h/2:0:in_h/4[tmp]; \
[1:v]scale=1280:-1,crop=in_w:720[bg]; \
[bg][tmp]overlay=x=50:y=50:shortest=1:format=auto,format=yuv420p[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast test.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment