How to make a video for youtube with linux

October 16, 2007

Today our aim is to create a slideshow set to music that we can upload to youtube. Since I prefer to use linux, this guide will focus on how to do it in ubuntu.

Here’s the video I created as part of my blog about emo hair cuts:

Here’s the sequence of steps required:

  1. Decide on the piece of music you’re going to use. For this example I’m going to select a random .mp3 from my collection. Work out how long it plays for. I fired up a player to work this out, there may be an easier way. My chosen .mp3 file was 3 minutes, 52 seconds in duration.Total time in seconds := 232.
  2. I decided on 5 seconds per image, including transitions. You don’t need to use transitions if you don’t want to. I think it looks nicer. Since we’re talking about 232 seconds of audio, we’ll need:232 seconds ÷ 5 seconds per image = 46 images.

    If you’re planning on creating an image for the beginning and end of the video, obviously subtract 2 from that number.

  3. Grab a bunch of photos from somewhere. Don’t worry about how big they are. We’re going to resize them to 640×480. Ideally the images you chose will be as big or bigger than 640×480 to start with, but it really doesn’t matter all that much.
  4. For each photo in turn, run this command: convert <filename> -resize 640x480 <newfilename>'.

    ‘convert’ is part of the ImageMagick suite. If you don’t have it already, you can install that with:

    sudo apt-get install imagemagick

    This resizes each image to fit in a 640×480 frame. It does not force them all to that size, so your aspect ratio is kept.

  5. If you’re planning on creating an image for the start and/or the end, fire up the gimp and create a new 640×480 image. Use the bucket tool to fill the frame with a color (black is a good choice), select a text color and use the text tool to type your text into the image. Save it as a .jpg.If you don’t have the gimp, install it with: sudo apt-get install gimp
  6. At this point you have all your images ready and resized to fit in a 640×480 canvas. You also have your audio track ready. Now it’s time to create the slideshow. For that we need dvd-slideshow. sudo apt-get install dvd-slideshow
  7. dvd-slideshow runs from the command line based on a ‘recipe’ or script that you create. Ours is going to look like this: audiotrack.mp3:1
    headerimage.jpg:5
    fadein:2
    image01.jpg:3
    crossfade:2
    image02.jpg:3
    crossfade:2
    ...
    ...
    ...
    lastimage.jpg:3
    fadeout:2
    footerimage.jpg:10

    Notice that firstimage.jpg runs for 3 seconds, then there is a crossfade of 2 seconds. That takes the total time for the image to the 5 seconds we wanted. If you want to display the image for a shorter or longer time, adjust as necessary. Notice also that there is a ‘fadein’ after the first image. We don’t want the first image to fade in, and we can’t use crossfade for the first image. I displayed the footer image for 10 seconds. You can display the last frame for as long or as short a space of time as you like.

  8. Run dvd-slideshow as follows:

    dvd-slideshow <recipe file.txt>

  9. Watch the magic happen. When it’s finished you’ll be left with a .vob file. If you wanted to, you could burn that directly to a dvd. I don’t know why you’d want to do that, however! VOB files are pretty large, so we’ll need to resize it before we upload it to youtube.
  10. Use mplayer or (my preference) vlc media player to play the .vob file and make sure it looks like you expected it to. Once you’re happy you’ll want to turn your huge .vob into a much smaller .avi that youtube will like. You’ll need mencoder and lame for this:

    sudo apt-get install mencoder lame

  11. You’ll probably want to save this to a script. Execute the following commands. There are 2 passes, so we run mencoder twice. Replace $FILE with your .vob file and $OUT with whatever you want to call the resulting file. The ‘crop’ commands aren’t strictly necessary, but won’t hurt. The first time I ran this I left the slideshow at 640×480 and had mencoder resize it.

    mencoder "$FILE" \
    -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:keyint=250:threads=2:vpass=1 \
    -oac mp3lame -lameopts cbr:br=128 \
    -ffourcc XVID \
    -vf scale=320:-2,crop=320:240,expand=320:240 \
    -af resample=44100:0:0 \
    -o "$OUT"

    mencoder "$FILE" \
    -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=1000:vhq:keyint=250:threads=2:vpass=2 \
    -oac mp3lame -lameopts cbr:br=128 \
    -ffourcc XVID \
    -vf scale=320:-2,crop=320:240,expand=320:240 \
    -af resample=44100:0:0 \
    -o "$OUT"

  12. Alternatively, it’s been pointed out to me that you can encode directly to .flv, (which is what youtube will turn a .avi file into) with ffmpeg (sudo apt-get install ffmpeg) as follows:

    ffmpeg -i FILE.vob -s 320x240 FILE.flv

  13. Once that’s completed check out your .avi or .flv file in your player of choice. You should have a (much smaller) video at 320×240 that you can upload to youtube

That’s all!

Technorati Tags:
, , , , ,


Blogrush – now that the buzz had died down.

October 12, 2007

If you remember my earlier post about blogrush, you’ll recall that I was a little skeptical about just how useful it really is. Does it live up to the hype?

Well the hype seems to have died down. A lot. Did you notice? If you believe what they tell you over there, apprently blogrush has been wildly successful. Very wildly successful for spammers, too it seems. So wildly successful that according to the folks at blogrush, everybody’s stats are skewed, and the number of clickthroughs is much lower than anticipated.

Uh huh.

So they’re working hard now to fix the problem. If that’s the case then, I could conclude that now I should be getting a few more clicks than I was initially. Let’s see what google analytics thinks.

google analytics

So for referrals, blogrush (after all this time, mind) ranks #6 with a whopping 18 page views. According to my blogrush dashboard, in the last 7 days alone I’ve earned over 350 credits for the blog in question.

So something is up. I think now that the hype has died down, blogrush is showing itself to be akin to google adsense: an annoying widget that pops up on people’s blogs. Something that nobody aside from other bloggers (who have themselves got the blogrush widget) will click on.

Sounds like the jury is in, to me. Go ahead and sign up for blogrush. This is a referral link which means I’ll get “traffic” (in theory) when you do. By the looks of the success thus far, I need al l the help I can get.

PS:  Did you ever notice how the blogrush dashboard refers to your ‘traffic’?  That’s people who see a link to your website, not actual traffic ON your website. Worthwhile distinction to note.


Twitter tracking – more ass-kicking coolness

October 11, 2007


The longer I have to play with twitter tracking, the cooler it is. (I’ve already spoken about how it works here.)

Here’s a list of the top five things that I think are worthwhile tracking:

  1. Your user name: All combinations thereof, including @username.
  2. The city you live in. In my case, Melbourne. A half hour after I added this, I had seen twitters from no less than 5 people in Melbourne talking about traffic, public transport and local events. Gives twitter a nice hometown feel. It’s almost local news “as it happens”. Obviously this depends on who twitters what.
  3. “Britney Spears”. There is so much gossip about her at the moment it’s amazing. You’d never need to buy a gossip magazine ever again. Substitute your favorite celeb for Britney. For example:
  4. “laugh”. Any time someone finds something funny, you’ll know about it.  Everyone needs a little comic relief now and then.
  5. Anything related to websites you own or plan on working on. I shouldn’t need to expand on this one.

As a bonus, if you haven’t worked out the phrase that twitter themselves are saying seems to be the most popular, take a look at the twitter blog. As I’ve mentioned previously, reach out and touch a huge number of people simply by incorporating that into your tweets…

Happy twittering!

Powered by ScribeFire.