Hi there, im a total noob to using ffmpeg im wondering if anyone can help me to write a script for a .bat file that will batch extract the audio tracks from all the video files in a folder.
for example
i also want to write a script that will take those audio files and batch join them to video files that are the named the same.
for example if an video file was named "serial experiments lain S01E01" and the audio file was named the exact same the script would join both those files together.
and it would do that for all the files in a folder.
i want to do this without re encoding, just removing and re adding the files
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays! or rip iTunes movies!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
-
First thing you gotta do is to make Windows Explorer show the file extensions:
https://www.file-extensions.org/article/show-and-hide-file-extensions-in-windows-10
Then you gotta look inside the files to see what kind (format), how many and in which order the tracks are to see which ones you still need and what number they have. Otherwise you cannot write a batch file. You can use MediaInfo for that (I recommend setting View->Text for the text view).
Btw, I often find using mkvmerge for this easier. There are also GUIs for batch use: https://www.videohelp.com/software/MKVBatch
for %%a in (*.[VIDEO_FILE_EXTENSION]) do mkvmerge -o "output\%%~na.mkv" "%%a" "%%~na.[AUDIO_FILE_EXTENSION]" -
Batch script to extract/split audio and video
Code:@echo off :: set paths (no quotes) set ffmpeg=C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe set outfolder=D:\VideoProjects\work\_temp\split @echo. @echo on for %%f in (*.mp4) do "%ffmpeg%" -y ^ -hide_banner ^ -i "%%~dpnxf" -c:v copy -an ^ "%outfolder%\%%~nf-xtract.m4v" @echo off if errorlevel 1 pause @echo. @echo on for %%f in (*.mp4) do "%ffmpeg%" -y ^ -hide_banner ^ -i "%%~dpnxf" -vn -c:a copy ^ "%outfolder%\%%~nf-xtract.m4a" @echo off if errorlevel 1 pause @echo.
Code:@echo off :: set paths (no quotes) set ffmpeg=C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe set outfolder=D:\VideoProjects\work\_temp\joined @echo. @echo on for %%f in (*.m4v) do "%ffmpeg%" -y ^ -hide_banner ^ -i "%%~dpnxf" -i "%%~dpnf.m4a" ^ -c:v copy -c:a copy ^ -map 0:0 -map 1:0 -shortest ^ "%outfolder%\%%~nf-remux.mp4" @echo off if errorlevel 1 pause @echo.
Change outfolder to wherever you want.
Change the file extensions as needed.
Delete the -y if you want to get a warning before a file is overwritten.
I assumed output is to a temp folder and you don't care about that. -
@raffriff42
♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪ You're the champion, my friend ♫♪.ılılıll|̲̅̅●̲̅̅|̲̅̅=̲̅̅|̲̅̅●̲̅̅|llılılı.♫♪Last edited by remanyao; 20th Nov 2016 at 14:40.
-
Thanks for the help everybody, I'm going to try out some of your suggestions.
Similar Threads
-
How to batch convert/multiplex any files with ffmpeg
By Baldrick in forum User guidesReplies: 215Last Post: 1st Dec 2023, 12:38 -
Question how to batch download and merge these 248 .ts files
By jimdagys in forum Video Streaming DownloadingReplies: 2Last Post: 19th Nov 2016, 20:36 -
Need help with ffmpeg script to batch convert audio in MKV files
By mikeveli20 in forum AudioReplies: 5Last Post: 18th Nov 2016, 14:21 -
Having issues batch converting raw .264 cctv files with FFMPEG-
By raidecker22 in forum Video ConversionReplies: 11Last Post: 22nd Aug 2015, 15:58 -
Merge multiple audio tracks from different files into 1 video file - sync
By heinza in forum Newbie / General discussionsReplies: 2Last Post: 11th Jan 2012, 04:29