How to make batch processing a heap of folders with files inside them on the bat/cmd?

Good day!
The task of the next... There are 20 folders, they are only video files. You want to crawl each folder and use ffmpeg every file within the folder to convert to another format and keep close to the original.
I suffer with nested for loops can't resaltando task. It is important to implement it under windows 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"
)

)
March 19th 20 at 08:51
1 answer
March 19th 20 at 08:53
Solution
For the second you need to be files, not directories - remove /r ".\"
Thank you very much, it worked!!! - Devyn_Champlin76 commented on March 19th 20 at 08:56

Find more questions by tags Batch processingFFmpegcmd/bat