VideoHelp Forum

+ Reply to Thread
Results 1 to 7 of 7
  1. Hey guys,

    Im new to this forum so be nice to me

    I have the following problem. I have many video files like 500 (Mp4) and a specific audio track (wav).

    Now i want all video files to have that audio track. I have several programs where i can do this one by one, but this would take years.

    So is there a solution to batch encode this ? Video must be direct stream copy, audio encode is not so important.

    I researched alot for a solution but wasnt able to find one.

    Would be really great if anyone could help me here!

    Quote Quote  
  2. I'd first encode audio to aac. Then I'd backup all mp4 files!

    for %%a in (*.mp4) do mp4box -add "audio.m4a" "%%a"

    Or something like:
    for %%a in (*.mp4) do ffmpeg -i "%%a" -i "audio.m4a" -map 0 -map 1 -c copy "output\%%a"
    Last edited by sneaker; 17th Mar 2017 at 06:08.
    Quote Quote  
  3. Thanks so far that sounds "relatively" easy

    But i never had to do with any script encoding, so if you could give me a few more hints on how to do it or which tutorial to read that would be really great!

    Quote Quote  
  4. First you need the used programs. mp4box.exe or ffmpeg.exe. Both can be downloaded here on videohelp. Put them in the folder you have the mp4 files in (or into %PATH%). Then create a text file in notepad and copy one of the two lines I gave as examples in there. If you add a new line at the end with "PAUSE" it will not close after finishing so you have time to read any errors messages (it's also possible to let it write a log file). Save it as "whatever.bat". Double-click "whatever.bat" and it should do its work.

    (Instead of a batch file you can also enter things directly on the command-line, then use %a instead of %%a.)
    Quote Quote  
  5. Fantastic that already worked. Thanks alot!

    But there are two problems.

    1: The vids already have a crappy audio track and this way the track is added as a second track.
    2: The music is longer than the vid, and doing this script extends the video to song lenght

    Do you have solutions for that ? i want the old audio replaced and the song cut to the video lenght

    Quote Quote  
  6. This will work if your audio is longer than the video:
    for %%a in (*.mp4) do ffmpeg -i "%%a" -i "audio.m4a" -map 0:v -map 1:a -c copy -shortest "output\%%a"
    Quote Quote  
  7. Oh well, there is just one question left.

    Where should i put the statue i build in your image ? You dont know for how many years i though this must be possible but did not find a solution.....

    Thanks a million dude ... really!

    I dont even know what to do with all the time i have now? that i dont have to do one by one with 10 click for each file

    Quote Quote  

Similar Threads