28698

ffmpeg generate overlay complex filter for audio with background image

<h3>Question</h3>

I am experimenting with ffmpeg and would like to generate overlay complex filter for audio with background image. The code normally works, except for when adding -filter_complex "[0:a]showwaves=s=1280x720:mode=line,format=yuv420p[v]" -map "[v]" -map 0:a it crashes. I found the example code at https://trac.ffmpeg.org/wiki/Waveform Any help is appreciated.

Command '['c:/ffmpeg/bin\\ffmpeg.exe', '-y', '-loop', '1', '-r', '1', '-i', 'temp\\bg.png', '-i', 'test.mp3', '-filter_complex', '[0:a]showwaves=s=1280x720:mode=line,format=yuv420p[v]', '-map', '[v]', '-map', '0:a', '-c:v', 'libx264', '-preset', 'ultrafast', '-tune', 'stillimage', '-crf', '15', '-pix_fmt', 'yuv420p', '-strict', 'experimental', '-c:a', 'aac', '-b:a', '256k', '-shortest', '-threads', '0', 'done/test.mp4']'

EDIT 1:

I tested this with the new verson: ffmpeg -y -i input.mp3 -i background.png -filter_complex "[0:a]showwaves=s=1280x720:mode=line,format=yuv420p[v]" -map "[v]" -map 0:a -c:v libx264 -c:a copy output.mp4

It generates an output file, but only the waveform, no background included. My end goal is to generate the waveform over the background.


<h3>Answer1:</h3>

Use

ffmpeg -y -i input.mp3 -loop 1 -i background.png -filter_complex "[0:a]showwaves=s=1280x720:mode=line,colorkey=0x000000:0.01:0.1,format=yuva420p[v];[1:v][v]overlay[outv]" -map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy -shortest output.mp4

来源:https://stackoverflow.com/questions/34675160/ffmpeg-generate-overlay-complex-filter-for-audio-with-background-image

Recommend

  • How to get rid of __key__ columns in BigQuery table for every 'Record' Type field?
  • FFMPEG add text frames to the start of video
  • Comparing Haskell threads to kernel threads - is my benchmark viable?
  • Allocate array onto heap with size known at runtime
  • C# WinForms: Make panel scrollbar invisible
  • Java Play2- Akka for jobs
  • Send/Receive Intents in the same class
  • Copying a nested property to parent object in elasticsearch with Nest client
  • How to get full url in Angular?
  • Executing JavaScript function in Code behind — How to Get the Return Value in Code Behind
  • Using VCL Styles gives a exception / crash in TOpenDialog
  • android 3G signal strength
  • Get last 15 lines from a large file in SFTP with phpseclib [duplicate]
  • Python Equivalent of Java's 'Keystore'?
  • Eric5: The OK button of 'new project' dialog is disable
  • How to run Daphne Server (Django Channels) & workers in the background?
  • How to convert days into months using datetime in Python3?
  • Draw 9 patch dotted /dashed line on Android
  • Php artisan optimize is failing on production server
  • Protractor Page objects - TypeError: Object # has no method 'methodName'
  • How can I filter an array of dictionaries in 'updateSearchResultsForSearchController' to s
  • UIScrollView does not restore properly
  • git clone, upload-pack out of memory
  • Why do you need 2 Javascript files for cross-platform Cordova plugin?
  • Javascript inside HTML import not affecting imported HTML
  • select an input by value?
  • Unable to create Access token grant type in wso2 API manager store to test API
  • How to call different template for different category archive page in woocommerce
  • Sql - ON DUPLICATE KEY UPDATE
  • Creating random wired topology for given arbitrary number of nodes on NS2