Answers.Body: <pre><code>ffmpeg -i music.mp3 -loop 1 -i image.jpg -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p[v];[1:v][v]overlay=(W-w)/2:(H-h)/2:format=auto,format=yuv420p[outv]" -map "[outv]" -map 0:a -c:v libx264 -c:a copy -shortest -movflags +faststart output.mp4
  </code></pre>
  
  <ul>
  <li><p>Remove the <a href="https://ffmpeg.org/ffmpeg-filters.html#format" rel="nofollow noreferrer">format</a> filter after showwaves.</p></li>
  <li><p>Use <code>format=auto</code> in the <a href="https://ffmpeg.org/ffmpeg-filters.html#overlay" rel="nofollow noreferrer">overlay</a> filter.</p></li>
  <li><p>Do all of the filtering within the filtergraph, so remove <code>-pix_fmt</code> and replace it with the format filter.</p></li>
  </ul>
  
  <p>If you want <code>image.jpg</code> to fit within a specific size such as 1280x720:</p>
  
  <pre><code>ffmpeg -i music.mp3 -loop 1 -i image.jpg -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p[fg];[1:v]scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720,setsar=1[bg];[bg][fg]overlay=(W-w)/2:(H-h)/2:format=auto,format=yuv420p[outv]" -map "[outv]" -map 0:a -c:v libx264 -c:a copy -shortest -movflags +faststart output.mp4
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T16:31:07.083Z
Answers.Text: thanks for script .There is a padding (default black) under the visualiser (in the original script ),how could one change the color of this padding ?I tried adding option  "overlay :colors= Blue" but received an error= "Option 'colors' not found"
Answers.UserDisplayName: srt111
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-12T18:44:29.040Z
Answers.Text: @starzar Show a screenshot so I can see what you are describing.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T07:03:36.583Z
Answers.Text: tested your script but the issue still persists.On closer inspection ,the visualizer is there ,it is just getting pushed to the bottom of the page(Some spikes in the frequency could be seen at the page bottom ).How could the visualizer  be bought to the center?.
Answers.UserDisplayName: srt111
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T17:52:38.070Z
Answers.Text: @starzar Updated answer. It will now center the overlay. The second example will resize images to fit within 1280x720 without needing to pre-process with ImageMagick.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-04T20:44:39.493Z
Answers.LastActivityDate: 2019-02-05T17:51:54.727Z
Answers.LastEditDate: 2019-02-05T17:51:54.727Z
Answers.UserDisplayName: llogan
Answers.Body: <p>Scale does matter while creating ffmpeg videos with images.</p>
  
  <p>In the above case, some background images were really small (eg 512 x 210 etc).
  On doing a batch size conversion  of all the background images (using Imagemagick)to 1280x720 (same as render size) the above code works fine </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-05T16:44:39.577Z
Answers.LastActivityDate: 2019-02-05T16:59:10.100Z
Answers.LastEditDate: 2019-02-05T16:59:10.100Z
Answers.UserDisplayName: srt111
Body: <p>The code below runs a perfect red audiovisualizer when run on a “black” colored background. But when used with any other colored jpg image the visualizer just doesn't show up. What's missing? </p>
  
  <pre><code>ffmpeg -y -i music.mp3 -loop 1 -i black.jpg -filter_complex \
     "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p,format=yuv420p[v];[1:v][v]overlay=0:200[outv]" \
     -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output_bg.mp4
  </code></pre>
  
  <p><a href="https://i.sstatic.net/lKCoz.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/lKCoz.jpg" alt="enter image description here"></a>
  <a href="https://i.sstatic.net/FmKVc.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/FmKVc.jpg" alt="enter image description here"></a></p>
  
Tags: <ffmpeg>
Title: Audiovisualiser not visible
UserDisplayName: srt111
ThreadText: # Audiovisualiser not visible
  
  (Asked by: username_0 on 2019-02-04)
  
  The code below runs a perfect red audiovisualizer when run on a “black” colored background. But when used with any other colored jpg image the visualizer just doesn't show up. What's missing?
  
  ```
  ffmpeg -y -i music.mp3 -loop 1 -i black.jpg -filter_complex \
     "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p,format=yuv420p[v];[1:v][v]overlay=0:200[outv]" \
     -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output_bg.mp4
  
  ```
  
  [![enter image description here](https://i.sstatic.net/lKCoz.jpg)](https://i.sstatic.net/lKCoz.jpg)
  [![enter image description here](https://i.sstatic.net/FmKVc.jpg)](https://i.sstatic.net/FmKVc.jpg)
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2019-02-04. Score: 1
  
  ```
  ffmpeg -i music.mp3 -loop 1 -i image.jpg -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p[v];[1:v][v]overlay=(W-w)/2:(H-h)/2:format=auto,format=yuv420p[outv]" -map "[outv]" -map 0:a -c:v libx264 -c:a copy -shortest -movflags +faststart output.mp4
  
  ```
  
  * Remove the [format](https://ffmpeg.org/ffmpeg-filters.html#format) filter after showwaves.
  * Use `format=auto` in the [overlay](https://ffmpeg.org/ffmpeg-filters.html#overlay) filter.
  * Do all of the filtering within the filtergraph, so remove `-pix_fmt` and replace it with the format filter.
  
  If you want `image.jpg` to fit within a specific size such as 1280x720:
  
  ```
  ffmpeg -i music.mp3 -loop 1 -i image.jpg -filter_complex "[0:a]showwaves=s=1280x175:colors=Red:mode=p2p[fg];[1:v]scale=1280:720:force_original_aspect_ratio=increase,crop=1280:720,setsar=1[bg];[bg][fg]overlay=(W-w)/2:(H-h)/2:format=auto,format=yuv420p[outv]" -map "[outv]" -map 0:a -c:v libx264 -c:a copy -shortest -movflags +faststart output.mp4
  
  ```
  
  > **Comments:**
  > **username_0**: tested your script but the issue still persists.On closer inspection ,the visualizer is there ,it is just getting pushed to the bottom of the page(Some spikes in the frequency could be seen at the page bottom ).How could the visualizer  be bought to the center?.  
  > **username_1**: @starzar Updated answer. It will now center the overlay. The second example will resize images to fit within 1280x720 without needing to pre-process with ImageMagick.  
  > **username_0**: thanks for script .There is a padding (default black) under the visualiser (in the original script ),how could one change the color of this padding ?I tried adding option  "overlay :colors= Blue" but received an error= "Option 'colors' not found"  
  > **username_1**: @starzar Show a screenshot so I can see what you are describing.  
  
  ---
  
  ### Answer by username_0 on 2019-02-05. Score: 0
  
  Scale does matter while creating ffmpeg videos with images.
  
  In the above case, some background images were really small (eg 512 x 210 etc).
  On doing a batch size conversion of all the background images (using Imagemagick)to 1280x720 (same as render size) the above code works fine
  
  
  ---
  
  