How to Install FFmpeg on Ubuntu 16.04 | 18.04 | 20.04

 

FFmpeg is a free and open-source venture comprising of a huge programming suite of libraries and projects for taking care of video, sound, and other media records and streams. At its center is simply the FFmpeg program, intended for order line-based handling of video and sound documents, and broadly utilized for group transcoding, essential altering, video scaling, video after creation impacts, and models consistence.

In this post, We will install FFmpeg on Ubuntu 16.04 | 18.04 | 20.04

Step 1: Add FFmpeg Repository

You need to add the FFmpeg repository by using the command by using the command.

$ sudo add-apt-repository ppa:jonathonf/ffmpeg-4

Step 2: Install FFmpeg

You need to update the current ubuntu repository and then you need to install FFmpeg package by using the command.

$ sudo apt-get update

$ sudo apt-get install ffmpeg -y

Step 3: Convert MP4 to HLS

You need to use the following command for that, In case you do not have any mp4 video right now, So you can download from internet the sample mp4 video for testing.

$ ffmpeg -i file_name.mp4 -codec: copy  -start_number 0 -hls_time 10 -hls_list_size 0 -f hls  file_name.m3u8



If you have mp4 generated from online streams so then, You need to use the following command to convert mp4 to HLS.

$ ffmpeg -i file_name.mp4 -codec: copy  -bsf:v h264_mp4toannexb  -start_number 0 -hls_time 10 -hls_list_size 0 -f hls  file_name.m3u8



How to Convert to MP4 1080p to 240p, 360p, 480p and 720p using FFmpeg cli.

# Convert To 240p

ffmpeg -i input.mp4 -s 426x240 -b:v 200k -vcodec libx264 -strict experimental -c:a aac -ar 96k output_240p.mp4



# Convert To 360p

ffmpeg -i input.mp4 -s 640x360 -b:v 300k -vcodec libx264 -strict experimental -c:a aac -ar 96k  output_360p.mp4



# Convert To 480p

ffmpeg -i input.mp4 -s 842x480  -b:v 400k -vcodec libx264 -strict experimental -c:a aac -ar 96k output_480p.mp4



# Convert To 720p

ffmpeg -i input.mp4 -s 1280x720 -b:v 720k -vcodec libx264 -strict experimental -c:a aac -ar 96k output_720p.mp4

How to Install FFmpeg on Ubuntu 16.04 | 18.04 | 20.04

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top