NEWS CATEGORIES:



NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
Home / News / Linux / Ubuntu Tips and Tricks

Ubuntu Tips and Tricks


Convert YouTube FLV Videos to MPG or AVI

How to download and convert Flash Videos from YouTube into MPG or AVI in Ubuntu.

By Mihai Marinof, Linux Editor

21st of February 2007, 11:33 GMT

Adjust text size:


Every once in a while, you may come across some videos on YouTube-the popular free video sharing service. You may enjoy the videos more or less but sometimes, just sometimes, you come across a video you really need to have on your hard drive and to watch over and over again, every time you feel the need. Unfortunately, YouTube seems to discourage its users from downloading the videos. This can get rather annoying because you'll need to save a bookmark with the video url, load it in your browser every time you want to re-watch it, wait until it's loaded and so on. So why get through all this trouble, when you can easily download the file in Flash Video format (FLV), convert it into mpeg4 or xvid video with mp3 audio and watch it on your PC or even on your mobile phone?

However, the standard ffmpeg package is pretty useless since it doesn't offer support for mp3 so you'll have to go through a painful process first in order to encode your videos with mp3 audio. Before we start, your Ubuntu system needs to have the c compilers, patch tools and standard devel packages installed. It also needs to have multiverse and universe repositories enabled. And to make things easier, you'll need to have a password on the root account. As this is the easiest part, we'll start with it. Open a terminal and type:
CODE
$ sudo passwd root

Enter a password and switch to the super user account by typing:
CODE
$ su -

You will now have a super user bash terminal (#). Copy the following command and paste it into the super user terminal to install the needed libraries:
CODE
# apt-get install quilt libsdl1.2-dev libogg-dev libvorbis-dev liba52-dev libdts-dev libimlib2-dev texi2html libraw1394-dev libdc1394-13-dev libtheora-dev libgsm1-dev liblame-dev libxvidcore4-dev libfaac-dev libfaad2-dev

Go to a build directory. Since you're logged in as root, use the default build directory:
CODE
# cd /usr/local/src

Now get the ffmpeg source package:
CODE
# apt-get source ffmpeg

Get the patches for ffmpeg and apply them. Click HERE and save the file in /usr/local/src/:
CODE
# cd ffmpeg-0.cvs20060823
# bzcat ../ffmpeg-0.cvs20060823_enable_amr.patch.bz2 | patch -p1

You should see something like:
CODE
root:/usr/local/src/ffmpeg-0.cvs20060823# bzcat ../ffmpeg-0.cvs20060823_enable_amr.patch.bz2 | patch -p1
patching file debian/rules
patching file libavcodec/amr_float/decoder.c
patching file libavcodec/amr_float/encoder.c
patching file libavcodec/amr_float/interf_dec.c
patching file libavcodec/amr_float/interf_dec.h
patching file libavcodec/amr_float/interf_enc.c
etc..

Now build the deb packages:
CODE
# DEB_BUILD_OPTIONS="risky" dpkg-buildpackage

Go back to the src directory and install the resulting deb packages:
CODE
# cd ..
# dpkg -i ffmpeg_0.cvs20060823-3.1ubuntu1_i386.deb libavcodec0d_0.cvs20060823-3.1ubuntu1_i386.deb libavformat0d_0.cvs20060823-3.1ubuntu1_i386.deb libpostproc0d_0.cvs20060823-3.1ubuntu1_i386.deb

Open /etc/apt/preferences using your favorite text editor and add the following lines:
CODE
Package: ffmpeg Pin: version 0.cvs20060823-3.1ubuntu1 Pin-Priority: 1001

Package: libavcodec0d Pin: version 0.cvs20060823-3.1ubuntu1 Pin-Priority: 1001

Package: libavformat0d Pin: version 0.cvs20060823-3.1ubuntu1 Pin-Priority: 1001

Package: libpostproc0d Pin: version 0.cvs20060823-3.1ubuntu1 Pin-Priority: 1001

Get the youtube-dl script which allows you to download YouTube movies in flv format, to your hard drive. Click HERE and download the youtube-dl script anywhere on your hard drive. Now, from the root termina, run these commands to make the script available for all users on the Ubuntu machine:
CODE
# cd /where/you/downloaded/the/script
# chmod x youtube-dl
# mv youtube-dl /usr/local/bin

Download movies from YouTube by using the script:
CODE
$ youtube-dl youtube.http.address.while.viewing.video
The movie will be saved to something like I_KRmU2dO2M.flv

Finally, convert .FLV files into MPEG:
CODE
ffmpeg -i I_KRmU2dO2M.flv -ab 56 -ar 22050 -b 500 -s 320x240 video.mpg

Convert .FLV into XviD .AVI with MP3 Audio:
CODE
ffmpeg -i I_KRmU2dO2M.flv -ab 56 -ar 22050 -b 500 -s 320x240 -vcodec xvid -acodec mp3 video.avi

Enjoy!


Rating:
Good (3.7/5) 13 vote(s) so far    

Read by 69,400 user(s) | Add comment | Link to this article
Subscribe to news | Print article | Send to friend

© Copyright 2001-2008 Softpedia
Contact:

 

 

SEARCH THE NEWS ARCHIVE :




Today's News
| Yesterday's News | News Archive


MORE RELATED ARTICLES:


Add a Splash Image to (K)Ubuntu Bootloader

Improve Performance in Ubuntu Edgy

Screencast Guide: Capure Your Linux Desktop on Video!

Install Nvidia and ATI Video Drivers on Ubuntu Edgy

Installing NTFS Write Support on Fedora/Ubuntu

Install OpenOffice.org 2.1 in Ubuntu/Kubuntu

Ubuntu Edgy Desktop Effects with Beryl

User opinions:


Comment #1 by: lite72 on 23 Jul 2007, 10:29 GMT reply to this comment

So, where is the root account (and password) needed here? Why not just use "sudo -s" if the idea of the root account was only to make easier to enter multiple commands with root privileges?


Comment #2 by: koolkatkiwi on 08 Nov 2007, 03:07 GMT reply to this comment

While following this very long and complicated tutorial, I did exactly what was written. Halfway through, there was a problem - first, a link was dead, then, when I searched and found the file I needed at Sourceforge, and tried to put it in the directory indicated, I was refused "write" access in this directory.

In the terminal, there were error messages, saying packages were not there, and it had failed to install. I had to give up at that point. So now, my computer is screwed up, with this installation half done.

IMHO this tutorial is not suitable for novice users. Even intermediate users would struggle with it.

It wasn't any use to me, anyway.

Share your opinion:

Your Name:
Your Email Address:
(will not be used for commercial purposes)
Solve this to prove you're not a bot: =
Your review/opinion:

 






SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   ENTER NEWS SITE   |   ENGLISH BOARD   |   ROMANIAN FORUM