FFmpeg Tips and Tricks

“FFmpeg” is a free software and is licensed under the LGPL or GPL depending on your choice of configuration options. It does various extraordinary tasks like Convert Pictures To Movie, Audio and video conversions, audio extraction and lot more.

FFmpeg supports most of the popular formats, we don’t need to worry a lot about that. Formats supported by FFmpeg include MPEG, MPEG-4 (Divx), ASF, AVI, Real Audio/Video and Quicktime. To see a list of all the codecs/formats supported by FFmpeg, run the following command:
$ ffmpeg -formats

Audio Conversion
source.wav and want to convert it in a mp3.
$ ffmpeg -i source.wav target.mp3
(-i is input file)

remove 30 seconds from the beginning of an mp3 file but keep the rest
$ ffmpeg -ss 30 -acodec copy -i source.mp3 target.mp3
(-ss position Seek to given time position in seconds)

crop to the first 30 seconds of an mp3 file
$ ffmpeg -t 30 -acodec copy -i source.mp3 target.mp3
(-t duration Restrict the transcoded/captured video sequence to the duration specified in seconds)

Video Conversion
basic usage
$ ffmpeg -i my_video.mpeg -s 800×600 my_video.flv
(-s ‘size’ set video resolution size [Width x Height])

Extract images from a video
extract some images from a movie, and ffmpeg can do this easily
$ ffmpeg -i video.mpg image%d.jpg
(This will create 25 images for every 1 second, but it may serve us to have more or less images, this can be achieved with the parameter -r
-r fps Set frame rate [default 25])

$ ffmpeg -i video.mpg -r 1 image%d.jpg
(With this command you’ll get 1 image for every second)

This command will take 25 images images every second beginning at the tenth second, and continuing for 5 seconds
$ ffmpeg -i video.mpg -r 25 -ss 00:00:10 -t 00:00:05 images%05d.png
(-ss & -t has “hh:mm:ss[.xxx]” syntax is supported)

Extract audio from a video
we can extract an mp3 track from a video
$ ffmpeg -i video.avi -f mp3 audio.mp3
(-f fmt Force the format)

it’s also possible to use the option to disable video capture
$ ffmpeg -i video.avi -vn audio.mp3
(-vn Disable video recording)

Convert images to movie
Let say you have a lot of images named `img001.jpg’, `img002.jpg’ and so on in sequence, you can convert them into a movie with this command
$ ffmpeg -f image2 -i img%d.jpg video.mpg

Disassemble a video clip to images
$ ffmpeg -i video.mpg image%d.jpg

Project site with documentation http://www.ffmpeg.org/ffmpeg-doc.html

jonboy60

I’m a Malaysian, my name is Jon Loh (jonboy60) living in Kuala Lumpur and working in Petaling Jaya, Malaysia. Jonboy60.com is a blog magazine about Linux and other open source softwares. All about to a daily jobs or real life experiences I had since the year 2002 administrating Linux and Windows server in a hosting company. Basically i will be offering Linux tips, howto, tricks, latest news and tutorial. Contact Me for Career opportunities, business offers, Linux solutions for business or home, web and email server solutions, Linux consulting and expertise requests. Email to me on jonboy60{@}gmail.com. The site I’m running is VenCouture.com – Malaysia Online Fashion Shopping Boutique, VenCouture. We sell fashion clothes, sexy lingeries, baby clothing and etc.

More PostsWebsite

Follow Me:
TwitterFacebook

Leave a Reply

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

Connect with Facebook

*


− 4 = 2

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge