Encode video

From Second Life Wiki
Revision as of 10:24, 12 March 2011 by Opensource Obscure (talk | contribs) (→‎Linux: oops)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This guide will help you learn how to encode video to be playable in Second Life. There are many ways to do this, but this is among the simplest.

Chances are you have a movie file you want to show, but it's too big, or not in the right format to work inworld. This guide empowers you to make a single movie file that is:

  1. Playable in Second Life at a reasonable balance between filesize and quality — so you can share it with friends and colleagues!
  2. Playable on iPod and similar mobile devices.
  3. Playable cross-platform on most modern computers with most video players (including VLC and Windows Media Player).
  4. Perfectly uploadable to YouTube, Vimeo, and other web video services.
  5. AWESOME. (I hope.)

Initial setup

  1. Download Apple QuickTime and upgrade it to QuickTime Pro (US$30). (Unless you already have an app that can encode through QuickTime like Apple Final Cut Pro or Adobe Premiere Pro.)
  2. Open QuickTime Player.
  3. In QuickTime Player, use File menu > Open File. (Or double-click the file in the Finder or Windows Explorer.)
  4. Use File menu > Export. (In other apps, usually found as an option in the File menu).
  5. Change the Export dropdown to Movie to MPEG-4.
  6. To the right of the dropdown, click Options. Unfortunately, QuickTime doesn't let you make a list of custom presets, but you can use Most Recent Settings after you've done this once. Refer back here if you get lost.

Note: If your movie file doesn't open in QuickTime or your video editor, you'll need an intermediary transcoder. I don't have a solid recommendation outside of using Sony Vegas to read predominantly Windows-based formats, like FRAPS, and make them QuickTime-friendly — any suggestions for one? Add it here.

Laurent Bechir suggests:

If you're on a Mac, you can use Stomp which can encode with a lots of presets, lets you define your personal presets, and which costs US$29.95.
You can also use Handbrake which is free and works under Mac, Linux, and Windows.


Here's the settings you'll want to use, and why. You can tweak any one of these if you know better, but it's a good baseline, one that's been used hundreds of times and refined by Torley.

  • File Format: MP4
    • NOT "MP4 (ISMA)"

Video tab

  • Video Format: H.264
    • A popular codec that offers high-quality at small filesizes.
  • Data Rate: 1152 kbits/sec
    • It doesn't need to be exactly this. I chose "1152" because along with audio, it's a fine balance. Make this lower (like 200 kbits/sec) if your video is a mostly-static slideshow, or if there's lots of motion, make it higher (like 2000 kbits/sec). Don't go too high above "1000 kbit/sec" unless you know everyone watching the video is on a superfast broadband connection. Otherwise, they'll have to wait a long time for the video to buffer, and it'll repeatedly pause as their connection struggles to keep up — annoying!
    • Remember that we suggest "768 kbps" (audio + video combined) as the minimum for playing audiovisuals in SL. While many broadband connections are faster, err on the side of an enjoyable experience.
  • Optimized for: Download
  • Image Size: 640x480 (or less)
    • Exceeding 640x480 means your video won't play on iPods. Remember this if you definitely want to show an HD (1280x720) movie inworld.
  • Uncheck Preserve aspect ratio using: Letterbox.
  • Frame Rate: Current
    • Lower this if you want to sacrifice smooth motion for higher individual frame quality. For reference, I've used 20 or 24 FPS for my video tutorials. Don't go below 10 — it looks like a slide show, unless that's your intention.
  • Key Frame: Automatic
  • Click Video Options to bring up a dialog.
    • Restrict profile(s) to: Baseline
      • Uncheck Main (and Extended if need be), otherwise it won't play on iPod.
    • Encoding Mode: Best quality (Multi-pass)
      • This matters a lot if your video has a lot of motion and intricate details, but can take much longer-than-realtime to encode. If you're really short on time, chose Faster encode (Single-pass).

Audio tab

These settings result in near-CD-quality sound.

  • Audio Format: AAC-LC (Music)
  • Data Rate: 128 kbps
    • Lower this if sound isn't so important, 64 kbps @ stereo has swishy artifacts but is tolerably listenable.
  • Channels: Stereo
    • If the original source is mono, simply make it so. No point in increasing bandwidth usage if the content isn't there to begin with.
  • Output Sample Rate: 44.100 kHz
    • Similarly, if the original is lower-fidelity, lower it. You actually shouldn't be able to increase this if the source is at, say, 22.050 kHz.
  • Encoding Quality: Best

Streaming tab

  • Simply leave Enable streaming unchecked. This is for server-side streaming, and doesn't apply to general SL purposes.


Linux users may want to use Handbrake to convert their original video files. If you use GLC to capture videos, you may use the script that comes with GLC to convert them to .mov. Avidemux may be useful too.

Refer to Settings section above and try using the same values and criterias. Please add any specific instruction and information you find.

See User:Opensource_Obscure/GLC for additional tips and GLC instructions.

When checking the final result, be sure that it's ok on other operating systems too. Ask some friends who are on Mac and Windows to look at your video in-world and be sure they can see it. Linux SL viewer uses Gstreamer to display video, not Quicktime, so Mac and Windows users could have a different experience than you.

(Info thanks to Opensource Obscure, as Torley doesn't have Linux.)

Now what?

It's time to upload your video to a server (Linden Lab employees use Amazon S3) so you can copy the URL and play it Second Life. For more info on that, see Play media.

For advanced users

You can apply most of the above to other encoders that support QuickTime. Alas, many encoders' usability are crap and they offer too many options without telling you what they do, and on top of that, their presets aren't optimized as they could be. And sometimes they're missing one or more of the essential options above, making it a chore to test and get good results.

That being said, if you know something elegant, add it here! ________ :)

Frequently-asked questions

I have to wait for a whole movie to load in SL, why?

It's likely because the movie isn't optimized for within-seconds playback. The above guide fixes that; re-encode earlier movies as necessary.

Why choose "Movie to MPEG-4" instead of "Movie to QuickTime Movie"?

If you choose the latter, you'll have almost all of the same options as above, albeit presented in a different layout. It's a bit confusing but this can make Second Life-compatible movies too.

However, Movie to QuickTime Movie "wraps" the video file differently, meaning it's slightly less compatible on the Windows side of things. But most video players can do both, so overall, this isn't a big concern.

Where do I find these options in Final Cut?

  1. Open Final Cut (Pro or Express).
  2. File menu > Export > Using QuickTime Conversion.
  3. From the Format dropdown list, select MPEG-4.
  4. Click Options. The same options as above appear.

How do I check if my exported movie is in the correct format?

Obviously, the real test is to see if it works in Second Life. But this also helps:

  1. Open the video file in QuickTime Player.
  2. Window menu > Show Movie Inspector.
  3. The format should be similar to this, in particular the "AAC" and "H.264" parts:

You can also compare to Torley's video tutorials. Older ones have slightly different settings due to Torley tweaking over time.

Related resources

  • Play media - Info on how to actually play movies in Second Life, after you've got them encoded.