From DV/HDV/AVCHD to PS3/Xbox360/AppleTV


While there are a gazillion of video converters out there, I found none that is optimized to correctly deal both with anamorphic and interlaced video, or able to read intermediate lossless formats. There is always something that’s missing in the process of each of these utilities. It seems that all these converters are mostly consumed in transcoding pirated/DVD movies to another format rather than dealing with your home movies.

This is why I wrote the following tutorial, to show a way of how to export lossless video from your video editor (in this case Sony Vegas, although it’s similar with Adobe Premiere too) to an external converter and from there, to various formats (XViD, h.264, Flash, MP4, etc). The anamorphism and de-interlacing takes place on the video editor, so the converter only has to do that: converting. The main reason this tutorial exists is because the converter we use is more complex than most graphical converters, but it has the advantage of being able to read “lossless” codecs, which means that when you export from the video editor to the converter, you export to a special codec that loses no quality whatsoever. This workflow for videographers beats in quality any graphical converter out there.

The Method

1. Install Sony Vegas Movie Studio 8 Platinum Edition ($130 or 30 days free trial, suggested system requirements here). Grab your scenes from the tape and do your video editing on that program. Please note that h.264 encodings tend to de-saturate your mpeg2 HDV footage, so use the following filter that will affect the whole timeline by saturating the colors a bit: From the “Track FX” button select the “Color Corrector” filter and then select its “Studio RGB to Computer RGB” template. Meanwhile, make sure that your “Project settings” look like this for NTSC HDV (use a DV template if your camcorder is a plain DV widescreen one, but keep the field order, rendering quality and de-interlace method the same):

[ IF you shot with a Canon HV20 or HG10 in 24p mode, you will first have to remove pulldown before you start editing your scenes in Vegas. Then, select the 23.976 framerate in the “Project Settings” window. When you are creating a new project you can tell Vegas to create custom settings as a particular file on your disk, so you just tell it to derive the right settings from your pulldown’ed 24p videos. Then, make sure that it’s “progressive scan” for the “field order”, and “none” for the “Deinterlace method”. The Platinum edition of Vegas does support 24fps, even if it’s not officially advertised as being able to. It is in fact, the cheapest NLE in the market that supports 24p editing. ]

2. Install the Huffyuv 2.1.1 lossless codec from here. You do that by uncompressing the contents of the zipped file on your Desktop, right-clicking on the huffyuv.inf file and selecting “Install”. After this is done, you can delete these files. We will be using this codec because that’s the only lossless codec that produces ‘small’ filesizes while at the same time FFmpeg (our converter) supports it.

3. Once your have a final cut on Vegas, select “Render As” from its “File” menu. Select the .avi format from the “Save as type”, and then click the “Custom” button on the right side of the dialog. On the first tab select for “Video rendering quality” to be “Best”. On the “Video” tab select the field order to be “none, progressive scan”, select the right aspect ratio for your video, and on the “Video format” select “Huffyuv v2.1.1”. Once Huffyuv is selected, hit “Configure”, which is a button next to it. In the new window popping up, select for “RGB compression method” the “<-- Convert to YUY2” option. Hit “ok” in that window to go away. Back to the main “Custom Template” dialog, hit “ok”. Now, back on the main “Render As” dialog, for file name pick the name “Untitled.avi”, then immediately hit “save” and sit back while your video is being encoded to the Huffyuv lossless format. Be aware, the file size will be pretty huge, but at least you won’t be losing any quality.

4. In the meantime, install the PS3Video9 utility from here. Navigate to C:\Program Files\Red Kawa\Video Converter\Tools\FFmpeg\ and copy away the ffmpeg.exe and pthreadGC2.dll files found there. Feel free to uninstall PS3Video9 now (I recommend against using it as it can’t deal with interlacing correctly, it has a bad ad-ridden UI).

5. If the encoding has finished, move the Huffyuv-encoded “Untitled.avi” file on the same folder you have copied ffmpeg.exe & pthreadGC2.dll at.

6. You now have several options on how to encode your final file, but I have ready for you some templates, just download them and unzip them on the same folder that ffmpeg.exe is at (zip file’s last update: Dec 11 2007). As long as your .avi file is called “Untitled.avi” too, all you have to do is double-click on the desired .bat file. Use 1080p-30.bat for PS3/XBox360 and for TVs that are actually 1080p, use 720p-30.bat for PS3/XBox360 and for 1080i/720p TVs, and use 480p-30 for EDTVs, normal TVs, the AppleTV or if your source video is DV instead of HDV/AVCHD. Of course, if your footage is 24 fps, use the .bat files that their filename has the word “24” in them instead of “30”, or choose “25” if you are in a PAL country. Other formats are also available within these templates. Encoding will take some time depending on the speed of your computer, so be patient. Make sure that no other programs are running at the time, and that you are not swapping (aka “paging”, being out of RAM).

