Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Batch wrap AAC in mp4/m4a? (Read 4815 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Batch wrap AAC in mp4/m4a?

Hey ya'll,

I have a bunch of aac I demuxed from some mp4 videos, and I want to get them over to m4a eventually to throw them into picard and get all my metadata on there and have them compatible with my devices. I have YAMB and Avanti but Avanti doesn't seem to have this functionality built in, and YAMB throws errors every time I try to mux the aac to m4a or mp4 (although really oddly sometimes I get a file output that sounds ok even when it says muxing failed). I was able to batch demux with Avanti very easily and smoothly but I'm stumped for the next step.

It is my understanding that this should be a trivial task with YAMB. Am I an idiot?

Re: Batch wrap AAC in mp4/m4a?

Reply #1
I don't have experience with any of those (in fact, not even with mp4box), but ffmpeg should be able to do so with this instruction:
(replace inputname and oputputname with the appropiate names/paths)
Code: [Select]
ffmpeg.exe -i inputname.aac -acodec copy -bsf:a aac_adtstoasc -vn outputname.m4a

For batch processing, you can create a batch script. On windows, it could be like this:

Code: [Select]
set thisdir=%1
For /R %thisdir% %%J IN (*.aac) do (
"path_to_ffmpeg"/ffmpeg.exe -v error -i "%%J" -acodec copy -bsf:a aac_adtstoasc -vn "%%J".m4a
)
Saving that code into a .cmd file, and dropping the directory folder over this file for processing should do it.

Re: Batch wrap AAC in mp4/m4a?

Reply #2
Ah, thanks, I read the entry for aac_adtstoasc but wasn't sure it was what I needed (you'll notice I'm using front end GUIs for everything, there's a reason for that, haha).

/e: had to wrap \ffmpeg.exe in quotes with the path, and change / to \, then it sort of worked. Except all the files end with .aac.m4a now, but I guess that's ok. Gonna do it again with mp4, didn't notice the script had it set to m4a, haha. First I need the .mp4s to put in picard to tag+metadata/cover art, then convert (aka rename) to m4a.

My script looks like this:

Code: [Select]
set thisdir=%1
For /R %thisdir% %%J IN (*.aac) do (
"path_to_ffmpeg\bin\ffmpeg.exe" -v error -i "%%J" -acodec copy -bsf:a aac_adtstoasc -vn "%%J".mp4
)
pause

How would I configure it to move processed files to a particular directory?

Re: Batch wrap AAC in mp4/m4a?

Reply #3
You could use this command line with mp4box.

mp4box.exe -add [aac file] -new [m4a or mp4 output file]

Re: Batch wrap AAC in mp4/m4a?

Reply #4
You could use this command line with mp4box.

mp4box.exe -add [aac file] -new [m4a or mp4 output file]

Thank you, I got this instead:

Code: [Select]
set thisdir=%1
set "new_directory=E:\MP4"
For /R %thisdir% %%J IN (*.aac) do (
"path_to_ffmpeg\bin\ffmpeg.exe" -v error -i "%%J" -acodec copy -bsf:a aac_adtstoasc -vn "%new_directory%\%%~nJ.mp4"
)
pause

Re: Batch wrap AAC in mp4/m4a?

Reply #5
How would I configure it to move processed files to a particular directory?

You have the name of the generated file in "%%J".mp4, as you found out. The command to move the file is
Code: [Select]
move "%%J".mp4  C:\mydir\

As for the ".aac.mp4" double extension, the "%%J" syntax allows for separating it in "name" and "extension", but in my tests i had problems on directories with spaces where the full-path syntax worked. Then I simply batch rename with another program.