Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 28 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save CannonballSkippy/4455e9bed74241bfbd640a8083fd38b3 to your computer and use it in GitHub Desktop.
Save CannonballSkippy/4455e9bed74241bfbd640a8083fd38b3 to your computer and use it in GitHub Desktop.
A list of examples on how you can use filters to make visual representations of audio using ffmpeg

Convert audio to video with ffmpeg - examples

ffmpeg -i input.mp3 -filter_complex "[0:a]avectorscope=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a avectorscope.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showcqt=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showcqt.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]ahistogram=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a ahistogram.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]aphasemeter=s=1920x1080:mpc=cyan,format=yuv420p[v]" -map "[v]" -map 0:a aphasemeter.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showfreqs=s=1920x1080:mode=line:fscale=log,format=yuv420p[v]" -map "[v]" -map 0:a showfreqs.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showspectrum=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showspectrum.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showwaves=s=1920x1080:mode=line:rate=25,format=yuv420p[v]" -map "[v]" -map 0:a showwaves.mp4
ffmpeg -i input.mp3 -filter_complex "[0:a]showvolume=f=0.5:c=VOLUME:b=4:w=1920:h=900,format=yuv420p[v]" -map "[v]" -map 0:a showvolume.mp4
@xenomancer
Copy link

It appears that sometime between the ffmpeg-20161130-4e6d1c1-win64-static and ffmpeg-20180630-9f0077c-win64-static builds the complex filter parser changed such that the output from aphasemeter is considered to be audio. I tried forcing video output, but it still does not recognize it. When I just send the output to an mp4 it will output the video, but the complex filter parser will not allow it if you are attempting to forward the media stream to another filter. Hopefully this will be addressed in another build.

@rohitsanj
Copy link

What does [0:a] do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment