Edits for your social media can sometimes clash with your regular editing work and you end up investing the same resources and software. This is an overkill and sometimes it can be frustrating to manage the priorities.
The best solution to perform all your simple edits is FFMPEG. It is a command-line tool available for both Windows and performs different edits seamlessly.
You might find FFMPEG hard to install and use if you approach it directly. So, let’s make it simple for you by first installing the software.
Installing FFMPEG
The process to install FFMPEG differs with every operating system. So, let’s see how it is installed on each OS.
Installing FFMPEG on MAC
FFMPEG installation on MAC is the easiest. Here are the steps:
- You need to go to the Brew Website (https://brew.sh)
- There is a code provided on the page to install HOMEBREW. Copy it.
- On your MAC open terminal. To open Terminal do the following:
- Press the CMD and Spacebar together.
- A search window will open.
- In the search window type ‘terminal’
- You will see the app in the search list.
- Double-click on it and the terminal will open
- Paste the command you copied from HOMEBREW in the terminal and press enter.
- This will take a few minutes so you can work on your stuff while keeping Terminal in the background.
Installing FFMPEG on WINDOWS
Here are the steps to install FFMPEG on WINDOWS:
- Go to the download page of FFmpeg’s official website.
- Select the Windows Build.
- Choose the option as per the configuration of your computer.
- You get a zip file in your target location selected for Downloads.
- Unzip the file and a new folder is available.
- This folder has five files, including a file named “bin” where FFmpeg is saved.
- Now, locate and open control panel on your computer. You can read this blog to locate the control panel.
- Select System Choose Advanced tab in the System Properties interface.
- Click the Environment Variables button.
- Then click Edit.
- Paste the file path where FFmpeg is saved.
- FFMPEG is now available on the system.
How to open FFMPEG
Since FFMPEG is a command-line tool, you need to do the following:
Opening FFMPEG on MAC
You have to open the terminal to start FFMPEG. So, follow the same steps as mentioned above:
- Press the CMD and Spacebar together.
- A search window will open.
- In the search window type ‘terminal’
- You will see the app in the search list.
- Double-click on it and the terminal will open
- You are ready to use FFMPEG
Opening FFMPEG on WINDOWS
- Press Windows and ’R’ keys together
- This opens the ‘Run’ prompt
- Type ‘cmd’ and hit Enter
- The Command Prompt opens and you are ready to use FFMPEG
First Essential thing to do before using FFMPEG
The first thing you need to do is to reach the folder where you have the files to edit.
Let’s say you have the file named ‘input.mp4’ in a Directory called ‘EditWork’ in ‘Downloads’. So your command will be:
cd Downloads/EditWork
Quick Tip!
You can also use the autocomplete wizard in FFMPEG to reach a particular folder. Let’s say for the same example above just type ‘cd Dow’ and press ‘tab’. You will find that the path automatically moves to ‘cd Downloads/’ Now after that type ‘Ed’ and press tab again and you will reach the required directory. Let’s say you typed three initials but there are multiple directories with the same name, the command prompt or Terminal will display all available option and you can type the one you need.
Some Essential Edit Examples
Now that you have reached the said directory. We can work with some simple linear edit examples.
Burning the subtitles in the video
Let’s say the video you have is called input.mp4 and you have a subtitle file that you need to burn called ‘subtitles.srt’. Simply use the following command:
ffmpeg -i input.mp4 -filter:v subtitles=subtitles.srt output.mp4
This will create a video file named output.mp4 in the same directory that has the subtitles burnt. You will always have to give the output file name at the end of the command.
Note that this process will cause re-encoding as the subtitles are being burnt and will take some time. The time taken is dependent on the processor of your computer.
But the good thing is that you can hide the command line and continue with the rest of your work.
Editing out sections from your video
Let’s say you have a video called ‘input.mp4’ which has a duration of 190 seconds. You want to take chop off the initial 2 seconds and the last 10 seconds of the video. You can use the following command:
ffmpeg -ss 2 -i input.mp4 -c copy -t 178 Output.mp4
The initial number 2 is the number of seconds that you want to clip from the start.
And then since you have to chop another 10 seconds from the end, the remaining duration is (190-2-10) 178 seconds.
You can also make it frame-accurate as decimals in duration are allowed.
This edit is the fastest as there is no re-encoding involved. This edit should not take more than 2-5 seconds.
Adding Logo to your video
Sometimes when you have to use a clip form your mezzanine file on social media, you want to add a logo. Taking your clip back to the edit suite can be counterproductive.
We can add an overlay in FFMPEG to insert the logo.
Let’s say our logo file is named as ‘logo.png’ and we want to insert it on ‘input.mp4’. We can use the following command:
ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=x=0:y=0" output.mp4
x and y in the above command are the x and y coordinates/pixel positions.
As a rule of thumb, create a png file with the full-screen size of the video and the logo positioned properly. This makes you confident about the positioning of the logo which you can later match as well.
Mute the audio in specific sections of the video
There might be times when you need to mute the audio in certain sections of your video to avoid copyright infringement when uploading the clip to YouTube or other platforms. FFMPEG can be a very handy tool for muting the audio.
As an example, lets say in your video you need to mute audio in two sections: between 5-10s and 15-20s.
So the command to be used is:
ffmpeg -i input.mp4 -af "volume=enable='between(t,5,10)':volume=0, volume=enable='between(t,15,20)':volume=0" output.mp4
Concatenate or Stitch Files together
If you have multiple input files and want to stitch them together you can use the following command:
ffmpeg -i "concat:input1.mp4|input2.mp4|input3.mp4" -c copy output.mp4
Where input1.mp4, input2.mp4 and input3.mp4 are the three input files and they will be stitched one after the other to give you an output file output.mp4
Extracting sound from a video
Use the following command if you want to extract sound from a video and save it as a separate mp3 file:
ffmpeg -i input.mp4 -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3
The output file will be named sound.mp3
Bonus Tip!!
Above mentioned are some of the simplest actions that can be achieved using ffmpeg but it is a good way to get started. Once you are well versed with the command line editing and practice the commands, you can search online for complex edits, transitions and combination of edit commands as well. At least for your social media and slicing/dicing of existing content, you do not need to be dependent on your core editing team.
If you are interested in more video-editing actions using FFMPEG check this cool blog. It will provide you with1 19 different edit actions that can be performed using FFMPEG!!
Graphical User Interface
Some developers have also made free GUI available for FFMPEG for Windows and MAC. Here are some examples:
WINDOWS: https://www.videohelp.com/software/FFmpeg-Batch
MAC: https://macdownload.informer.com/ffmpegx/
You can use them for multiple bulk actions for your videos
Do you still have queries regarding ffmpeg or are not able to install/run it? Write to us at [email protected]and we will surely get in touch.