Batch convert a number of MP4's with a lower bitrate

Questions involving a Windows version of FFmpeg.
Post Reply
Posts: 1
Joined: Sat Apr 06, 2019 4:08 pm

Batch convert a number of MP4's with a lower bitrate

Post by NickPetGamer » Sat Apr 06, 2019 5:13 pm

First off I am straight out admit I'm a n00b. I've tried and failed at using the FFMPEG documentation to write my own code and have gone to huddle in the corner using GUI's.

However, each of the software options have had deficiencies in one way or another.

The software that closest meets my needs is called 'FFE FFMPEG'.

I can use it to encode C:\CONVERT\input.mp4 to C:\RECODED\output.mp4 whilst reducing the bitrate to 16000kbps, and setting a constant 25fps.

This leaves me the following:

Code: Select all

ffmpeg.exe  -i "C:\CONVERT\input.mp4" -vcodec mpeg4   -an  -b:v 16000K -r 25 "C:\RECODED\output.mp4
However this doesn't allow me to convert en masse?

What command is required to batch convert a stack of MP4's in one folder, and place them in a new one with the lower filesize (or at least give the files a different name so I don't overwrite the originals).

Thanks in advance!!!

Posts: 10
Joined: Sun Apr 28, 2019 10:31 pm

Re: Batch convert a number of MP4's with a lower bitrate

Post by at2010 » Tue Apr 30, 2019 10:03 pm

This is a basic PowerShell script do batch converts as requested:

Code: Select all

  [string]$inputDir = "C:\CONVERT",
  [string]$outputDir = "C:\RECODED"  
foreach ($iFile in Get-ChildItem -Path $inputDir -File) {
	$i = Join-Path $inputDir -ChildPath $ifile
	$o = Join-Path $outputDir -ChildPath ([io.path]::GetFileNameWithoutExtension($ifile) + ".mp4")
	ffmpeg.exe -hide_banner -i "$i" -vcodec mpeg4  -an  -b:v 16000k -r 25 "$o"
Note: There is no error checking!
Copy code and paste into file (e.g. convert.ps1) put file in a folder that is in, or can be added to $PATH.
run "convert" from Powershell window or invoke using "powershell convert" in a Command window.
The Param() block allows you to change the input and/or output folders from the command line.
convert -i "C:\otherfolder" -o "c:\outputfolder".

About your ffmpeg line, I have a few suggestions. 1) You use mpeg4 as the encoding codec. This is generally associated with XVID, DIVX (.avi) files. If you meant to use AVC h.264 then specify libx264 as the encoder instead. AVC video and AAC audio are typical for .mp4 files.
2) The bitrate of 16000k is quite high. Very good quality 1080p AVC h.264 video can be rendered at say 6000k or less.

Posts: 4
Joined: Thu May 02, 2019 3:47 pm

Re: Batch convert a number of MP4's with a lower bitrate

Post by MeisterKnobi » Thu May 02, 2019 4:51 pm

Your Goal could be achived throug some batchskriptig, but im not firm in it either.
An other Solution would be make your command, paste it in notepad++. STRG+D duplicate your line and via Column edit [ALT+Select via mouse) you can edit the episode numer or so. I have allways an file open with 01,02,03,04, ect open and can just paste it. Imported is to copy this also via column edit.

Post Reply