ffmpeg tips

NOTE: ffmpeg has been replaced by avconv, but commands below might apply to avconv as well.

Change the frame rate of videos
Example: convert a video file with any frame rate to a video file with 30 fps (frames per second)

$ ffmpeg -i inputfile.mp4 -r 30 -vcodec copy -acodec copy outputfile.mp4

Format videos for Vimeo upload
Use the following command

$ ffmpeg -i inputvideo.avi -vcodec libx264 -r 30 -b 5000k -s 1280x720 outputvideo.mp4

You will need the libx264 codec. For that purpose, install libavformat-extra-53 (Ubuntu 12.04).

You may have to convert the audio as well. If so, add the following:

$ -acodec libvo_aacenc -ab 192k

libvo_aacenc is installed with libavformat-extra-53

Split a video

$ ffmpeg -i inputvideo.avi -vcodec copy -acodec copy -ss 00:00:00 -t 00:30:00 output1.avi

Format videos for Windows movie player
Use the following command

$ ffmpeg -i infile -vcodec wmv2 -sameq -acodec wmav2 outfile.asf

Convert ogg to mp3
Make sure you have libavcodec-extra-53 installed. Then type

$ ffmpeg -i file.ogg file.mp3

Unfortunately, ffmpeg produces layer-2-mp3, which my mp3-player isn’t able to read.

Leave a Reply

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