VideoHelp Forum
+ Reply to Thread
Results 1 to 18 of 18
Thread
  1. Hi
    This question has been asked before in this forum but it is very old now and even the links posted doesn't work anymore.

    Any how as the title suggests, I have a collection of about 300 audio (mp3) files each with an hour of 1hr in length and I need to combine those with the same picture to make a video file so that I can upload those videos in to youtube.

    I know I can use Windows Movie Maker for combining, but since there are around 300 files I would like to know whether there is a software that does the same thing in batch without me having to do each individually.

    thank you
    Quote Quote  
  2. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Might try this thread. Sounds like what you want to do and the method is posted there as well:
    https://forum.videohelp.com/threads/314067-Batch-create-single-frame-videos

    Looks like it uses FFMpeg to accomplish the feat.

    If you don't care if they are AVI or MP4 you can usee Virtualdub and select audio->audio from other file and select your audio file. Then change the Video->Frame Rate-> change so audio and video match and create your AVI or MP4(Virtualdub 1.10.3 using external encoder).
    Click image for larger version

Name:	ScreenHunter_480 Mar. 07 00.29.jpg
Views:	1181
Size:	137.0 KB
ID:	16642
    Quote Quote  
  3. Hey Thanks for the answer.

    Actually I asked the original poster from that thread about the way he did it and that is why he says "at the request of someone" and that last reply by him was just yesterday (Mar6th 2013) compared to the second to last post which was in 2009.
    I will be using his method, but since it involves coding in FFMpeg which I am not familiar with I have to wait till the weekend to get help from one of my friends in doing it.

    Anyhow regarding the second suggestion you made, it really doesn't matter if the output file is.avi format.
    But according to your explanation, I am not sure how to use virtualdub to do that specific task (join an image and an audio file to make a video file) in batch form.

    Can you explain how to use virtualdub to do it for more than 1 audio file at a time. If it is possible?
    Quote Quote  
  4. Member Cornucopia's Avatar
    Join Date
    Oct 2001
    Location
    Deep in the Heart of Texas
    Search PM
    Another way to do it is a little old-school but still works well:
    1. Using MJPEGTools (can be found with VCDEasy, or just use VCDEasy as the GUI), convert photo to MPEG "HiRez" Still (aka 720x480 SD size)
    2. Using toolame, convert mp3 to mp2 (use slightly higher bitrate to maintain similar quality, as mp2 is less efficient than mp3)
    3. Using Muxer (TMPGEnc, Imago, etc) mux the still(s) and MP2 audio together. Good idea to follow this guide: http://prince.org/msg/15/237888.
    4. Using svcdstl (uploaded, as my old website is no longer working), patch the mpg (stills stream headers) to support the stills in regular players.

    Yes, it would mean you are stuck with SD resolution pictures, and yes, it means you have to use MP2 audio, but it works perfectly fine in most players that support MPG1 or MPG2, and it doesn't use much more bitrate than the audio alone would.

    Scott
    Image Attached Files
    Quote Quote  
  5. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Virtualdub wasn't really made for this type of batch file conversion since the Audio wiill be changing for each file. There is a way to do with FFMpeg when you get your friend to help. Just put all your audio files (we'll assume mp3) and the image you will use (we'll assume JPG) and the FFMpeg.exe all in one folder. Open a command window in this folder or navigate to it. Then type the following, replacing the word Herringbone with the name of your image <for mp4 output>

    for %a in (*.mp3) do "ffmpeg" -loop 1 -r 1 -shortest -i "Herringbone.jpg" -vcodec mpeg4 -i %a -acodec copy %a".mp4"

    Or type the following, replacing the word Herringbone with the name of your image <for flv output>

    for %a in (*.mp3) do "ffmpeg" -loop 1 -r 1 -shortest -i "Herringbone.jpg" -vcodec flv -i %a -acodec copy %a".flv"

    %a is replaced by each mp3 name and runs FFMpeg for each one and outputs it in mp4 or flv format to a concatenated filename like "MyAudio.mp3.MP4" or "yourAudio.mp3.FLV"

    Since you want to upload to YouTube, those are the 2 most likely compatible with that site. I tried this on my folder and it worked great. If you have problems it most likely is the file size not being correct for the mpeg4 or flv codec. Just cropping it to a size divisible by 2 should work. I'm sure there are other methods but this takes about 15 minutes if the files are ok to start with.

    IMPORTANT: Make sure your image and audio have no spaces in them since %a will be replaced with a title like "image one.jpg" without the quotes and ffmpeg will stop reading after the space and think its an image called "image" since there are no quotes and tell you no such file found.

    UPDATE:
    The later versions of ffmpeg are fussier about where you put the -shortest, determining whether you mean input or output (-i), and when you use quotes.

    BATCH file script below, using 'herringbone.jpg' and 'happy birthday.mp3', run in CMD window:. (Need extra % sign for batch files, not needed if typed directly into CMD window and SOME quotes for happy birthday.mp3 with space in it)

    Code:
    for %%a in (*.mp3) do "ffmpeg" -loop 1 -r 1 -i "Herringbone.jpg" -vcodec flv -i "%%a" -acodec copy -shortest "%%a.flv"
    WILL work with the quotes missing from the first %%a

    Code:
    for "%%a" in (*.mp3) do "ffmpeg" -loop 1 -r 1 -i "Herringbone.jpg" -vcodec flv -i "%%a" -acodec copy -shortest "%%a.flv"
    will NOT work
    giving error:

    C:\Users\Bud\Desktop\mp3video>C:\Users\Bud\Desktop \mp3video\mp3video.bat
    "%a" was unexpected at this time.
    You may have to use the error and thrial and error to get it right.
    Last edited by Budman1; 2nd Nov 2017 at 00:27.
    Quote Quote  
  6. Thank to both Cornucopia and Budman1 for your great suggestion.
    @Budman1, I seem to like your method better and it almost worked except for few issues.

    As I have mentioned before, the audio files are about 1hr in length (55mb in size), but still I wanted to check your method with smaller audio files and I wanted to check it myself since you wrote a really good explanation on what to type on the command window and all the other details associated with it..

    Please see the attach picture. It has a print screen about the problem I am having now.

    So I grabbed two mp3s from internet (2.30 min/ 2.5mb in size) and tried to join with an image.
    The file names for the audio are Don Trip You Gotti and Young Taz No Worries (just disregard the stupid names, those are the first ones I could find online)

    As you could see from the picture, a flv file for the first audio file in the folder was made pretty quickly by the FFMpeg, but the flv for the second audio file was not made even after more than 45 minutes from the start of the process and instead the FFMpeg kept running without any specific output as you can see from the command prompt window.

    I typed the command prompt as it appears in the word file with the replaced image name for what you had there.

    Do you have any suggestion for what I might be doing wrong for the FFMpeg to not produce the 2nd video file and on instead kept running.

    Can there be something wrong with the spacings in the command prompt. I basically copied what you had and only changed the image name.
    Sorry for all the trouble, but this is the first time I'm using command prompt to execute something.Click image for larger version

Name:	Print Screen.png
Views:	585
Size:	329.8 KB
ID:	16664
    Quote Quote  
  7. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Sorry it took so long to reply but I didn't seem to get a notice. Anyway, I tried your scenario and I got the same sort of results and then I realized I had updated FFMpeg. I tried the last 3 versions I had used and got, surprisingly, 3 different results. The 3 versions were:
    Click image for larger version

Name:	ScreenHunter_481 Mar. 16 23.30.jpg
Views:	893
Size:	34.8 KB
ID:	16779

    With the 20130110 version, I got the same results as you caused by a high frame count being encoded.
    Click image for larger version

Name:	ScreenHunter_481 Mar. 16 23.38.jpg
Views:	870
Size:	126.1 KB
ID:	16780

    With 20130314 version I got an error and it failed completely:
    Click image for larger version

Name:	ScreenHunter_481 Mar. 16 23.40.jpg
Views:	986
Size:	168.1 KB
ID:	16781

    But with the 20120426 version 2 files converted in a few seconds as was my last attempts:
    Click image for larger version

Name:	ScreenHunter_481 Mar. 16 23.42.jpg
Views:	934
Size:	135.7 KB
ID:	16782

    You might also notice my notation one one version that works with EBUR128 and it fails on the latest also. Guess the moral is FFMpeg is great but different versions seem to be VERY different in some uses. I'm noting all that work now and which ones so I can try all the failures on any new versions. I downloaded the 20120426 version at http://ffmpeg.zeranoe.com/builds/win32/static/ and there are a lot between there and 20130110 version I updated to but I'd start with the one that works and work up from there if you wish.

    It works fine on all I try with 20120426, hope it does for you.

    UPDATE:
    See my update to post #5 above for the correct syntax that was tested in later versions.
    Last edited by Budman1; 2nd Nov 2017 at 00:31.
    Quote Quote  
  8. Hello Budman 1,

    It finally worked after using the 20120426 version. The conversion is so fast that in the time it takes to do one video with Windows Movie Maker, ffmpeg does like 50 videos (no kidding!!!!!!)

    I just can't thank you enough for all the time and effort you put in to help me out in this problem and you don't know how important this is to me.

    Again thank you very much for the help and I hope you find quick and easy answers to any problems you may face in future as well.
    Quote Quote  
  9. This line works in 2019 with Ffmpeg 4.1.1

    for %a in (*.mp3) do "ffmpeg" -loop 1 -r 1 -i "Herringbone.jpg" -vcodec mpeg4 -i %a -acodec copy -shortest %a".mp4"

    I just had to change the place of the -shortest

    The file name has to be like thisisit.mp3 it can not be like "This Is It.mp3" else the command line prompts a error.

    Thanks for the work! I had to convert my 1900+ instrumentals to videos so I can upload them to youtube..

    Antti
    Last edited by Aluode; 6th Apr 2019 at 02:18.
    Quote Quote  
  10. Thanks Aloude for confirming the command prompt line for the latest Ffmpeg version.

    I still thank Budman1 for his help in getting this to work.

    And happy this helped you. I have also uploaded more than 3000 1hour videos to youtube and without this thread it wouldn't have been possible.
    Quote Quote  
  11. Member
    Join Date
    Mar 2020
    Location
    U.K. not in EU anymore.
    Search Comp PM
    Hi this is almost exactly what I want to do but I have 24k upscaled jpgs after using FFMpeg to extract, Topaz AI Gigapixel to upscale, Irfanviewer to downsample. Just need a prog to combine pics with some audio. I realise the last post was a year ago but hope to find a little help here as its so close to the original post query.
    Quote Quote  
  12. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    You wish to add an audio file to each image or add audio to the joined images ( into a single video)?
    Quote Quote  
  13. Member
    Join Date
    Mar 2020
    Location
    U.K. not in EU anymore.
    Search Comp PM
    The later of the two options plz.
    Quote Quote  
  14. Something along the lines of this in a batch file:

    Code:
    ffmpeg -f image2 -framerate 25.00 -i %%08d.jpg -i audio.ac3 -acodec copy -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -sar 1:1 "output.mp4"
    You'll probably have to change the "%%8d" to match your file names. That particular file spec means an 8 digit number with leading zeroes, 00000000.jpg, 00000001.jpg, etc.
    Quote Quote  
  15. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    Ran a test on a short video (5+ seconds) and extracted 179 frames to png. (img00001.png, img00002.pmg, etc) I converted the images to a video, Then combined with an mp2 audio and added -shortest so the audio (which was longer) ended at the end og the video.

    Code:
    ffmpeg -r 29.970 -f image2 -s 854x480 -i img%05d.png -i MP2FILE.mp2 -vcodec libx264 -b 4M -acodec copy -shortest OUTPUT.mp4
    Change the bitrate, size, and frame rate as needed.

    P.S OOOps Jagabo beat me to it and i Missed duh!
    Last edited by Budman1; 18th Mar 2020 at 00:05. Reason: OOps
    Quote Quote  
  16. Member
    Join Date
    Mar 2020
    Location
    U.K. not in EU anymore.
    Search Comp PM
    ffmpeg -f image2 -framerate 25.00 -i %%08d.jpg -i audio.ac3 -acodec copy -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -sar 1:1 "output.mp4"
    ffmpeg version git-2020-03-15-c467328 Copyright (c) 2000-2020 the FFmpeg developers
    built with gcc 9.2.1 (GCC) 20200122
    configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
    libavutil 56. 42.100 / 56. 42.100
    libavcodec 58. 75.100 / 58. 75.100
    libavformat 58. 41.100 / 58. 41.100
    libavdevice 58. 9.103 / 58. 9.103
    libavfilter 7. 77.100 / 7. 77.100
    libswscale 5. 6.101 / 5. 6.101
    libswresample 3. 6.100 / 3. 6.100
    libpostproc 55. 6.100 / 55. 6.100
    [image2 @ 000001997b92afc0] Could find no file with path '%%08d.jpg' and index in the range 0-4
    %%08d.jpg: No such file or directory

    Can you explain what the command is specifying? What is image2? img%05d.png? Input? My files are Titlexx-14100.png xx being from 01 to 77 14100 is a reminder of the settings I used in AI Gigapixel. I'm not looking for audio in this one its just a HQ gif.

    I renamed my files to %%02d.png so %%01d.png to %%77d.png, didn't work for me.

    ffmpeg -f image2 -framerate 25.00 -i %%02d.png -i audio.ac3 -acodec copy -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -sar 1:1 "output.mp4"

    I am running a command prompt from the same directory.

    ffmpeg -i "123.avi" "123.mp3"
    This worked for me but is not the task I enquiring about.
    Last edited by masteratarms; 24th Mar 2020 at 19:39.
    Quote Quote  
  17. Member Budman1's Avatar
    Join Date
    Jul 2012
    Location
    NORTHWEST ILLINOIS, USA
    Search Comp PM
    ffmpeg -f image2 -framerate 25.00 -i %%08d.jpg -i audio.ac3 -acodec copy -vcodec libx264 -pix_fmt yuv420p -preset slow -crf 18 -sar 1:1 "output.mp4

    Ffmpeg=encoding program
    -f image2= means force image ( inage2 just name of encoder)
    -framerate 25.000 means video will be 25 fps
    -i %%08d.jpg = input image with 8 positions in name
    -i audio.ac3 = name of the ac3 audio file(ace,aac,mp3,etc)
    -acodec copy= the audio codec should copy the ac3 file not encode it
    -vcodec libx264= use video codec libx264 to encode video
    -pix_fmt yuv420p= format of video out will be on yuv420p (good standard format )
    -crf 18 quality(standard,lower number better quality larger file size)
    -sar 1:1 means storage as square pixels
    Quote Quote  
  18. Use %% in a batch file, only one % when typed at the command line. This is because % has a special meaning in a batch file (the arguments passed to the batch file), so to pass % to a program it must be escaped with a second %.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!