Basic Video Transcoding Options in FFmpeg

Here are some of the basic video options that you might need frequently while using ffmpeg on various video files. For the transonding options of an audio file, refer this article. And you might get some help regarding basic FFmpeg here.

Set the bitrate of a video file using FFmpeg

-b <value> This options sets the bitrate of a video file. e.g.

[shredder12]$ ffmpeg -i input.avi -b 200k output.avi

Set the Frame rate of a video file

-r <value> This option is used to set the frame rate.

Set the size or resolution of a video file

-s <resolution> is used to specify the resolution of the output file. The basic syntax is

[shredder12]$ ffmpeg -i input.avi  -s 1024x768 output.avi

You can even use abbreviations in place of the actual resolution. e.g "-s xga" in place of 1024x768 above. You can find more about the abbreviations here.

Set the aspect ratio

-aspect <ratio> is used to specify the aspect ratio of the output file. A common usage could be.

[shredder12]$ ffmpeg -i input.avi -aspect 4:3 output.avi

In order to get this ratio, the video will be stretched either along the width or the height.

Howto cropping and padding videos using FFmpeg

Refer these articles for cropping and padding.

Remove the video recording or stream from a media file.

-vn This option ensures that there is no video stream in the output file and also all the video related options are negated.

Specify video codec to be used by FFmpeg

-vcodec <codec> This is similar to the audio codec option "acodec". Specify the codec you want to use for video transcoding and FFmpeg will use it. The default codec is based upon the output file format.

Well, if you are not looking for a specific codec then I would suggest you to go for open video format theora. This format doesn't have any legal crap and is pretty good too. You can do the conversion like this.

[shredder12]$ ffmpeg -i input.avi  -vcodec libtheora output.ogv

Althoug, you don't have to mention the video codec until you are using the proper format. You can find a little more about video conversion here.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Use syntax $$latex$$ to insert LaTeX formulas.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.
  • Search Engines will index and follow ONLY links to allowed domains.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.