một công vạn chuyện (one effort billions accomplishments)

The equivalent saying in english is “kill 2 birds with 1 stone”, but… why would you want to kill birds? and why start a saying with “kill” anyway??  so i think the vietnamese version is more appropriate here.  Anyhow, first, the end result:

It’s a simple slide show of some random pictures (of my latest hiking trip) to a _beautiful_ soundtrack of Frau Kasarova and Frau Gruberova duett.  It did take me 5+ hours to accomplish, and in the process I achieved several goals, namely 1) download a youtube clip, 2) extract sound clip, 3) make a slide show manually, 4) merge slide show with audio manually, 5) add subtitles, 6) convert video formats.  All this can be done easily i think with microsoft windows (?), except i’m pretty allergic to windows.  In the last 3 year, i’ve had to reformat countless machines of sisters’, brother-in-law’s, ex’s, and mine due to viruses, malwares, etc.  Now when i get a call, i come with an “ubuntu” disc, wipe out their computers, and install this neat operating system.  linux has gotten so user-friendly these days, and with ALL the softwares FREE, why not give it a try?  the basic disc comes with most of the daily simple functions.  My sister seems happy with it (i think).  If you want something a bit more advanced (re slide show w/ audio from youtube clip), it requires some googling and readings… but “almost” everything can be achieved to satisfaction.  In the end, it leaves you with a nice feeling of accomplishing something, sort of like putting together a functional bicycle for  yourself (ubuntu) versus buying a shiny bicycle from a shop (microsoft windows).

So why am i babbling about these nuisances?  I have been wanting for a while now to do so many things with the various audio clips and dvds of operas I have, including extracting audios from dvds for listening at work, introducing friends to opera clips with subtitles (read whiteshirt), making slide shows with background music to subconsciously introduce some nice tunes to friends (the friend i hiked with loves the duett). So, this post essentially includes some instructions to achieve these goals and provides further tools for fiddling with digital media.

Tools needed (free) on ubuntu (I read they’re also available for windows):



1) getting youtube clip: one clip i really like is from smorgy, this one. so this command will get you the clip on your local machine under the name YGH3mkcYxfk.flv :
youtube-dl http://www.youtube.com/watch?v=YGH3mkcYxfk
2) extract audio to a file called YGH3mkcYxfk.wav:
ffmpeg -i YGH3mkcYxfk.flv -vn -acodec pcm_s16le -ar 44100 -ac 2 YGH3mkcYxfk.wav
3) put together slide show with above .wav clip and your pictures:
a. make a slideshow.txt file with lines of this format: picture:duration:subtitle .  the fadein/fadeout/crossfade:duration does just that: fadein for xx seconds, cross fade between pictures for xx seconds.
Photo01.jpg:13:trail head  6am
Photo02.jpg:6:half way
Photo03.jpg:6:above cloud

b. run the line below to produce a DVD quality slide show called slideshow.vob, with subtitles and durations as listed in slideshow.txt
dvd-slideshow -n slideshow.vob -a YGH3mkcYxfk.wav -f slideshow.txt
4) make a lower-resolution slideshow.avi file for youtube purpose:
mencoder slideshow.vob -ovc xvid -xvidencopts pass=2:bitrate=1000 -oac mp3lame -lameopts vbr=3 -o slideshow.avi
5) upload back to youtube :-).  Actually on the last step, the subtitles are not saved, but since youtube allows you to add subtitles now…
6) add subtitles: a simple file containing
Romeo: Vieni, ah! vieni, in me riposa:
Come, ah, come, rest in me:

ah sei il mio bene, sei la mia sposa;
ah, you are my beloved, my bride:

will let you add subtitles to this clip for example.

Some last cool things with the above free tools:
7) cut out gypsy song from a big audio file of Carmen-Act1.mp3 and make my favorite Carmen clip:
ffmpeg -loop_input -i kasarova_carmen.jpg -i Carmen-Act1.mp3 -acodec copy -t  00:47:24.76 output.avi
8 ) capture Händel’s full opera “Agrippina” (while broadcasted live) from vivalavoce.org (or any full opera every day at 5pm Los Angeles time):
mplayer -dumpfile agripina -dumpstream http://stream.weta.org:8088
9) split video clip into frames at rate 1/25 sec:
ffmpeg -i output.avi -r 25 -f image2 nome%03d.png
10) merge separate audio and video files:
mencoder slideshow.vob -audiofile Track01.wav -ovc copy -oac copy -o results.vob
11) Merge avi files (need to have same graphic resolution, video codec, audio codec)
mencoder -forceidx -ovc copy -oac copy -o merge_file.avi file1.avi file2.avi file3.avi
12) make HD video (!)
ffmpeg -r 0.216 -i MyPicture/pix_%2d.jpg -vcodec dnxhd -b 18000000 -s 1280×720 -aspect 16:9 -i Track7.wav -acodec copy -ss 00:00:00 -t 00:07:18.38 myslideshow.avi
(-r 0.216 –> 1/.216 = 4.63 sec / picture)
13) crop
ffmpeg -r 10 -i lev09.%6d.png -vodec mjpeg -b 18000000 input.avi
ffmpeg -i input.avi -cropleft 240 -cropright 272 -croptop 80 -cropbottom 128 -b 18000000 output.avi
ffmpeg -i out-1.ogv -sameq -vf “crop=648:348:180:160″ -an test.mkv (width:height:x:y)
14) view rotated video:
mplayer -vf rotate=1 output.avi

15) how to merge mp3 files

That’s it! it’s done. everything is now saved here. I won’t have to spend another few hours everytime i need to maneuver clips.  All i need now is how to capture live video stream, as well as sniffing stream’s url :-).


About thả diều
writing-challenged opera-addict

3 Responses to một công vạn chuyện (one effort billions accomplishments)

  1. idlehouse says:

    muo^’n la(ng xe^ ca’i slideshow thi` no’i me. no’ la` la(ng xe^ ddi, ba`y dda(.t co^ng co^ng chuye^.n chuye^.n !


  2. Smorg says:

    You are a whiz, An! Thanks a bunch! I should research all these tools along with ubuntu… since I’m still madly re-installing stuff after having my hard disk freshly wiped from a virus attack. 😦 And what a great hike you did, too. Thanks for sharing the slide show. I’ve never gone up Mt. Wilson… and I’ve been on the coast here for 7 yrs, now. Ugghhh!


  3. chau says:

    noi nhieu qua’, nhuc ddau qua


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

%d bloggers like this: