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!
- 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
- We transcode the sZtszXnG11E.mp4 with ffmpeg with one simple command;
$ffmpeg -i sZtszXnG11E.mp4 -f mp4 -vn -acodec copy UntilItSleeps.mp3- 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 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 ;
If anyone has any other scenario in mind please ask ![]()
Leave a Comment