6. Now copy the resulted file on the multimedia device you want to, and enjoy it!

Important Notes

1. My .bat files are creating optimized h.264 files in two passes for optimal quality, although you can certainly edit some of these .bat files to change some aspects of the encoding. For example, you can speed-up encoding by doing only one pass. Remove the “-pass 1” attribute from the first ffmpeg paragraph and then remove completely the second paragraph, save the .bat file and then encode. Also, you can tweak the bit-rate by tweaking the numbers of the -b and -bt attributes. You can always edit the input video filename (in my .bat files it’s called “Untitled.avi) and the output video filename etc. Finally, the -title “XXXX” attribute sets the title on the video, so replace it with your own title (e.g. “A day at the zoo”). If you are on a PAL system, change all the instances of “-r 24000/1001” (or whatever value is after the -r attribute) to “-r 25000/1001” instead.

2. You can choose to de-interlace inside Vegas as I showed above (recommended), or you can de-interlace later, through ffmpeg. If you decide to de-interlace through ffmpeg, you must add the “-deinterlace” attribute *exactly* after the two “ffmpeg.exe” words on the .bat file of your choice. It must be the FIRST argument that ffmpeg gets, otherwise its de-interlacing creates a bad ghosting effect where there is fast motion. Yeah, I know it’s weird, but that’s ffmpeg we are talking about, the king of weirdness.

3. As you noticed, I recommended you encode at 480p for the AppleTV instead of 720p. This is not only because the AppleTV supports files only up to 720/24p instead of 30p, but also because the Quicktime engine (that AppleTV uses) has real trouble decoding videos encoded with the x264 encoder. It seems that Apple has optimized their Quicktime to only playback smoothly files that were encoded with Apple’s encoder. Problem is, Apple does not provide the right tools to do what we need here (lack of de-interlacing on Quicktime Pro, FCP is expensive), but also quality of the Apple h.264 encoder sucks compared to x264 and it’s ultra-slow to encode. So, I recommend staying with my method even at the expense of AppleTV. Hopefully, AppleTV 2.0 will be better/faster in that respect. My FFmpeg templates use CAVLC instead of CABAC so this should help the AppleTV to render the files easier.

4. In the most recent versions of the file I also added a few more templates, one for the (480×270 video sized) iPhone, one for the PSP (just copy the also 480×270 file on a folder named just “VIDEO” of the root of the PSP’s memory stick — create the folder if it doesn’t exist) and one for the QVGA iPod/iPhone+Symbian (for Symbian devices that run either UIQ 3.0+ or S60 3.1+). Unfortunately, there is no way to have the same h.264 file playing on both the Apple iPhone and the Sony PSP (even if the output resolution/bitrate is the same) because they are both really picky and not very compatible as to what they are expecting. This is why there are different templates for each. Also, there is an MP4 template that will create videos for QVGA cellphones. The “PMPs-and-NokiaInternetTablets” template is for these Asian XViD PMPs that are usually sold for cheap online, and Nokia’s 770 and N800 Internet Tablets. There are also two HD templates for XViD. Finally, the “FlashVideo” template is for adding Flash video on your own web site (*not* for uploading to YouTube or other video sharing sites). For more in-depth Flash video tutorial and additional Flash templates, check here.

5. For the PS3 in particular, you can copy the encoded h.264 .mp4 files on a folder called “VIDEO” (upper case) and then burn that to a regular DVD media (as normal files, not as DVD-video). The PS3 will automatically recognize it as a video-oriented media and it will playback the HD .mp4 videos in there directly from the DVD disk. If you will burn on a CD media instead, the bitrate should never exceed 8 Mbps, or the playback will stutter.


tommy wrote on August 13th, 2007 at 3:19 AM PST:

hi eugenia, thank you so much for this and the earlier blogs… it really helps me sort through this hv20 and how to edit it in sony vegas…

This is the admin speaking...
Eugenia wrote on August 13th, 2007 at 3:42 AM PST:

Glad to help out. Email me if you have questions/probs.

Mauricio wrote on August 13th, 2007 at 5:52 AM PST:

Hello from Brazil Eugenia!!!

I have a really simple question for you.If you could help me I would much appreciate.It is the following : I just bought a hv20 , and I dont have a proper tv set to enjoy it like it was supposed to be.I am thinking about buying the Lg 42PC7R
1024 x 768 pixels
Brightness : 1500 cd;m2
Contrast : 10.000:1
Hdmi input
Would this TV be good enough ?
Thank you so much for your time.
Mauricio Farias

