Skip to content

Instantly share code, notes, and snippets.

@sergiobd
Last active June 12, 2024 13:40
Show Gist options
  • Save sergiobd/95403ea3087373b661c3b72b59d75eb0 to your computer and use it in GitHub Desktop.
Save sergiobd/95403ea3087373b661c3b72b59d75eb0 to your computer and use it in GitHub Desktop.
Batch convert videos using ffmpeg and powershell
# Script to convert a list of files using ffmpeg and powershell. This example converts to .ogv files (theora/vorbis as video/audio codecs)
# Please note that, if you havent done so, you should set the execution policy of powershell in order to be able to run this script.
# The easiest way to run this script without messing to much with execution policies is to set it for a single powershell session:
# powershell.exe -ExecutionPolicy Unrestricted
# Check: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies
$filenames = "1","2", "3", "4", "5","6","7"
$filepath = "C:\Users\Oculus\Documents\Videos\Menu\"
$extension = ".mp4"
ForEach( $file in $filenames){
#Convert using ffmpeg
ffmpeg -i $filepath$file$extension -codec:v libtheora -qscale:v 7 -codec:a libvorbis -qscale:a 5 $filepath$file.ogv
}
@ChobbleGobbler
Copy link

Created an account just to say Thank You!

This bit of code was just what I needed to start batch encoding. 😊

@sergiobd
Copy link
Author

Glad you found it useful!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment