VideoHelp Forum
+ Reply to Thread
Results 1 to 4 of 4
Thread
  1. Member
    Join Date: Aug 2010
    Location: Indian Ocean
    Search Comp PM
    So, I have a folder "C:\Original" with a few dozens mp4 files.

    What I would like to do is :

    1) batch demux only their audio streams to "C:\Original\downres\", without changing the original name.

    So for example "C:\Original\somefile.mp4" yields "C:\Original\downres\somefile.aac"


    2) batch mux every pair of *.aac and corresponding *.264 files found in the folder "C:\Original\downres\"

    Example : "C:\Original\downres\randomxyz.aac" and "C:\Original\downres\randomxyz.264" are muxed to "C:\Original\downres\randomxyz.mp4"


    I hope that makes sense, I would prefer two separate bat files if that's possible.
    Quote Quote  
  2. Member racer-x's Avatar
    Join Date: Mar 2003
    Location: 3rd Rock from the Sun
    Search Comp PM
    Batch audio extraction is easy with ffmpeg. Create a folder called "downres" in the same directory as your mp4 files, then simply dag the first mp4 into this bat file:
    Code:
    for %%a in ("*.mp4") do "path\to\ffmpeg" -i %%a -vn -c:a copy -y downres\%%~na.m4a
    pause
    
    # this script extracts audio track only
    The memories of a man in his old age, are the deeds of the man in his prime.......
    Quote Quote  
  3. I'm a MEGA Super Moderator Baldrick's Avatar
    Join Date: Aug 2000
    Location: Sweden
    Search Comp PM
    Try
    1.
    Code:
    for %%a in ("C:\Original\*.mp4") do ffmpeg -i "c:\Original\%%a" -vn -acodec copy "c:\Original\downres\%%~na.aac"
    pause
    2.
    Code:
    for %%a in ("C:\Original\downres\*.aac") do ffmpeg  -i  "c:\Original\downres\%%~na.264" -i  "c:\Original\downres\%%~na.aac" -vcodec copy -acodec copy "c:\Original\downres\%%~na.mp4"
    pause

    See also http://forum.videohelp.com/threads/356314-How-to-batch-convert-multiplex-any-files-with-ffmpeg
    Quote Quote  
  4. Member
    Join Date: Aug 2010
    Location: Indian Ocean
    Search Comp PM
    Thank you both very much, racer-x and Baldrick, the scripts worked like a charm. I'm very impresssed
    Quote Quote