VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    I used a batch file to extract the audio from mp4 files which gave me a folder full of m4a files but I can't find a batch file or a program that will batch convert those m4a files to ac3.

    Here is the batch file I used to extract the m4a audio...

    Code:

    for %%a in ("*.mp4") do "C:\Program Files\Hybrid\64bit\ffmpeg.exe" -i %%a -vn -c:a copy -y downres\%%~na.m4a
    pause

    # this script extracts audio track only
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    A typical command line using FFmpeg would be something like
    Code:
    FFmpeg.exe -i "c:\path\file.m4a" -vn -c:a ac3  -ar 48000 -ab 256k -y out.ac3
    Use your BAT file as a model to create the new BAT file
    Last edited by davexnet; 3rd Sep 2023 at 20:33.
    Quote Quote  
  3. why not take the code from davexnet and convert all the mp4 to ac3.


    Code:
    for %%a in ("*.mp4") do "C:\Program Files\Hybrid\64bit\ffmpeg.exe" -i %%a -vn -c:a ac3  -ar 48000 -ab 256k -y downres\%%~na.ac3
    Quote Quote  
  4. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    Originally Posted by jack_666 View Post
    why not take the code from davexnet and convert all the mp4 to ac3.


    Code:
    for %%a in ("*.mp4") do "C:\Program Files\Hybrid\64bit\ffmpeg.exe" -i %%a -vn -c:a ac3  -ar 48000 -ab 256k -y downres\%%~na.ac3
    I'll try that.

    The batch file I used to make the m4a files was so I could use mp3gain to set the gain to 89dB which it had no problem doing. The problem, I just found out was that half the files that converted to m4a were about half the length of the mp4 files that I got the audio from.

    I've been using Audacity to normalize the audio and save as ac3 and it has created the files perfectly with no sync issues. It's just a slow process and I was looking for a faster way.

    I don't know why half the m4a files created by ffmpeg were so short since Audacity uses an ffmpeg plugin to create the ac3 files
    Quote Quote  
  5. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    Originally Posted by jack_666 View Post
    why not take the code from davexnet and convert all the mp4 to ac3.


    Code:
    for %%a in ("*.mp4") do "C:\Program Files\Hybrid\64bit\ffmpeg.exe" -i %%a -vn -c:a ac3  -ar 48000 -ab 256k -y downres\%%~na.ac3
    This bat file did the same thing. All my MP4s are 2:00 in length but the output files are 1:00 in length.
    Quote Quote  
  6. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Do the ac3 files play back twice as fast or they truncated?
    These are the kinds of details you should be thinking about
    Quote Quote  
  7. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    Originally Posted by davexnet View Post
    Do the ac3 files play back twice as fast or they truncated?
    These are the kinds of details you should be thinking about
    The 2nd folder I used the bat file on is fine. Something happened along the way through all the programs I used on the first folder trying to convert and normalize the audio. Most of the files are alright but a dozen or more of the original mp4 files got messed up. They were the first few files in the folder. All the files after that were alright.

    I'm using Virtualdub to add the ac3 files and everything is working fine. No sync issues so far.

    Thanks for your help.
    Quote Quote  
  8. Member
    Join Date
    Nov 2002
    Location
    United States
    Search Comp PM
    I ran into a few problems with that batch file but I found a great program call FFmpeg_Batch_AV_Converter.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!