Lisa Larson-Kelley led a good session on advanced video encoding at MAX. Here are some notes I took on the session. Note that her blog, www.flashconnections.com, will have complete information and links that will be better than these notes. But in case this is useful, thought I would add them here anyway to give you a taste of what went on.
The session covered: general info to understand the FLV format and codecs, info to help you improve the quality of your FLVs and FLV playback, best practices, settings you can make when you encode video, and info about HD and FLV (and info about the new Flash Player code named Moviestar).
Showed an FLV playing back at full screen running at 1080p (HD) - demonstrated the great, crisp quality that’s possible using proper encoding settings. She played this through the beta version of Flash Player.
Some of the new things available in Moviestar include HD, H.264 codec, base/mainline/high/high 10 profiles of ISO 14496-10 standard. Also referred to as AVC (squeeze encoding profiles). Details of what’s not supported - MPEG-4 pt. 2 (XVid, DivX), H.263, Sorenson 3, Fairplay protected video (itunes DRM content, etc).
Coming up, VP6-S (simplified) - this will work in Moviestar. Strips out some stuff to reduce size or something like that. This simplified version of VP6 does support alpha channel.
Audio. AAC support ISO 14496-3 standard. Default for iPod and PS3, and will play in Flash Player as long as it’s not DRM protected.
Hardware acceleration - frees up CPU, new API to select which area to cache in the hardware, which area of your Flash app.
Codecs vs containers: H.264 is a codec, and FLV is the container.
Four things to think about when you encode things
- H.264 handles pans and zooms and fast movement well - if you have these things, choose an appropriate codec if possible.
- Audience reach. If you need a wider reach you may need to go with an earlier version player.
- Archive-ability. H264 is a more open format, so it is easier to archive and play years forward
- Licensing. H264 is not completely open. You need to pay fees if you use it commercially, so if this applies to you see the FAQ on Adobe.com.
Compromise when you encide. File quality to file size. File size goes up if you want it to playback smoothly. Consider dimensions of the video - smaller dimensions lowers file size. Consider the framerate (more frames filesize goes up), minimize artifacting when you improve quality.
Start with a profile and then tweak your settings according to what your footage is like.
When you’re encoding, start with the highest quality video file that you can get, and then compress from that.
Often you will get a DVD from a client, so you will need to rip it (demux). Separate the audio and the video. On Mac you can use software like MacTheRipper and Handbrake (I use Mac… sorry I didn’t note Windows, but they’re easy to find…). Convert the file to a MPEG or a MOV file and then encode.
Taking video footage. Shoot in proressive mode. Use a tripod and avoid pans and zooms. Avoid fades and dissolves, Avoid using your camera’s autofocus and autoexposure. Use proper lighting (this will help you avoid those big dark spots that have lots of artifacting when you encode and you get that pixelly dark area in the back that sort of shifts). Get proper audio because that’s hard to fix and will totally detract from your video online — it will distract the user and ruin the whole thing. Also avoid ambient noise.
Transmuxing — take video out of one format and convert it to another.
Squeeze: good at - preprossing filters, batch encoding, auto keyframe placement, and you can FTP video right from the software.
Flix: has vector video, can use to add watermarks (but add these using flash if possible… do add to the video file if you’re concerned about the video going across the interwebs), and it’s cheaper.
Progressive H264 issues.
Moov atom: like metadata, player needs to have this data at the beginning of the file. However, Premiere and After Effects currenly put it at the end of the file. You can use a utility to move the moov data to the beginning of the file. Use QTindexswapper (AIR app), or QT Pro and prepare for internet stream/fast start.
FLVCheck on Labs to fix FLV files metadata formation. Then you can use Burak’s metadata injector to fix any issues.
1) watch and analyze the video and note dimensions and frame rate. She notes that you can get info and see this depending on format.
2) Bandwidth target - choose if you want to detect this and how. And plan what you’ll do based on gathered information. Or if you do this server side with FMS.
3) Choose your target datarate. Don’t rely on using all of users bandwidth because they’ll be doing other things too. Use 70-80% of the target user’s bandwidth. If the video is low quality, plan to use a higher bit rate.
4) Choose a frame size - 4:3 or 16:9 and use a fraction of that. Also act for square (computer) or rectangular (broadcast) pixels. Make sure that you don’t stretch the image. One way to make sure you’re not stretching is to encode a perfect circle on first part of the video, then you can easily tell if you’re stretching it when you encode.
5) Choose an optimal frame rate.
6) SEt keyframe interval. Automate this if you can. Or if there’s lots of motion, it’ll put in too many keyframes. Fewer keyframes is better if you can do this. Progressive video with a scrubber bar - you need more keyframes in this situation because you can only seek to the keyframes.
7) audio compression. Always use MP3 audio encoding - use AAC with H.264. Always encode the audio too, Flash needs this for syncing the framerate.
If applicable, alpha channel. Crop the video down to the masked area. Note that it takes longer to encode.
Streaming or progressive.
CBR - streaming, VBR - progressive [allocates datarate when needed]. Always use 2-pass encoding [1st pass plans how to encode, 2nd pass actually encodes the file. Results in smaller and better video].
Try to encode from a video editor. Flix and Sorenson Squeeze both have exporter plugins available. Also there’s a FLV QuickTime export plugin.
If not, then save as QuickTime using Video codec (Mac) or Uncompressed AVI (Win).
Deinterlace always, if shot in Progressive mode. Apply the deinterlace filter, “upper field”
Apply pre-processing filters, white/black restore if using Squeeze.
720p - recommend 1.5 GHz processor
1080p - recommend 2.5 GHz processor
Visit her blog at www.flashconnections.com for more info.