Short Notes on ffmpeg

From PaskvilWiki
Jump to: navigation, search

The ffmpeg is probably the most versatile encoder/transcoder for video and audio. It supports every format there is, and some of those that do not exist ;-).

Rip DVD into FLV (or anything else)

This is trivial, just few parameters need tweaking, and is you wanna use mp3 for your FLV, you either wanna compile ffmpeg by hand, or - in Ubuntu - install extras for libavcodec - libavcoded-extra-53 in 11.10, and libavcoded-extra-52 in 11.04.

Of course, you may use any vcodec and acodec you want.

Then, all you have to do is:

cat /media/mydisk/VIDEO_TS/VTS_01_[1234].VOB | \
    ffmpeg -i - -s 640x480 -deinterlace -vcodec flv -acodec libmp3lame -vb 1500k -ab 128k -ar 44100 ~/output.flv

Still Image with Audio

To upload sound track to YouTube, you need to provide video file, not just audio.

With ffmpeg it's simple to create video with still image and audio track:

ffmpeg -loop 1 -i still-image.jpg -i audio-track.mp3 -vcodec libxvid -acodec libmp3lame -ab 128k -shortest video.avi

The important switch in the above command is the -shortest, that tells ffmpeg to stop encoding when "shorter" track ends, in this case the audio track; since input image is loop'ed, the encoding would go on forever otherwise.