Choose your pipe
Untested example:
ffmpeg -i audio.foo -ac 1 -f wav - | wav2png -o audio.png /dev/stdin
Alternatively you could use the UNIX pipe access protocol.
ffmpeg -i audio.foo -ac 1 -f wav pipe: | wav2png -o audio.png /dev/stdin
Notes
-ac 1
was added to downmix to mono since currently with wav2png
the max of all channels is used, but this option may be superfluous.
You can use any type of input that contains audio and that ffmpeg
can decode.
If you just want to output a specific channel use the -map_channel
option (example).
Simply using -
instead of /dev/stdin
may work, but I didn't get to try.
Visualizing audio
If you would like to create a video of the waveform use the showwaves filter.
ffmpeg -i audio.foo -filter_complex \
"[0:a]showwaves=mode=line,format=yuv420p[v]" \
-map "[v]" -map 0:a -c:a copy output.mp4
Or use a combination of filters:
ffmpeg -i input.mp3 -filter_complex \
"[0:a]avectorscope=s=640x518,pad=1280:720[vs]; \
[0:a]showspectrum=mode=separate:color=intensity:scale=cbrt:s=640x518[ss]; \
[0:a]showwaves=s=1280x202:mode=line[sw]; \
[vs][ss]overlay=w[bg]; \
[bg][sw]overlay=0:H-h,drawtext=fontfile=/usr/share/fonts/TTF/Vera.ttf:fontcolor=white:x=10:y=10:text='\"Song Title\" by Artist'[out]" \
-map "[out]" -map 0:a -c:v libx264 -preset fast -crf 18 -c:a copy output.mkv
From How to Encode Videos for YouTube and other Video Sharing Sites.