downsizing multiple mpg files using ffmpeg.exe

Viewed 35

I'm using ffmpeg.exe to process screen captures for a demo using MS Game Bar. Game Bar captures at a high frame rate at high resolution and the files are very large.

Using ffmpeg.exe I can process the files using:

ffmpeg.exe -i file.mpg file_l.mpg

And all is good but I'd like to create a bat file so I can do half a dozen or any in a folder all at once.

My Windows bat skills are poor and I've been trying to get it to work using something like this without success:

for %%f in (*.mp4) do (
  ren %%~nf%%~xf !fileNum!%%~xf
  set/a fileNum += 1

Can anyone help please

1 Answers

here's one I've used that can perhaps be adapted to meet your needs.

SETLOCAL EnableDelayedExpansion

:: start loop
for %%G in (*.mp3) do (
:: get filename without extension
set OUTPUT=%%~nG
:: pass filename to FFmpeg output
ffmpeg -i %%G !OUTPUT!.wav
:: delete source file
del %%G
)

if your input format and output format are the same, you can do something like this:

SETLOCAL EnableDelayedExpansion

:: start loop
for %%G in (*.mp3) do (
:: get filename with extension
set MYNAME=%%~nxG
:: create temp name
ren !MYNAME! delete1.mp3
:: pass original filename to FFmpeg output
ffmpeg -i delete1.mp3 !MYNAME!
:: delete temp file
del delete1.mp3
)
Related