A
A
Alexander2019-03-27 16:36:15
cmd/bat
Alexander, 2019-03-27 16:36:15

How to batch process a bunch of folders with files inside them on bat/cmd?

Good afternoon!
The task is the following... There are 20 folders, they contain only video files. You need to go through each folder and use ffmpeg to convert each file inside the folder into a different format and leave it next to the original.
I'm struggling with nested for loops and can't solve this problem. It is important to implement this under windows on bat/cmd
@echo off
for /r ".\" /d %%i in (*) do (
for /r ".\" %%a in ("%%i\*") do (
ffmpeg.exe -i "%%a" -threads 0 -vcodec libx264 -b:v 3000k -profile:v main -preset:v medium -level 3.1 -acodec aac -ab 256k -ar 48000 -ac 2 -f mp4 "%%i\%%~na.mp4"
)
)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
res2001, 2019-03-27
@xlarin

The second for should be by files, not by directories - remove /r ".\"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question