VideoHelp Forum

+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. I am de-muxing my MP4 video files so I can normalize the aac audio files using aacgain. I use batchenc with the command "MP4Box.exe -single 1 <infile>" and "MP4Box.exe -single 2 <infile>". Doing this gives me a video file "file_track1.mp4" and an audio file "file_track2.mp4". I then run the audio files through aacgain to normalize them.

    I want to batch mux the "file_track1.mp4" and "file_track2.mp4" files. I am currently using the following command.

    mp4box.exe -add file_track1.mp4 -add file_track2.mp4 -new file.mp4

    This command works but i have have hundreds of videos. It will take forever to type the command every time. Now every audio and video file have the same file name but have _track1 and _track2 at the end. They all have the same .mp4 container.

    I need a command I can put into a .bat file, or a command I can use with batchenc.

    I have used My MP4box Gui, but the video and audio always un-sync. YAMB always allows 1 mux at a time. You can't make a que. Any help would be great. Thanks.
    Last edited by jd185051; 28th Apr 2012 at 20:33.
    Quote Quote  
  2. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date
    Aug 2000
    Location
    Sweden
    Search Comp PM
    Try put
    Code:
    for %%a in ("*_track1.mp4") do (
    set var=%%a
    mp4box.exe -add %var:~0,-11%_track1.mp4 -add %var:~0,-11%_track2.mp4 -new %var:~0,-11%-new.mp4
    )
    in a .bat file and in same folder as the mp4s and mp4box. Run it in a command box. But try first with some test files.


    (the %var:~0,-11% substrings the file name without the _track1.mp4)
    Last edited by Baldrick; 30th Apr 2012 at 02:14.
    Quote Quote  
  3. It didnt work but it seems you were close. Heres what happened.

    Microsoft Windows [Version 6.1.7601]
    Copyright (c) 2009 Microsoft Corporation. All rights reserved.

    C:\Users\John\Videos\vob\The Shield>mux

    C:\Users\John\Videos\vob\The Shield>for %a in ("*_track*.mp4") do (set var=%a mp
    4box.exe -add ~0,-11var:~0,-11var:~0,-11.mp4 )

    C:\Users\John\Videos\vob\The Shield>(set var=The Shield.S01E01.Pilot_track1.mp4
    mp4box.exe -add ~0,-11var:~0,-11var:~0,-11.mp4 )

    C:\Users\John\Videos\vob\The Shield>(set var=The Shield.S01E01.Pilot_track2.mp4
    mp4box.exe -add ~0,-11var:~0,-11var:~0,-11.mp4 )

    C:\Users\John\Videos\vob\The Shield>mux.bat

    C:\Users\John\Videos\vob\The Shield>for %a in ("*_track*.mp4") do (set var=%a mp
    4box.exe -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11var:~0,-1
    1var_track1.mp4 -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11va
    r:~0,-11var_track2.mp4 -new The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~
    0,-11var:~0,-11var.mp4 )

    C:\Users\John\Videos\vob\The Shield>(set var=The Shield.S01E01.Pilot_track1.mp4
    mp4box.exe -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11var:~0,
    -11var_track1.mp4 -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11
    var:~0,-11var_track2.mp4 -new The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add
    ~0,-11var:~0,-11var.mp4 )

    C:\Users\John\Videos\vob\The Shield>(set var=The Shield.S01E01.Pilot_track2.mp4
    mp4box.exe -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11var:~0,
    -11var_track1.mp4 -add The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add ~0,-11
    var:~0,-11var_track2.mp4 -new The Shield.S01E01.Pilot_track2.mp4 mp4box.exe -add
    ~0,-11var:~0,-11var.mp4 )

    C:\Users\John\Videos\vob\The Shield>
    Quote Quote  
  4. I recently found a thread with exactly what i need but with AVI DivX videos and MP3 audio. I am not good with commands or making .bat files. But a similar setup with MP4 video files and AAC audio using AACGain and MP4Box would really help. I want to put AACgain and MP4box in the same directory as my mp4 files, and have a .bat file normalize all mp4 file in the same directory.

    THREAD HERE: https://forum.videohelp.com/threads/255147-Mini-Guide-Normalizing-Audio-for-Multiple-AVI-files
    Last edited by jd185051; 29th Apr 2012 at 22:18.
    Quote Quote  
  5. OK i feel a little stupid. I read that whole thread and there is not only .bat files made for doing what I want, but a gui that seems work work great.
    Quote Quote  
  6. Member
    Join Date
    Apr 2017
    Location
    Brasil
    Search Comp PM
    Hello!
    I used this to mux several .h264 with .mp3 files in .mp4 container and it worked!

    Code:
    for %%A in ("*.h264") do (
     set var=%%A
     set var=!var:~0,-5!
    
    "C:\Program Files\Multimedia\My MP4Box GUI\Tools\mp4box.exe" -add "!var!.h264" -add "!var!.mp3" -new "!var!.mp4"
    )
    Quote Quote  



Similar Threads