How to convert YouTube video to mpeg

Posted: May 10, 2011 in Ubuntu
Tags: , ,

Hello folks.

You have seen in this post How to download videos from YouTube in Ubuntu. Now we will see how we can convert this kind of video to mpeg.

Here we will use the ffmepg. It has support for most existing file formats like AVI, MPEG, OGG, etc. and encoding formats like MPEG, DivX, MPEG4, etc.
However, if you don’t have mpeg supported in ffmpeg, see this post How to compile and install ffmpeg in Ubuntu 11.04 to enable it.

So, to convert the file is simple, open a terminal and run:

ffmpeg -i [file_name.flv] -ab 56k -ar 22050 -b 500k -s 320×240 [file_name.mpg]

Where:

[file_name.flv]: File name you would like to convert.
-ab: Audio bitrate in kbit/s. The default value is 64k.
-ar: Audio samplerate in Hz. The default value is 44100 Hz.
-b: Video bitrate in kbit/s. The default value is 200 kb/s.
-s: Frame size. The format is width x height and the default value is 160×128.
[file_name.mpg]: File name that will be generated.

For example, let’s use the file downloaded in the post How to download videos from YouTube in Ubuntu:

ffmpeg -i Fifa_World_Cup_2010.flv -ab 128k -ar 22050 -b 598k -s 288x352 video.mpg

If you don’t know the parameters you want to use, run the command below before to start the conversion.

ffmpeg -i Fifa_World_Cup_2010.flv

You will see something like that in the end:

Metadata:
duration : 221
starttime : 0
totalduration : 221
width : 352
height : 288
videodatarate : 462
audiodatarate : 123
totaldatarate : 593
framerate : 30
bytelength : 16421445
canseekontime : true
sourcedata : BD075F903MH1304802312229545
purl :
pmsg :
Duration: 00:03:41.18, start: 0.000000, bitrate: 598 kb/s
Stream #0.0: Video: h264 (Main), yuv420p, 352×288 [PAR 1:1 DAR 11:9], 472 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc
Stream #0.1: Audio: aac, 44100 Hz, stereo, s16, 126 kb/s
At least one output file must be specified

With that, you have some parameters that can be passed to convert the file.

That’s it. See you next time.

Advertisements
Comments
  1. Appreciation to my father who informed me regarding this web site, this blog is
    actually awesome.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s