newloha.blogg.se

Ffmpeg windows batch processing
Ffmpeg windows batch processing










ffmpeg windows batch processing

It will accept multiple files or folders being dragged and dropped. Armed with my own compile of FFmpeg, I created a drag & drop batch script to recursively work through a folder structure transcoding MP3 and WAV files and writing out the resulting MP3 files in the same folder structure with an amended top level folder name. FFmpeg can do this nicely using libmp3lame, whereas LAME by itself cannot. Having experimented to find more appropriate LAME encoder settings for spoken word content I needed to transcode the files whilst keeping the existing ID3 tags intact.

ffmpeg windows batch processing

Anyway, thanks again.I recently had to shrink around 50GB of MP3 audio recordings that were sitting in a nested folder structure on a web server. I opened the batch file in notepad, deleted the (alleged) hyphens and replaced them with hyphens from within notepad, and it all works as planned! And you're right, I did create the original in a Word doc and copied it over to notepad before saving to a bat file.Īll these years and I've never run across that odd problem before. If you open the batch file in a hex editor you should see the difference between the two hyphens (or scroll up to your original post and see the -i is visibly different than -c).

#Ffmpeg windows batch processing code#

It is likely you either edited the batch file in a word processor that replaced the hyphen with something else, or copied and pasted example code from someone who did. As long as you re-key the batch file in a plain text editor, including Notepad, that is what you will get. You want a plain old hyphen, ASCII code 45. Is the hyphen in the numeric keypad a differently-coded hyphen? Can you elaborate on what you mean by a plain hyphen? I just used the key right of the number 0 on a standard keypad. This is an interesting thought since the hyphen before the c in -c:v seems to trigger something in the error message. You might also want to remove them from around the mux portion as well. With the quotes you are passing "filename.wav" (the quotes are included with the filename) to ffmpeg and maybe the application doesn't want to see the quotes.

ffmpeg windows batch processing

i %%~na.avi -i %%~na.wav and see what happens.

ffmpeg windows batch processing

My first suggestion would be to remove the double quotes from the first two items after the -i. The %%~na gives you the filename without the file extension (i.e., if the filename was "bob.txt", it gives you "bob"). You are doing a for loop and looking for files with a "avi" extension then when each one is found you are executing the ffmpeg command. As others said, I would move to powershell for the long term. When I run the batch file, the error that ffmpeg gives isn't clear but it seems to have to do with the "%%~na." stuff in double quote.īeen a while since doing batch files. I'm not sure if my problem is with FFMPEG syntax or batch file syntax. The desire is to multiplex all the avi/wav pairs into a single combined mkv file, and to do that for all the pairs in this directory, and write the resulting mkv file into a subdirectory called muxed.įor %%a in ("*.avi") do ffmpeg-4-2-1 -i "%%~na.avi" -i "%%~na.wav" –c:v copy –c:a aac –b:a 256k "muxed\%%~na.mkv" The video isn't being changed but the audio is being transcoded to aac, and the mkv container, from what I've read, is a good general-purpose container that accepts pretty much anything. I have the ffmpeg executable (version 4.2.1, which is the latest) in the same directory as the avi/wav file pairs. The avi doesn't have embedded audio (audio was created separately in a PCM wav file of the same name). I'm trying to run a batch file from a directory that has multiple file pairs of the form video1.avi & video1.wav video2.avi & video2.wav etc.












Ffmpeg windows batch processing