Advertisement
dezindzer

Batch converting MP3 and still image to MP4 with ffmpeg

Jan 6th, 2016
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.53 KB | None | 0 0
  1. for %%i in (*.mp3) do (
  2.   ffmpeg -loop 1 -i picture.jpg -i "%%i" -c:v libx264 -tune stillimage -c:a aac -strict experimental -b:a 192k -pix_fmt yuv420p -shortest "%%~i.mp4"
  3. )
  4. done
  5.  
  6.  
  7.  
  8. ### MANUAL ###
  9.  
  10. 1. Copy the abowe code and save it using your favorite editor as "my awesome converter.bat"
  11. 2. run it
  12. 3. Win
  13.  
  14. note* you have to have ffmpeg.exe in your system32 folder for this to work - download it from the official site
  15.  
  16. ### DESCRITION ###
  17.  
  18. The converter exports all MP3 files (can be changed to any type: aac, wav...) from a folder where this script is located (to the same folder) to MP4 files (can be changed to AVI, FLV,...) with the image "picture.jpg" (can also be changed: png, gif...) provided.
  19.  
  20. ### BREAKDOWN ###
  21.  
  22. %%i  - for every file with the given parameter (witch here is the mp3 files)
  23. (*.mp3) - any file with the mp3 filetype
  24. do ( - starts the command:  ffmpeg -i picture.jpg -i "%%i" -c:a copy -vcodec libx264 -pix_fmt yuv420p "%%~i.mp4"
  25. ffmpeg - starts the ffmpeg.exe converter with the parameters:
  26. -i picture.png - "-i" inserts a new file, wich here is the picture we want
  27. -i "%%i"  -  inserts a new file, wich here is the first in order of files from the folder, and than starts the next one...
  28. -c:a copy  - uses the same encoding ("a" stands for audio, "v" for video - but we have a pic, so we don't need that) as the file provided (better coz it needs less time to convert the file)
  29. -vcodec libx264 - (forces the video exported to have the 264 video codec)
  30. -pix_fmt yuv420p - google it, but you will need it xD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement