Scope
The scope of this tutorial is to instruct the reader to be able to install FFmpeg on one’s desktop computer, and to introduce the navigation and use of its command line tool to convert a video file to another video format. While FFmpeg is crossplatform, the demonstration however will only cover Windows and Linux, this writer is using Windows 10 and Ubuntu 16.04 with administrator/superuser access and will refer to the operating systems as either Windows or Ubuntu for the remainder of the tutorial. The example will expand upon a simple conversion to a specific conversion from an h.264 codec .mp4 video to a more obscure Apple ProRes 422 codec .mov video such as might find in a television Adobe Premiere workflow, a codec encoding that, outside of FFmpeg, is supported only in Adobe Media Encoder for Mac specifically.
About FFmpeg
FFmpeg is an incredibly powerful, cross-platform, free, and open-source software tool for handling video, audio, and multimedia. Additional capabilities not covered in this video conversion tutorial are converting audio formats, merging separate video and audio into a single multimedia file, concatenating image frame sequences into videos, gif conversions, trimming or appending media files, applying adjustments, and recording input streams. Many other tools use FFmpeg as a backend operator to accomplish their own media tasks. separate, simplified graphical user interface (GUI) frontend applications exist for FFmpeg, but otherwise the tools from your installation are accessed only by typing commands into the text-only command line which require you to open up a terminal shell window, in Ubuntu the standard terminal client is Bash, in Windows it’s Command Prompt. The syntax and command line operators needed to wield more of the toolset can be simple or very specific for very specific jobs so so if you want to dig, ask your favorite search engine about your specific task or head to https://ffmpeg.org/ to learn more. A link to a list of useful commands is provided at the end of the tutorial.
Installing in Ubuntu
The fast way, featured here, involves using typing into the command line in a terminal window. Alternatively ask elsewhere about using a gui package manager like Synaptic Package Manager or Ubuntu Software.
Here are two ways to open a terminal window:
Simply press the Ctrl+Alt+T keys together.
Alternatively, right click on the desktop or in a file browser window and select “Open in Terminal” from the dropdown menu.
Now Type “sudo apt-get install ffmpeg” and press the Enter key. It’ll ask you to enter your superuser password, hit the enter key, then it’ll ask you to confirm the installation by typing “y” followed by the enter key, whereupon it’ll eventually complete and return a fresh empty command line.
Installing in Windows
As of this writing there’s still not an installer .exe or .msi but rather just a file folder directory that one downloads from https://ffmpeg.org/download.html, decompresses/unzips with a tool like 7-Zip, and places in an identifiable part of the file directory, like straight onto C:\ for example or another disk drive. We’ll remember this particular location later when choosing media files to work on.
Specifying File Locations in Ubuntu.
The user needs to specify the place in the file directory from which one is drawing source files and will place output files for command line operations. This can be accomplished by two methods two methods:
Open the terminal window with which we will be working from a right-click>open-in-terminal selection inside the window of the file browser open to the specified location.
Alternatively, inside the terminal navigate to the directory by typing “cd” followed by a space and then the file location, for example typing “cd /home/username/Videos” for something in my home library or “cd/ media/username/numberstring” for a specific hard drive mounted to the file system . the precise path directory for any given location can be retrieved from a couple methods.
In an active file browser window press Ctrl+L keys together thus furnishing the location at the title bar.
Alternatively, the location can be retrieved by right clicking, selecting “Properties,” and then copying from the location section and adding the folder name.
Clipboard operations in the the terminal are performed by adding the Shift key to whatever key combination would otherwise be used, for example Ctrl+V for paste instead needs to be Shift+Ctrl+V inside the terminal window.
Terminal commands to FFmpeg can now apply to files in this part of the file directory and deposit generated files alongside them.
Specifying File Locations in Windows.
To open a terminal window in we will cursor navigate on the desktop to the Windows menu button, then to “Windows System”, then we choose “Command Prompt” from the list. Depending on on your particular system permissions you might need to rightclick “Command Prompt and specify “Run as Administrator” instead of a regular left click. In Windows with the particular non-installed installation, the directory from which one is drawing source files and will place output files for command line operations will be “/FFmpeg/bin” the same folder location as the executables inside the package bundle we uncompressed and placed on our file system.
If the file folder package was placed directly onto C:/, which Command Prompt will indicate has been defaulted to, the command we type the change the directory to our place of operation is simply “cd /FFmpeg/bin.”
If instead the file folder package was placed onto another disk drive such as D:/ then we will first specify the new base drive by typing “cd /d” followed by a space and the new disk letter and a colon, so in this case type “cd /d d:” and then we get to specify “cd /FFmpeg/bin”.
Simple File Format Convert
In our terminal window in the correct directory, simply type “ffmpeg -i inputfile.mp4 outputfile.mov”. The file following the -i is our input, the other file the output. Hit “Enter” and provided you typed correctly it’ll churn until it’s done and you have a fresh command line.
Very Specific Codec File Format Conversion
Four separate quality gradations exist for that the Apple ProRes 422 codec, and it took a bit of back and forth to determine which particular output matched the file size expectations of the client for a similar length video exported under officially supported Macintosh Adobe software regime. Strictly speaking that’s not a reliable judge because image density and movement and such all affect file size. I can’t tell a difference between the settings. The useful commands and parameters and syntax ultimately turned out to be “ffmpeg -i inputfile.mp4 -c:v prores profile:v 2 outputfile.mov”
One might be rightfully bothered by the possible artifacting resulting from converting a lossy format to another lossy format instead of directly converting a rendered .png or .tiff image sequence to the destination format (totally an option by the way). However with respect to the quality of .mov codecs in particular, the following joke was related to me:
Q: How do you tell that an elephant has been inside your refrigerator?
A: Footprints in the butter.
A list of useful FFmpeg commands
https://www.labnol.org/internet/useful-ffmpeg-commands/28490/