Tutorial

How To Convert Videos with FFMpeg On CentOS 6

Published on May 31, 2013
author

Bulat Khamitov

How To Convert Videos with FFMpeg On CentOS 6

Status: Deprecated

This article covers a version of CentOS that is no longer supported. If you are currently operating a server running CentOS 6, we highly recommend upgrading or migrating to a supported version of CentOS.

Reason: CentOS 6 reached end of life (EOL) on November 30th, 2020 and no longer receives security patches or updates. For this reason, this guide is no longer maintained.

See Instead:
This guide might still be useful as a reference, but may not work on other CentOS releases. If available, we strongly recommend using a guide written for the version of CentOS you are using.

FFMpeg is a popular program for converting and manipulating audio/video files.

We will need to spin up a CentOS 6.4 x64 cloud server:

Step 1 - Install ATRPMS Repository

rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms
rpm -ivh http://dl.atrpms.net/el6-x86_64/atrpms/stable/atrpms-repo-6-7.el6.x86_64.rpm

Step 2 - Install FFMpeg from ATRPMS Repository

yum -y --enablerepo=atrpms install ffmpeg

Verify that you have FFMpeg installed:

ffmpeg -version

To get a list of supported formats:

ffmpeg -formats

Step 3 - Convert your Videos

Once you have uploaded your video you can begin converting it to various formats.

For our example, we will download "Big Buck Bunny 720p MP4" video and convert it.

wget "http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_720p_surround.avi"

In 720p MP4 format this video is 317MB:

[root@FFMpeg ~]# ls -lah big_buck_bunny_720p_surround.avi 
-rw-r--r-- 1 root root 317M May  6  2008 big_buck_bunny_720p_surround.avi

Convert from MP4 to H264

ffmpeg -i big_buck_bunny_720p_surround.avi -vcodec libx264 big_buck_bunny_720p_surround-H264.avi

Once converted from MP4 to H264 this video is 118MB:

[root@FFMpeg ~]# ls -lah big_buck_bunny_720p_surround-H264.avi 
-rw-r--r-- 1 root root 118M May 30 23:40 big_buck_bunny_720p_surround-H264.avi

Convert from H264 to FLV

ffmpeg -i libx264 big_buck_bunny_720p_surround-H264.avi -vcodec libx264 -ar 44100 -f flv libx264 big_buck_bunny_720p_surround.flv

The FLV version is 102MB:

[root@FFMpeg ~]# ls -lah big_buck_bunny_720p_surround.flv 
-rw-r--r-- 1 root root 102M May 31 00:06 big_buck_bunny_720p_surround.flv

You can stream these files with JWPlayer as described in our next article.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about our products

About the authors
Default avatar
Bulat Khamitov

author

Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?
 
10 Comments


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

rpm --import http://packages.atrpms.net/RPM-GPG-KEY.atrpms returns

curl: (22) The requested URL returned error: 404 Not Found error: http://packages.atrpms.net/RPM-GPG-KEY.atrpms: import read failed(2).

I was selecting LAMP image and it was automatically changing it to Ubuntu. Now that I have built a new droplet with CentOS 7 I am getting this error:

–> Finished Dependency Resolution Error: Package: libavdevice55-2.2.1-65.el7.x86_64 (atrpms) Requires: libdc1394.so.22()(64bit) You could try using --skip-broken to work around the problem You could try running: rpm -Va --nofiles --nodigest

Hi, I am getting this error on a fresh server:

rpm -ivh http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm rpm: RPM should not be used directly install RPM packages, use Alien instead! rpm: However assuming you know what you are doing… Retrieving http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm error: Failed dependencies:

/bin/sh is needed by atrpms-repo-6-7.el6.x86_64

Please Help :(

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
July 12, 2014

@bjakin: I’ve updated the URL. Please try again, thanks!

curl: (22) The requested URL returned error: 404 Not Found ошибка: skipping http://dl.atrpms.net/all/atrpms-repo-6-7.el6.x86_64.rpm - transfer failed

Can you correct, please?

coming error list file /usr/lib64/libavutil.so.52 from install of libavutil52-2.0.2-61.el6.x86_64 conflicts with file from package ffmpeg-libs_1.1-1.1.5-2.el6.x86_64 file /usr/lib64/libavfilter.so.3 from install of libavfilter3-2.0.2-61.el6.x86_64 conflicts with file from package ffmpeg-libs_1.1-1.1.5-2.el6.x86_64 file /usr/lib64/libpostproc.so.52 from install of libpostproc52-2.0.2-61.el6.x86_64 conflicts with file from package ffmpeg-libs_1.1-1.1.5-2.el6.x86_64 file /usr/lib64/libswresample.so.0.17.102 from install of libswresample0-2.0.2-61.el6.x86_64 conflicts with file from package ffmpeg-libs_1.1-1.1.5-2.el6.x86_64 file /usr/lib64/libswscale.so.2 from install of libswscale2-2.0.2-61.el6.x86_64 conflicts with file from package ffmpeg-libs_1.1-1.1.5-2.el6.x86_64

Kamal Nasser
DigitalOcean Employee
DigitalOcean Employee badge
January 22, 2014

@aheihachi: I’ve corrected the links—please try again.

Retrieving http://dl.atrpms.net/all/atrpms-repo-6-6.el6.x86_64.rpm curl: (22) The requested URL returned error: 404 Not Found error: skipping http://dl.atrpms.net/all/atrpms-repo-6-6.el6.x86_64.rpm - transfer failed

Not working, you have to correct urls

Great help, exactly what I needed to install it. Thanks

libx264: No such file or directory

-vcodec libx264 ?

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more