<p>The following command shows a video with a waveform of the corresponding audio:</p>

<pre><code>ffmpeg -i input.mp4 -filter_complex "[0:a]showwaves=s=1280x720,format=yuv420p[vid]" -map "[vid]" -map 0:a -codec:v libx264 -crf 18 -preset fast -codec:a aac -strict -2 -b:a 192k output.mp4
</code></pre>

<p>I replaced avectorscope with showwaves: avectorscope is for showing the difference between stereo pairs.
Try showcqt,showfreqs,showspectrum for other visualization effects.</p>

CC BY-SA 3.0
2016-01-14T21:43:52.853Z
Thanks a lot. Do you know any way to change the background from black to a custom color?
Arete
CC BY-SA 3.0
2016-01-14T23:52:13.027Z
@Arete For what effect, specifically? Some, or at least showfreqs, already have alpha and you just need to overlay it over a color source. Otherwise you could try format filter and colorkey or chromakey filters.
llogan
CC BY-SA 3.0
2016-01-14T21:29:11.613Z
2016-01-14T21:29:11.613Z
Thingy
<p>I would like to "convert" audio to video visualisation (oscilloscope or waveform) sort of like some media players have. </p>

<p>I read this thread on how to do so with ffmpeg: <a href="https://video.stackexchange.com/q/9644">How do I turn audio into video (that is, show the waveforms in a video)?</a></p>

<p>I have never used ffmpeg before and having read the previous thread I am still very confused with how to do it. As far as I know, ffmpeg does not have a GUI, so its a bit hard to understand. </p>

<p>I tried the following code:</p>

<pre><code>ffmpeg -i audio.mp3 -filter_complex "[0:a]avectorscope=s=1080x1080,format=yuv420p[vid]" -map "[vid]" -map 0:a -codec:v libx264 -crf 18 -preset fast -codec:a aac -strict -2 -b:a 192k output.mp4
</code></pre>

<p>But the result i get is just a vertical line (the avectorscope does not spread out).</p>

<p><a href="https://i.sstatic.net/eaO6O.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eaO6O.png" alt="enter image description here"></a></p>

<p>I have made sure that the audio is in stereo and has a high amplitude. I guess there is something I am missing in the code...</p>

<p>Also I would really like to know how I can change the background color from black to something custom.</p>

CC BY-SA 3.0
2016-01-12T05:26:25.763Z
Have you used a shell or, on Windows, the command line?
Gyan
CC BY-SA 3.0
2016-01-12T22:16:35.080Z
Can you provide your input file?
llogan
CC BY-SA 3.0
2016-01-14T00:38:02.577Z
Not really because the content is private. It is a stereo MP3 file at 320kbps in 44.1 Hz
Arete
CC BY-SA 4.0
2020-12-08T19:56:44.727Z
Related: https://superuser.com/questions/843774/create-a-video-file-from-an-audio-file-and-add-visualizations-from-audio
Ciro Santilli OurBigBook.com
<ffmpeg><video-editor><audio>
ffmpeg audio to visualisation
Arete
# ffmpeg audio to visualisation

(Asked by: username_0 on 2016-01-12)

I would like to "convert" audio to video visualisation (oscilloscope or waveform) sort of like some media players have. 
I read this thread on how to do so with ffmpeg: How do I turn audio into video (that is, show the waveforms in a video)?
I have never used ffmpeg before and having read the previous thread I am still very confused with how to do it. As far as I know, ffmpeg does not have a GUI, so its a bit hard to understand. 
I tried the following code:
ffmpeg -i audio.mp3 -filter_complex "[0:a]avectorscope=s=1080x1080,format=yuv420p[vid]" -map "[vid]" -map 0:a -codec:v libx264 -crf 18 -preset fast -codec:a aac -strict -2 -b:a 192k output.mp4

But the result i get is just a vertical line (the avectorscope does not spread out).

I have made sure that the audio is in stereo and has a high amplitude. I guess there is something I am missing in the code...
Also I would really like to know how I can change the background color from black to something custom.

**Tags:** ffmpeg, video-editor, audio

> **Comments:**
> **username_1**: Have you used a shell or, on Windows, the command line?  
> **username_2**: Can you provide your input file?  
> **username_0**: Not really because the content is private. It is a stereo MP3 file at 320kbps in 44.1 Hz  
> **username_3**: Related: https://superuser.com/questions/843774/create-a-video-file-from-an-audio-file-and-add-visualizations-from-audio  

---

## 1 answers

### Answer by username_4 on 2016-01-14. Score: 3 | Accepted answer

The following command shows a video with a waveform of the corresponding audio:
ffmpeg -i input.mp4 -filter_complex "[0:a]showwaves=s=1280x720,format=yuv420p[vid]" -map "[vid]" -map 0:a -codec:v libx264 -crf 18 -preset fast -codec:a aac -strict -2 -b:a 192k output.mp4

I replaced avectorscope with showwaves: avectorscope is for showing the difference between stereo pairs.
Try showcqt,showfreqs,showspectrum for other visualization effects.

> **Comments:**
> **username_0**: Thanks a lot. Do you know any way to change the background from black to a custom color?  
> **username_2**: @username_0 For what effect, specifically? Some, or at least showfreqs, already have alpha and you just need to overlay it over a color source. Otherwise you could try format filter and colorkey or chromakey filters.  

---

