Mobile Video Consumption – Prepping the Input

Following my last article where I started investigating encoding video files for use on mobile devices I’m following up with what could possibly be seen as an appendix to that introduction. I’m not going to write any Expression Encoder tutorials, but I’d like to share a few thoughts around what I do with the specific source material I’m interested in encoding.

I stated that I had three basic input files that for certain would need to be re-encoded as opposed to ready-made files downloaded from the Intertubes:

– DVDs.
– Recorded TV shows from my Windows Media Center (either in WTV or DVR-MS format).
– HD video from my Sony camcorder in AVCHD format.

DVD-ROM
While Expression Encoder supports DVD files the structure of how the disc is built cannot be interpreted by Encoder and this usually means you have to perform some tasks on the source before you input it into Encoder. On a DVD any single file will usually not exceed 1 GB, so a sequence that logically is one unit might be split into several files. I’ll spare you all the details, and just show you how I’ve done it in an example instead Smile Many of you already have your favorite tools – probably nothing wrong in sticking with these. What you want though is that what you put into Expression isn’t already transcoded or compressed in some way.

I use a utility called DVD Decrypter (http://www.dvddecrypter.org.uk/) for “ripping” the discs. It’s an oldie but still works without problems in both Windows 7 and Windows Server 2008 R2 as far as I can tell. For this purpose you’ll want it in “IFO Mode”. (IFO files contain chapter information, info on which VOBs belong together and info about audio and subtitle tracks.)

You’ll get a list of VTS_xx that you can extract. In this case each episode is contained in it’s own, but this can look different on other DVDs.

dvd01

You can choose which streams you’d like to include. Very simple content here as you can see – you may very well see different languages here, and subtitles, (subtitles deserve a special treatment – see a couple paragraphs down), as well. If that is the case it makes sense to only extract what you care about.

dvd02

I right-click”PGC 1” and make sure File Splitting->By Vob Id is checked. This gives me three output files where it’s the VOB file that is of interest. (The IFO contains info about chapter markings for this particular VOB.)

dvd0

I extracted a single episode – running time roughly 45 minutes and the resulting file was 1.7 GB. The file could have been made smaller, but I included both the stereo and the surround audio stream so that was probably a couple of hundred MBs extra. Extracting this took about 4 minutes. The extraction time is basically limited by your DVD-ROM drive so you’ll probably see similar times yourself unless your drive is really old or ready for replacement (the hard drive should be able to keep up).

This VOB file is now ready for Expression Encoder where you can re-encode it as you like. I found that the “H.264 HD 720p VBR” preset gave decent results. (I changed the resolution to 720×576 instead though so it wouldn’t look stretched.) I used volume leveling at 5 to boost the audio since this DVD had very low volume by default. Just in case I need it for later I also make a screenshot thumbnail. I used the stereo audio stream, and this results in an mp4 file weighing in at just below 1 GB.

Hold on, did I not say something about subtitles? Yeah, I hope there is a special place reserved in a certain hot place for whoever came up with the approach for how DVDs stores subtitles… You see – Encoder supports subtitles in a couple of different formats. But only text-based formats. And the subtitle tracks on a DVD comes in a bitmap-based format. So when you’re playing back a DVD and selecting subtitles you’re technically not seeing “text” but an image superimposed on top of the video. This means that the subtitle you can extract with DVD Decrypter isn’t something you can import into Encoder. You need to convert it to a text-based format and this turned out to be somewhat challenging. (DVD Decrypter also supports splitting out the subtitles into a bitmap-based file, but apparently no-one has been able to use these files in any other program…)

A workaround (which is not super-duper-optimal) involves the following steps:
– Use Handbrake to rip the DVD and encode to MKV format. Select the corresponding audio and subtitle tracks.
– Use MKVToolNix to extract the subtitles as idx/sub format. (Use MKVExtractGUI2 if you want a visual interface.)
– Use Subresync to open the idx-file generated. Select all tracks and choose to “Save as” an srt file. Subresync will run an OCR scan on the bitmap, and you will probably have to learn it to recognize the characters. So for the first lines of dialogue you need to enter almost every character, but progressing throughout it will recognize more by itself. I’m guessing English is the language it is the most comfortable with. (Personally I usually prefer English subtitles even when Norwegian is available.)
– Import the srt file as the subtitle track in Encoder.

Necessary links:
Handbrake – http://handbrake.fr
MKVToolnix – http://www.bunkus.org/videotools/mkvtoolnix/
MKVExtractGUI2 – http://sourceforge.net/projects/mkvextractgui-2/
Subresync – http://www.videohelp.com/tools/VobSub

Looks good though:
TP

As far as the general process for getting the video and audio out with DVD Decrypter you don’t have to change this if you happen to like it. You can encode your VOB in Handbrake, but if you encode to MP4 the subtitles will be part of the picture and not easily extractible. MKV files aren’t supported by Encoder so no help there either. But I really care mainly about getting the subtitles with Handbrake, and if I set the output format to what can only be described as unwatchable the processing of the file takes only a few minutes. Doing the OCR is downright boring manual labor, but does not take much time either. So, while tedious it doesn’t consume all that much more time per episode. I do however understand why people would say to themselves at this point that there’s something called torrents out there on the Internet that happens to be much more user-friendly. That’s a bee’s nest I’m not sticking my hand into – I’m just showing how it works if you decide to make available the content you already have in your DVD collection Smile

When you have encoded audio, video and subtitles in Encoder you will have an mp4 file (as usual) and a DFXP file containing the subtitles. The DFXP is a recommended format by the W3C standards (http://www.w3.org/TR/ttaf1-dfxp/), so while I haven’t tested it out yet I’m guessing it will work in conjunction with HTML5 and not just Silverlight players. Do mind that subtitle support isn’t necessarily implemented equally in all clients – so you may not get subtitles, or you may not be able to enable/disable at your own whim. If you put it up on a web page you might have to add the mime type for it as well:
Extension: dfxp
MIME type: application/ttaf+xml.

If your player supports it you might be able to run with the .srt file you produced above instead and ignore the dfxp file.

Media Center Recordings
Windows XP Media Center records TV in a format called DVR-MS, and Windows 7 Media Center records in a format known as WTV. (I don’t know what Vista produces.) I don’t know exactly what the difference between these two formats are, but as I understand they are both based on WMV/WMA, but with some additional metadata (like subtitles, tele text, etc.).

image

You can drop these files directly into Expression Encoder and transcode without any additional preparation steps. Just be aware of one catch – I’m running Encoder on Windows Server 2008 R2. This OS does not include all the necessary Media Center bits and bytes, so you can’t use them directly here. With Expression Encoder installed on a Windows 7 box you will not see this problem. Since I do not have multiple Encoder Pro licenses I can only do H.264 encoding on my “main” encoding station, and I currently do a workaround where I use the MSDN version of Expression Encoder on a Windows 7 computer to transcode the WTV into WMW which can then be imported and transcoded yet again to H.264. Do remember to use high quality settings in the first transcode so it doesn’t get progressively worse at the next encoding.

What kind of settings to use depends on what level of quality you are getting on your recordings. Are you using analog or digital? Standard definition or HD? My setup is based on DVB-C where some of the channels are HD, and some are SD. Even better – sometimes 16:9 is delivered in 16:9 and sometimes it’s in a 4:3 “wrapper”. There’s seemingly an amount of randomness in this, and I don’t know if the cable provider or the TV station is the one to blame. (Probably both…) So, some recordings will have black bars on top, the sides, or both. Not much I can do about that though.

I created a custom preset in Encoder for transcoding the WTV file with the following settings:
Output format: Windows Media
Video: VC-1 Advanced
Audio: WMA Lossless
Video Mode: VBR Quality, Quality 100, Size Mode Source
Audio Mode: Stereo, 44,1 kHz, 16 bit

This produces files that are fair enough for further processing, and is almost equal to the original file in size. What lack of quality I was seeing was caused by factors out of my control, like the fact that some channels use more compression than others causing degradation of video and/or video, and things like the fact that twenty year old movies weren’t necessarily recorded at Blu-Ray level quality in the first place. But when I record things in Media Center it’s usually “lower value” material to me so I can live with it. (If a movie is really great I’ll buy it on DVD, and some shows I only watch once even though they’re good.)

HDV Camcorder
I have a Sony HDR-HC3 camera, and this records at 1440×1080 (interlaced). If you’re happy with importing it in SD quality Windows Movie Maker works nicely, but if you want full HD (and who doesn’t) you need something else. I know Sony offers their Vegas software for this, and there’s also Adobe Premiere. I believe Encoder might support it for live broadcasting as well (which obviously is out of scope here). But since I’m just interesting in getting the raw material from the device I looked for a low cost option here. Newer cameras record directly to a hard drive in the camera, so you can just copy the files. But when I bought the camera a couple of years ago this wasn’t really an option so I use MiniDV tapes. (HDD models were available at the time, but with the small drives available it was kind of not very practical if you didn’t have a computer nearby when you ran out of space. This is a very good thing about tapes, and they cost next to nothing these days as well.)

File:Small dv and hdv cassettes front.jpg

You need to have FFDShow installed on your computer to get the audio stream. I then use HDVSplit to import the video (make sure you have plenty disk space). A minute of footage is circa 200 MB, The output files are in the .m2t format, and this is supported natively by Expression Encoder, where you can do your magic as you like. (FFDShow is not needed once you have transferred to m2t and you don’t need any extra codecs for Encoder to support this format.) I don’t think I’ll be needing to encode these specifically for mobile as I don’t need to bring out my family’s recordings on my iPhone all that often.

HDVSplit: http://strony.aster.pl/paviko/hdvsplit.htm
FFDShow: http://ffdshow-tryout.sourceforge.net/

This content is also a prime candidate if you want to play with the editing features of Expression Encoder, and you probably want to make some extra effort in aligning the material in chapters, use overlays, and more before you hit the encode button.

I don’t do much editing at the moment though. HDVSplit detects scene changes, (hitting the stop or pause button on your camera), so it generates a bunch of files. I stitch these together and produce one output file per day/session/whatever seems right. I use the H.264 HD 1080p VBR preset for these output files. An hour of video resulted in 2 GB of mp4 files.

If you’re still following me now is the time to run a few files through the encoding process so we have something to experiment with for the next installment where we’ll take a look at how to bring the content to the devices we have at hand Smile

Leave a Reply

Your email address will not be published. Required fields are marked *

*