


Much appreciation to the Blender Foundation for graciously creating this clip and allowing it to be used for such purposes. I’ve included a 10-second segment of the Sintel film from Blender to simplify working along with the examples in this article. Please unzip the file, keeping all folders intact later scripts look for input files in folders other than where the script is located. You can download all of the scripts here. For this article, I’ll assume that you know the basics of FFmpeg programming for the Windows Command window, but are unfamiliar with Bash or PowerShell. Finally, I’ll show you how to store the output files in a separate custom folder-all for Bash and PowerShell. You’ll also learn how to apply this script to multiple files in a folder and how to customize file names with the source file and selected variables. With the new script, all of the adjustable parameters are on top, simplifying modification for testing and production. This is script2-variables.sh, which you can download here This simple Bash script produces the same output as the command string above. Into a script like the one shown in Figure 1 (below).įigure 1. Specifically, you’ll learn how to convert a command string like this:įfmpeg -y -i input.mp4 -c:v libx264 -vf scale=-1:1080 -b:v 3M -maxrate 6M -bufsize 6M -g 48 -preset ultrafast output.mp4 In this tutorial, you’ll learn how to create and run such scripts with PowerShell and Bash.

While you can’t use these scripts in the Windows Command window, you can use Microsoft PowerShell in Windows and Bash on Linux and the Mac. Using variables and “for loops” in a command string simplifies the reuse of existing scripts and helps automate their operation. Attempting to reuse that command line for different files or parameters is often an error-prone experience of searching, copying, and pasting and then rinsing and repeating to correct any missteps. Most FFmpeg users start by creating a simple static command line which, after much debugging, works just fine for the single input file and selected encoding parameters. You can find an introduction to FFmpeg encoding with downloadable scripts here. Its About page describes the command-line tool as “the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.” Capable of running on Linux, Mac OS X, Windows, and a range of other build environments, FFmpeg 5.1.2 is available for download at. FFmpeg was designed as a cross-platform solution for video and audio recording, conversion, and streaming.
