Log in

View Full Version : MP4BOX - Adding in second Audio track but switching Ids over?


glen8
26th August 2011, 20:41
Hi all,

I have a large collection of MP4s. They are built as follows

VIDEO.H264 :1
AUDIO.AAC :2
Chapters
Poster

I'd like to add in a second audio track which is AC3. The issue though is when I do MP4BOX video.mp4 -add audio.aac it adds the audio track fine, but as the second audio track. I require the AC3 to be the first audio track and aac as second.

Obviously I can extract all the streams out and build it again in the right order but in doing so I loose chapters and the poster. YAMB can export the chapters but I require something CLI based so I can script up a large batch file and I also would like to keep the poster.

So....is there anyway of adding in another audio track and somehow swapping the IDs over?

Thanks!!

glen8
26th August 2011, 21:16
just thought of doing this, good idea?

@echo on
for /f "delims=" %%a in ('"dir /b *.mp4"') do (
"D:\Software\Software for BluRay to MP4\ac3\NeroAacDec.exe" -if "%%a" -of - | "D:\Software\Software for BluRay to MP4\ac3\Aften.exe" -readtoeof 1 -b 448 - audio.ac3
"D:\Software\Software for BluRay to MP4\ac3\mp4box.exe" "%%a" -raw 2 -rem 2 -add audio.ac3 -lang 2=eng
"D:\Software\Software for BluRay to MP4\ac3\mp4box.exe" "%%a" -add *.aac -lang 3=eng
del /q audio.ac3
del /q *.aac )
pause