VideoHelp Forum

Try DVDFab and download streaming video, copy, convert or make Blu-rays,DVDs! Download free trial !
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. Member
    Join Date
    Jul 2020
    Search PM
    A M4A audio file can contain AAC audio. If so, then such a M4A file is a container format for AAC audio. It seems that most (all?) general conversion programs, do not convert losslessly between AAC and M4A (containing AAC) files.

    A lossless conversion between M4A and AAC audio files, can be done with MP4Box (which is part of "GPAC Framework"), as follows:



    How do it (1) - Install MP4Box and create batch files (Windows)
    • Install only the MP4Box component from GPAC Framework. I used this version: "gpac-0.7.0-rev27-g0639a09-master-win32.exe", which can be found here.
    • Create, based on what you prefer, one or more of the following Windows Batch files (scripts). Use Windows Notepad or another simple text editor to create those files. The name of those files should have a ".bat" extension.
    [A] To convert only the relevant files that are in a single folder, and to create a subfolder in that folder, and to put the converted files in that subfolder:
    • To convert from M4A to AAC:
    m4a2aac.bat
    @echo off
    mkdir aac
    for %%f in (*.m4a) do "C:\Program Files (x86)\GPAC\mp4box.exe" -raw 1 "%%f" -out "aac\%%~nf.aac"
    • To convert from AAC to M4A:
    aac2m4a.bat
    @echo off
    mkdir m4a
    for %%f in (*.aac) do "C:\Program Files (x86)\GPAC\mp4box.exe" -add "%%f" "m4a\%%~nf.m4a" -new
    [B] To convert the relevant files in a folder and all its subfolders, and to add the converted files to that folder and subfolders (without creating any subfolders):
    • To convert from M4A to AAC:
    m4a2aac_IncludingSubfolders.bat
    FOR /R %%G in (.) DO (
    Pushd %%G
    for %%f in (*.m4a) do "C:\Program Files (x86)\GPAC\mp4box.exe" -raw 1 "%%f" -out "%%~nf.aac"
    Popd )
    • To convert from AAC to M4A:
    aac2m4a_IncludingSubfolders.bat
    FOR /R %%G in (.) DO (
    Pushd %%G
    for %%f in (*.aac) do "C:\Program Files (x86)\GPAC\mp4box.exe" -add "%%f" "%%~nf.m4a" -new
    Popd )
    Important note: The above bat-files only work, when you installed MP4Box in "C:\Program Files (x86)\GPAC\mp4box.exe". If not, change "C:\Program Files (x86)\GPAC\mp4box.exe" in the batch file, into the location where you installed MP4Box. (The batch files work with Windows 7 and later versions of Windows.)



    How do it (2) - Run batch files
    • Place a temporary copy of the relevant batch file in the folder that contains the files to be converted.
      • All relevant files in that folder will be converted with "m4a2aac.bat" or "aac2m4a.bat".
      • All relevant files in that folder and all its subfolders, will be converted with "m4a2aac_IncludingSubfolders.bat" or "aac2m4a_IncludingSubfolders.bat".
    • Double click on the batch file. A temporary progress window will appear, until all relevant files are converted.
    • Delete the temporary copy of the batch file.


    Why do it


    There can be different reasons why one would want to losslessly convert between AAC and M4A audio files. Two such reasons:
    • It seems that AAC audio files can only be trimmed or cut losslessly with the program "mp3DirectCut". If you want to losslessly trim or cut a M4A audio file (containing AAC audio), you first have to losslessly convert this M4A file to an AAC file. Then you trim or cut this AAC file losslessly in mp3DirectCut. After that, you losslessly convert the trimmed or cut AAC file back to a M4A file.
    • In general, AAC audio files do not support metadata tags, while M4A audio files (containing AAC audio) do support metadata tags. So, if you want to have an "AAC audio file with tags", first convert such an AAC file losslessly to a M4A file, and then add tags to that M4A file.
    The above is based on this. See there for other variations of using MP4Box for a lossless conversion between M4A and AAC, including a way to 'preserve' metadata tags.
    Quote Quote  
  2. lol, "lossless" conversion where one codec is lossy
    Quote Quote  
  3. Can't this be done in batch using ffmpeg copy?
    Quote Quote  
  4. Member
    Join Date
    Jul 2020
    Search PM
    Originally Posted by noemi7 View Post
    lol, "lossless" conversion where one codec is lossy
    You missed the point. The point is, not to re-encode audio that has already been encoded in a lossy way. Re-encoding lossy audio with a lossy encoder, will reduce the quality of that audio. This kind of reduction of quality, can be avoided by lossless conversion.
    Quote Quote  
  5. ffmpeg -i input.m4a -c copy output.aac
    ffmpeg -i input.aac -c copy output.m4a
    Last edited by ProWo; 24th Jul 2020 at 06:58.
    Quote Quote  



Similar Threads