run ffmpeg on a folder and all if it’s subfolders, converting only certain video types
I would like to use ffmpeg to convert the entire content of a folder with all of it’s subfolders, but only targeting videos with the formats .mpg, .avi and .vob.
Moreover, I want the output folders to be the same as the input folders and the output name to be the same as the input name, but the output file extension of course to be .mp4.
I tried writing a batch script to do so, but to no avail.
Any ideas? Anything could help.
@echo off
setlocal enabledelayedexpansion
set "source_folder=C:\path\to\source\folder"
for /r "%source_folder%" %%F in (*.avi *.mpg *.vob) do (
set "output_file=%%~dpnF.mp4"
ffmpeg -i "%%F" -c:v libx264 -c:a aac -strict experimental -b:a 192k "!output_file!")
Read more here: Source link