Mauricio wrote on August 13th, 2007 at 5:56 AM PST:

I forgot to tell you .Its plasma.Would Lcd be better?
Thanks again.
Mauricio Farias

tommy wrote on August 13th, 2007 at 6:17 AM PST:

i gooogled your model number and this forum seems very active, your prolly better off asking there
TV looks ok though!

This is the admin speaking...
Eugenia wrote on August 13th, 2007 at 6:45 AM PST:

Mauricio, no, this TV is not good. If indeed its resolution is 1024×768, then it is NOT a 720p/1080i TV, but a 540p one. You must buy an HDTV that has resolution at or over 1280×720 in order to properly enjoy it with your HV20.

Hugo wrote on August 13th, 2007 at 11:49 AM PST:

It’s easier to use ffdshow-tryout rather than separate codecs for ffmpeg and huffyuv. Also the configuration dialog for each codec of ffdshow-tryout saves you a lot work when fine tunning all the settings.

This is the admin speaking...
Eugenia wrote on August 13th, 2007 at 6:43 AM PST:

>It’s easier to use ffdshow-tryout rather than separate codecs for ffmpeg and huffyuv.

I have ffdshow-tryout and it is NOT easier to use, it’s a mess instead. Besides, Huffyuv is a very popular free codec. More over, you can’t use ffdshow-tryout from WITHIN Vegas Movie Studio because the application itself does not let you export at 1920×1080. The app is artificially limited to export only up to 1440×1080, in order to differentiate the app from the Vegas professional version. Thing is, not everyone owns the pro version of Vegas.

Love2Scoot wrote on August 14th, 2007 at 2:01 AM PST:

Great site- I especially like the info on HD video. It’s a very exciting time right now for HD camcorders where the incredible capabilities of the hardware are met with the abysmal state of affordable HD software tools. You do a very good job of addressing this.

I’ve tried to find if you have covered this anywhere, but I haven’t been able to find the info on your site.

HDV Video playback on the PS3:
I have a PS3 and a Canon HV20. Playback of the RAW footage is actually quite easy with the PS3. As of firmware 1.80 (current is 1.91) you can play back a data DVD with the RAW .m2t files (captured from the camera) on the PS3 with no problem.

My basic method:
1) Capture video to computer using Vegas
2) Burn the desired RAW .m2t files to a regular DVD using Nero.
3) Insert DVD into PS3, it pops up as a DATA disc
4) Open the data disc and select the .m2t file for playback

This is a great solution, because you can see the footage completely untouched (except for the HDV compression). This is quite an affordable way to see your footage.

The disc format I’m using is ISO, but I will be testing UDF soon. If UDF works, you could technically have a single .m2t file that is the size of your entire DVD (dual or single layer). In this way, when you put the disc in, you could select the single file from the PS3 menu and playback a series of clips or a completely edited piece (by default the PS3 playback stops after each .m2t file)

Just thought this might add another (and quite easy) option to what looks like a fairly comprehensive look at the current state of the ~$1000 HD camcorder market.

This is the admin speaking...
Eugenia wrote on August 14th, 2007 at 2:02 AM PST:

Thanks for the comment, but you commented it on the wrong story (I transfered your comment here).

BTW, there are problems with the PS3 and raw .m2t files, some of them don’t playback, see here.

Another problem is that you can’t fit as much data on a DVD disk burned with .m2t as you can with h.264. I use 10mbps for my .h264 1080p videos, while HDV is 25mbps. This means that I can store 2.5 times more footage, at almost the same quality than you can. Plus, my footage would be well-edited while yours would be… welll… raw. ;-)

Love2Scoot wrote on August 14th, 2007 at 9:14 AM PST:

Yeah- you see that guy who started that thread- yeah that was me. The problems were cropping up with pre v1.8 firmware- so this issue is now fixed.

True, there is an advantage to more footage per DVD, but I find the quality more than compensates for this. Besides @ 8.5GiB per dual layer DVD you should be able to squeeze 48-52 minutes of 25Mbps video onto a single disc. For most stuff I shoot, this is fine for a single subject.

Additionally, you could always edit w/vegas, output to tape and then recapture to a single .m2t. This would give you a fully edited video with the best picture quality. I find this especially important with the HV20, since I want to be able to see all the detail I capture.

Comments are closed as this blog post is now archived.

Lines, paragraphs break automatically. HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

The URI to TrackBack this blog entry is this. And here is the RSS 2.0 for comments on this post.