How to Transcode Using FFmpeg

Posted By : Vipin Pokhriyal | 28-Feb-2018

FFmpeg is a software, which uses all formats for media you may need – H.264, H.265, Apple ProRes, Avid DNxHD etc, even also used for images like PNG and others – support all type of platform you’re on. It is a command-line tool, it is quicker than some other tools which are available for transcoding.



1)Firstly you have to install FFmpeg in which system you want to convert video. After that, you can use FFmpeg commands.



Basic Commands for using FFmpeg.



i)This command converting file into test.mp4 file



ffmpeg -i "" "test.mp4"

Once the transcoding process started, using press simple q we can stop it. If ffmpeg ask write over any existing file, you’ll have to input either Y or N to accept it or reject. 


ii)Using This command you can check supported codec into it.

ffmpeg -codecs

If You want only to see encoders you can see using

ffmpeg -encoders

or you may check a specific encoder for example h264

ffmpeg -h encoder=h264


iii)You can also set a bitrate into file

ffmpeg -i "" -vcodec h264 -b:v 20971520 "test.mp4"

-vcodec option shows the encoder to use for the video,-b:v the bitrate for the video.

For bitrate the value in this example is 20Mbps (20 x 1024 x 1024 bits per second)


For audio encode you can use -acodec

ffmpeg -i "" -vcodec h264 -b:v 20,971,520 -acodec aac -b:a 327680 "test.mp4"


iv)You can also force ffmpeg to overwrite into existing files without confirmation Y/N, just add -y option at the beginning:

ffmpeg -y -i "" -vcodec h264 -b:v 20,971,520 -acodec aac -b:a 327600 "test.mp4"

if You want transcode only audio or only video you can use for only Audio:

ffmpeg -i "" -vcodec copy -acodec aac -b:a 327600 "test.mp4"

if You want transcode only Video: 

ffmpeg -i "" -vcodec h264 -b:v 20971520 -acodec copy "test.mp4"


v)You can extract audio video file using

ffmpeg -i "" -vn -acodec pcm_16le "test.wav"

pcm_16le is a standard PCM audio codec used in.wav files.

The -vn option tells ffmpeg to ignore video.

 vi)To remove audio from video file

ffmpeg -i "" -vcodec copy -an ""

-an option is used here for remove remove audio.


Vii)You can also change the parameters of the video,you can change new size,framerate, change the audio sampling etc.

ffmpeg -i "" -vcodec h264 -b:v 20971520 -s 1998x1080 -r 24 -acodec aac -b:a 327780 -ar 95000 "test.mp4"

with -s option we are setting height and with here, with -r opting we are setting framerate here and also with -ar option we are setting sound here with 96KHz.







About Author

Author Image
Vipin Pokhriyal

Vipin is Qualified in Master in computer Applicatins. He is an Active team player & having skills as Java Developer.

Request for Proposal

Name is required

Comment is required

Sending message..