Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

avectorscope

ffmpeg -i input.mp3 -filter_complex "[0:a]avectorscope=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a avectorscope.mp4

showcqt

ffmpeg -i input.mp3 -filter_complex "[0:a]showcqt=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showcqt.mp4

ahistogram

ffmpeg -i input.mp3 -filter_complex "[0:a]ahistogram=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a ahistogram.mp4

aphasemeter

ffmpeg -i input.mp3 -filter_complex "[0:a]aphasemeter=s=1920x1080:mpc=cyan,format=yuv420p[v]" -map "[v]" -map 0:a aphasemeter.mp4

showfreqs

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

showspectrum

ffmpeg -i input.mp3 -filter_complex "[0:a]showspectrum=s=1920x1080,format=yuv420p[v]" -map "[v]" -map 0:a showspectrum.mp4

showwaves

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

showvolume

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
@silvansky

This comment has been minimized.

Copy link

silvansky commented Mar 20, 2018

aphasemeter example does not work.

[Parsed_aphasemeter_0 @ 0x7f8285c00a60] Media type mismatch between the 'Parsed_aphasemeter_0' filter output pad 0 (audio) and the 'Parsed_format_1' filter input pad 0 (video)
[AVFilterGraph @ 0x7f8285c00900] Cannot create the link aphasemeter:0 -> format:0`
@xenomancer

This comment has been minimized.

Copy link

xenomancer commented Jul 2, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.