gentoo howto: download and transcode any youtube video…

Hi there all,

in this article we will cover how to  download and transcode into any format{avi,mp3,…} in a few commands :-) This article is divided into two pieces; The init phase where all the necessary tools are build, and then some basic explanation of the tools usage.

We begin this article with the usual update your portage tree with
#emerge --sync
next you have to download the youtube-dl package. While it is possible to create a similar script with more or less functionality (i.e. using python and browser @ mechanize package) the point here is to be as simple as possible. So we download the package with
#emerge youtube-dl
Then we have to download some packages to manipulate the flv videos. Such tools (but not limited to) are ffmpeg and transcode. We download each one with the appropriate emerge command; Keep in mind that we have to setup the build flags on each one in order to have the ability to manipulate more than one datafile. In my system the /etc/portage/package.use contains the following on ffmpeg and transcode;
media-video/transcode X iconv jpeg mmx sse sse2 truetype 3dnow a52 altivec dv dvdread extrafilters fame imagemagick lzo mjpeg mp3 mpeg network ogg oss quicktime sdl theora\
v4l2 vorbis xml xvid

media-video/ffmpeg a52 aac amr encode ieee1394 imlib mmx network ogg oss sdl theora threads truetype v4l vorbis x264 xvid zlib
after setting up the /etc/portage/package.use for our tools then we emerge our packages with;

#emerge ffmpeg
#emerge transcode

This concludes our init/setup phase. And now we enter the tools usage part.
Scenario a.
Since we have forgot our Load CD and we desperately want to listen to until it sleeps track. No stress dude! This is a 1 minute task!

  1. We locate the video in the youtube (eg http://www.youtube.com/watch?v=sZtszXnG11E ) then we call the youtube-dl with argument this url; $youtube-dl -b -t http://www.youtube.com/watch?v=sZtszXnG11E (-b is for the best quality -t is for the title, since we only wanted to make an mp3 from this track we could omit -b argument with no significant loss in the quality. -t is to create a filename which contains part of the video title). If we download with -b switch bear in mind that our media is saved as mp4 video file. at programs exit the youtube-dl reports the file that has been saved eg;

    Retrieving video data: 100.0% ( 17.21M of 17.21M) at 125.20k/s ETA 00:00 done.
    Video data saved to sZtszXnG11E.mp4

    the sZtszXnG11E.mp4 is the filename we are gonna tamper :-)
  2. We transcode the sZtszXnG11E.mp4 with ffmpeg with one simple command; $ffmpeg -i sZtszXnG11E.mp4 -f mp4 -vn -acodec copy UntilItSleeps.mp3
    1. If we had downloaded the same file without -b switch the input file (-i sZtszXnG11E.mp4  in the previous bullet) would be something like sZtszXnG11E.flv. In that case we change the input codec parameter from mp4 to mp3 ; $ffmpeg -i sZtszXnG11E.flv -f mp3 -vn -acodec copy UntilItSleeps.mp3. We do so because the audio data are represented differently in flv (mp3) and mp4 (mp4) files respectively.

If anyone has any other scenario in mind please ask :-)

FAQ: What is kolga?

Kolga despite the wikipedia definition [1] is something existing in this world(earth).

It is a wireless node located in the city of Patras [2] [3] participating in the public/open/free wireless metropolitan network named PWMN. It’s exact position is in the eastern part of the Olga’s square [4]. It’s operator and maintainer is the writer of this article (and generally of this blog) and his details are here.

The node’s name was originally selected because of the asteroid, but since then most people of this world are interested in the node.Writer’s guess is that the node should have 6 or 7 people interested in its operation, while the asteroid maybe has one or two intrested in its existance :P

So dear visitors coming here from google bear in mind; that the node has no affiliation nor sponsorship from the asteroid.

Cheers!

kolga-under link reaches a new (sky) limit

After some rearrangements and link tune up the kolga-under link (operating on 5Ghz band) has stable throughput of 4,3Mbyte/s, which is kind cool since the rx power is at 3db fixed (while the max card capabilities are 17dbs).

So an eco-friendly link while maintaining its high throughput is as always an option and users should be encouraged to maintain such links.

Some real world application data transfers will be demonstrated in this article in future (as an article update) as well as the necessary software tuneups (mikrotik) in order for such a boost to take place.

/etc/fstab mount options

Yesterday I had to rearrange my data over my hard disks and since zfs [2][3] is not yet 100% efficient in linux distros[4] I have to do all the dirty work manually…

My first question is how the hell does the stupid fstab accept the bind option. Since its man page says as much as nothing [5]

The quick and dirty way into finding out how the stupid fstab syntax works is to mount a filesystem normally as you would do via the mount command (bind,loop anything!!!) and then check the /etc/mtab file to understand the syntax! its freaking cool and easy then to copy paste the mtab directives into the fstab file and voila! no fstab related reading is necessary!

for instance or if you prefer it as an example after some mount deeds the system reports the following on the mtab


msi939 ~ # cat /etc/mtab
...
/dev/hdb1 /mnt/hdb1 reiserfs rw 0 0
/dev/sda1 /mnt/sda1 reiserfs rw,noatime 0 0
/dev/sdc1 /mnt/sdc1 ntfs rw,noatime 0 0
/dev/sdd1 /mnt/sdd1 ext3 rw,noatime 0 0
/mnt/hdb1/mirror /home/mirror none rw,bind 0 0

which in turns translates (after using UUIDs) to the following fstab:


UUID="064368f6-a696-44b3-8a84-31e47c16d7cb" none swap sw 0 0
UUID="cb0b34366-9f99-4394-8c0d-aaa9e3c7503c" /mnt/hdb1 reiserfs noatime 0 0
UUID="4aa2348-bc8a-437d-8d72-59c6c364e0b4" /mnt/sda1 reiserfs noatime 0 0
UUID="6AE34GFCE42BC8E1" /mnt/sdc1 ntfs rw,noatime 0 0
UUID="ac7asd3d-69a6-424c-bd3c-fb0ae35a813e" /mnt/sdd1 ext3 noatime 0 0
/mnt/hdb1/mirror /home/mirror none bind,defaults 0 0

(if by accident it happens of your UUIDs matching one of the above don’t worry, it ain’t a bug! I simple changed a bit the UUIDs with random keystrokes :P - If you do have a match, bear in mind that this is something really rare, so send me a mail, maybe we are meant to get acquainted :))

I hope you enjoy this fragment of knowledge, a simple thank you is sufficient :-)