FFmpeg - How to Use FFmpeg to Edit and Convert Videos

By Aug 24,2017 14:45 pm

FFmpeg is a cross-platform solution to record, convert and edit audio and video. It is a command line tool to convert one video file format to another. However, you could also find a FFmpeg GUI for user-friendly video editing. In this article, we will show you how to use FFmpeg for daily tasks on both Linux and Windows.

Many users may find FFmpeg program hard to interpret, and want some easy and quick editing application. If this is your case, Wondershare Filmoracomes a handy FFmpeg alternative to help you create home movies in minutes. It has a very intuitive interface and includes all common editing features you may need. When you crop, trim, rotate, add transitions, effects, intro/credits, etc. on Timeline, you can conveniently check any changes in the real-time previewing window. Below is the primary window screenshot.

Download Win Version Download Mac Version

How to Use FFmpeg to Edit and Convert Videos

How to Install FFmpeg Command Line Tool in Windows

resize video

Download FFmpeg and uncompress files to a folder, e.g. D:/temp/. Then copy /bin/ffmpeg.exe to X:/Windows/system32/ffmpeg.exe (X is your windows system drive, usually C:/). Thereafter, you can run FFmpeg in command line. To do so, go through Start/Run and enter cmd in the Run dialog box. When cmd opens, input FFmpeg. If FFmpeg version and other information show up, you installed FFmpeg on your Windows system successfully.

Note: You get helps by typing "FFmpeg -h | more" to get help, or read next session for daily video editing tasks.

How to Install FFmpeg Command Line Tool on Linux

What you should know before installing FFmpeg on Linux - FFmpeg requires many modules for general usages. If FFmpeg doesn't work well, fix it by installing correct module, including LAME MP3 Codec, mplayer, libogg, libvorbis, etc. Now, follow these steps to install FFmpeg to your Linux system.

1. Download modules

cd /usr/local/src/
wget www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz

2. Extract modules

tar zxvf lame-3.97.tar.gz
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar jxvf essential-20061022.tar.bz2
mkdir /usr/local/lib/codecs/
yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran subversion ruby ncurses-devel -y

3. Update FFmpeg and mplayer

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd /usr/local/src/mplayer
svn update
cd /usr/local/src/
mv /usr/local/src/essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

4. Install Modules

Install LAME:

cd /usr/local/src/lame-3.97
make && make install

Install LIBOGG

cd /usr/local/src/
cd /usr/local/src/libogg-1.1.3
./configure --enable-shared && make && make install


cd /usr/local/src/libvorbis-1.1.2
./configure && make && make install

Install mplayer

cd /usr/local/src/
cd /usr/local/src/mplayer
./configure && make && make install

Install FFmpeg:

cd /usr/local/src/FFmpeg/
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
make install

export LD_LIBRARY_PATH=/usr/local/lib/

ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49

ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51

FFmpeg Examples for Daily Video Editing Tasks

Convert .avi video to .mpg and any other formats by typing desired formats, say wmv, mp4, mkv, flv, etc.
FFmpeg -i source_video.avi final_video.mpg

Convert a video for the iPod/iPhone using FFmpeg
FFmpeg -i source_video.avi input -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X final_video.mp4

Convert a video for the PSP using FFmpeg
FFmpeg -i source_video.avi -b 300 -s 320x240 -vcodec xvid -ab 32 -ar 24000 -acodec aac final_video.mp4

Extracting sound from a video, and save it as MP3 using FFmpeg
FFmpeg -i source_video.avi -vn -ar 44100 -ac 2 -ab 192 -f mp3 sound.mp3

Convert video to image sequences using FFmpeg
FFmpeg -i video.mpg image%d.jpg

Convert video to animated gif(uncompressed) using FFmpeg
FFmpeg -i source_video.avi gif_animated.gif

Split/Trim video using FFmpeg
FFmpeg -i source_video.mpg -ss 00:00:10 -t 00:00:30 final_video.mpg

Merge video files and convert to desired formats
copy /b source_video1.mp4 + source_video2.mp4 out.mp4 | FFmpeg -i out.mp4 -sameq final_video.mpg

Related Articles


Product-related questions? Speak directly to our Support Team >>

• Hot video editors on the market
1.1 Avidemux
1.2 Sony Vegas VS Adobe Premiere
1.3 Final Cut Pro for Windows
1.4 Adobe After Effects
1.5 Ffmpeg
1.6 Windows Live Movie Maker
1.7 GoPro Studio