I've got 20 jpg's and 20 mp3's. I'm trying to join them together to create an AVI. I want to do it all in one go. The files match together so that the first JPG in the folder matches up with the first audio. And the last jpg to the last mp3 and so forth.

The FFmpeg I've got to join them together is:

ffmpeg -r 1 -loop 1 -i picture1.jpg -i audio1.mp3 -acodec copy -r 1 -shortest out.avi

I'm just struggling with creating a batch file to execute. I'm using windows 10.

This is what I have so far:

@echo off set "sourcedir=C:\Users\Johnny\Desktop\FFMPEG"
set "outputdir=C:\Users\Johnny\Desktop\FFMPEG\done"

PUSHD "%sourcedir%"

for %%F in (*.mp3) DO ffmpeg -r 1 -loop 1 -i Photo.jpg -i "%%F" -acodec copy -r 1 -shortest "%outputdir%/%%F.avi"



It creates an .avi in the folder done. However I'm looking to enable it to do It for multiple photos and audio but I can't figure it out.

  • 1
    Have you done some research into writing a batch loop? There are lots of examples available on the web. – slhck Sep 12 '17 at 8:11
  • See the editing help to figure out how to properly format the commands in your question. – llogan Sep 21 '17 at 17:48

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.