File transcoding.. getting nerdy with it!

There are a plethora of tools out there for converting video files between various formats. Nine times out of ten, or maybe more like 9.777425215878 times out of 10 the underlying piece that makes this work is ffmpeg.

The sad thing is, a lot of these tools have a crippled free version that will give you a conversion of, say, five minutes max, unless you line their pockets. For what? For the gui.

Well.. GUI-Smoooey! FFmpeg is free, and it is able to transcode between a metric shit-ton of codecs, you don't need a gui for that, what you really need is a shell script, because often times you have a big old bunch of stuff to transcode as a batch job.

I've just written such a script, which is running presently, happily humming away in the background transcoding 106 MXF files to Prores 422 LT. All free. No fuss, no muss.. well ok, I had to tinker with the script a bit, but I'm sharing so YOU don't have to. :D

This will work on a mac or linux, for sure.. would likely work on Windows as well with cygwin or the like.

Here's the script:

Code:
#!/bin/bash
 
# These paths should either be relative to the current directory
# or full system paths.
 
SOURCE_PATH="Camera_Original"
DEST_PATH="Prores"
 
# wildcard for files to process
FILES="*.MXF"
 
# FFmpeg arguments/options
FFMPEG_OPT="-vcodec prores -profile:v 1 -acodec pcm_s16le"
 
# Container wrapper format (file extension, mov, avi, etc)
WRAPPER="mov"
 
# Verbosity level: quiet, panic, fatal, error, warning, info, verbose
VERBOSITY="warning"
 
 
######################################################
## DO NOT CHANGE BELOW THIS LINE  
######################################################
 
clear
for FILE in $SOURCE_PATH/$FILES
do
  FILENAME=$(basename "$FILE")
  CURRENT="${FILENAME%%.*}"
  echo "Processing $CURRENT..."
  ffmpeg -i $FILE $FFMPEG_OPT -v $VERBOSITY $DEST_PATH/$CURRENT.$WRAPPER
done

Suppose you wanted to transcode to prores proxies.. no problem, see where it says -profile:v 1 in the ffmpeg options line? change that to -profile:v 0. Want prores HQ? Change it to -profile:v 3

The rest of the info for various codecs and whatnot can be found in the ffmpeg documentation.
 
Last edited:
Back
Top