Canon AVCHD 24p Pulldown Removal

Note: This tutorial is for AVCHD cameras, for HDV look here.

Introduction (article updated constantly)

Canon’s consumer HD cameras have 24p support, only that it’s not a… truly true 24p. It’s PF24, which incorporates both progressive and interlaced frames in a 60i stream. To get the pure 24p stream out of it, you need to do a “pulldown removal” (aka “inverse telecine”). PAL users do not need to do this because their PAL cameras don’t have a PF24 mode — this burden is only for NTSC users who manually chose to shoot in the PF24 mode. If your final output is the TV (e.g. via DVD or the camcorder itself), and as long as you never de-interlace that footage during editing/exporting, then you don’t need to remove pulldown. But if your output is not a home DVD/TV but the web, or a PC, or other non-TV viewing device, then you better get to work and remove pulldown because your footage will have an ugly “ghosting” effect whenever there is motion on the screen. Here are pulldown-removed images before & after, showcasing the problem and its fix. Here’s another example showing the problem.

There are several ways to remove PF24 pulldown for the Canon HDV cameras, but their AVCHD cameras (e.g. HG10, HR10) did not enjoy the same fate, until now. If you are using the latest versions of After Effects or Final Cut Pro, then you can use the tutorials linked to remove pulldown (although I have not confirmed that these tutorials will work for AVCHD formats as well). On the PC side, the cheapest, fastest and cleanest way to do it, would be to purchase the Cineform NeoSCENE tool for $129. Highly recommended.

However, there is another way, a freeware method, as long as you already have a video editor that supports the AVCHD format, DirectShow/VfW and 24p (e.g. Sony Vegas/VMS, AE/Premiere, Avid etc). Please note that Premiere Elements, Pinnacle, Magix Movie Edit Pro and Ulead don’t support true 24p so avoid these for 24p editing. Premiere Elements can do 24p editing only after installing a 24p Premiere Pro template file from Adobe’s site. The following method is an involved procedure to follow and it requires some very basic usage of the DOS prompt (found in Windows’ Accessories program menu as “MS-DOS”), but if you have no money and you need it done, it should work fine as long as your clips are not too long (tested with HG10’s PF24 files). Longer clips (over 3 minutes or so) might crash the mencoder utility used below, or create A/V sync issues. If you really need this done the proper way, use AE/FCP, or buy Cineform NeoSCENE.

Windows XP/2k/Vista


Method 0 (for Vegas users only)
Read about it here. Come back to this article to use another method if this one is not good enough for you.


Method 1

1. Install Avisynth.
2. Download and unzip the TIVTC v1.05 plugin. Inside that zipped folder, you will find a file called TIVTC.dll. Drag-n-drop that .dll file on the C:\Program Files\AviSynth 2.5\plugins\ folder. Vista/XP 64bit uses a different path.
3. Unzip ffmpeg somewhere.
4. Install Avid’s DNxHD PC codecs at the bottom of this page, (or Huffyuv).
5. Download and install the latest ffdshow version.
6. Unzip the Batch Intermediate Creator somewhere (thanks goes to Khaver, read discussion in that link).).
7. Load its ffmpeg-bic.exe application and fill up what it needs to know, like in my screenshot here.
8. Click the “ffdshow video decoder configuration” and make sure the “deinterlacing” checkbox is checked. Also, make sure that ffdshow is the default .m2ts/.mts decoder in your system (you can set the h.264 codec in the ffdshow configuration panel to “ffmpeg-mt”). Otherwise, it won’t work correctly.
9. Add some PF24 files, and start the process. This will create either Avid DNxHD .mov files, or Huffyuv .avi files at 23.976 fps, progressive. I would suggest you go with the Avid DNxHD codec.

The setup as shown in the screenshot also creates proxy files — smaller versions of these big 24p intermediate files that are too slow to edit. Here’s how to use proxy files with Vegas. It is possible to tweak that proxy editing tutorial for other 24p-capable editors too. You can uncheck the proxy-related checkboxes to not create any proxy files.

This method works with *some* AVCHD formats from some manufacturers. Others crash. You will have to try to see if it will work with your AVCHD format or not. If they don’t work, use method 2.


Method 2

1. Download the plain version of Mplayer for Windows and unzip it somewhere that you can find back easily. Inside that unzipped mplayer folder, create a folder named “input”, and a folder named “output”. This action only needs to be done once for your system.

2. Download the Huffyuv lossless codec. Unzip the .zip file on your desktop, right click on the huffuyv.inf file and select “Install” (note: Vista might not give you that option, in which case manual registration of the codec’s DLL file must happen via the DOS prompt, google it). After about 15 seconds, you can delete these files from your desktop, as the Huffyuv lossless codec is now installed on your system. Open a DOS prompt and navigate to the mplayer folder (e.g. “cd C:\Mplayer\”, without the quotes). There, run this command: vfw2menc -f huff -d huffyuv.dll -s settings.mcf and on the new dialog that pops up select: “Predict median (best)” from the first drop down menu, and “<-- Convert to YUY2" from the second drop down menu, while leaving unchecked the other options. Then click "ok" to discard the Huffyuv configuration dialog. This action only needs to be done once for your system. 3. Download the Lagarith lossless codec. Unzip the .zip file on your desktop, right click on the lagarith.inf file and select “Install” (note: Vista might not give you that option, in which case manual registration of the codec’s DLL file must happen via the DOS prompt, google it). After about 15 seconds, you can delete these files from your desktop, as the Lagarith lossless codec is now installed on your system. Open a DOS prompt and navigate to the mplayer folder (if it’s not open already at that folder). There, run this command: vfw2menc -f laga -d lagarith.dll -s settings.mcf and on the new dialog that pops up select: “YUY2” from the “Mode” menu, and “Use Multithreading” if your CPU is hyperthreaded/multi-CPU or it has more than one Core (leave unchecked if you don’t know). Then click “ok” to discard the Lagarith configuration dialog. This action only needs to be done once for your system. Note: Do not change to YUY2 if you are using Adobe’s editors, as they don’t understand that format.

4. I will work with Vegas on this step because that’s what I use, but it should be similar for Premiere/AE/Avid. Open Vegas and load your PF24 .m2ts or .mts AVCHD files in the “Project media” bin. Make sure that these files were indeed recorded as PF24 (don’t mix 60i and PF24-recorded files), and that your hard drives are formatted in NTFS. Then open the “Project Properties” dialog and use the HDV 1080/60i template from the drop down menu. Now you have two options, either pull all your scenes at once in the timeline to export, or export them one by one. The first method does not require your attendance, but it will produce one large file that will have no scene detection, while the second method will produce lots of per-scene files, but it will require that you be in front of your computer quite often to export the scenes one by one. Think hard of what your needs are, and make your choice. I would personally recommend you export the scenes one by one mostly because this way you can avoid the possibility of the audio and video getting out of sync (plus, MEncoder is known to not handle huge files too well either).

5. Once the clip(s) are on the timeline, hit “File” and “Render As”. Select .avi for the “Save as type”, and the “HDV 1080-60i intermediate” template. Then, hit “Custom”. On the first tab select “Best” quality. On the video tab leave everything as is except the video format, select there “Huffyuv v2.1.1”. Then, hit “Configure” and a new dialog pops up. There, make sure that “Predict median (best)” from the first drop down menu, and “<-- Convert to YUY2" from the second drop down menu are selected (leave unchecked the rest of the options there). Then click "ok" to take that new dialog away. Leave unchanged the "Audio" tab, and then hit "ok" in the "custom template" dialog. Then, you must give a name to your .avi file. If you chose the "one big file with no scene detection" method give it any name you want (as long as there are no spaces), but if you chose to export the scenes separately then use the same filenames as in their original AVCHD files, but with the .avi extension this time, and with no spaces in the filename. Export the files in the "input" folder you created inside the Mplayer folder. 6. After all the exporting is done, open a DOS prompt, navigate to the Mplayer folder that has the mencoder.exe file in it, and then run the following command, substituting each time the right input/output filenames with your own video filenames: mencoder input/INPUT_FILENAME_001.avi -aspect 16:9 -fps 30000/1001 -oac pcm -vf detc,scale=1440:1080 -ofps 24000/1001 -ovc vfw -xvfwopts codec=lagarith.dll -o output/OUTPUT_FILENAME_001.avi
If you are proficient with DOS scripting, you can even write a script that will automatically read all the files on the “input” folder and export them one by one without requiring your attendance. Phoric wrote such a script and sent it to us (save it down and put it in the mplayer folder before you execute it). Thanks Phoric!

7. After MEncoder is done re-encoding all your files, you can choose to delete or move away the .m2t files on the “input” folder (so they don’t mix with video files you will place there in the future), while all the .avi files found on the “output” folder are now ready to edit! Windows Media Player won’t recognize these files as widescreen, but don’t worry, they are widescreen: Vegas will recognize them as such (if not, just set manually the clips’ aspect ratio to 1.3333). Create a new project in Vegas (or any other 24p-enabled video editor), select again the HDV 1080/60i template, but change the following this time: Field Order should be “progressive scan”, frame rate should be “23.976” (type it if it’s not in the list), rendering quality “Best”, and de-interlacing method “none”. Then, edit as usual and enjoy true 24p!

NOTE: Trevor Marshall suggests an alternative method (not tested by me, might have an audio sync issue).


Mac OS X

1. Download, unzip and drop the MEncoder files for Mac OS X on a folder of your choice, e.g. on one that’s called “mplayer”. Create two folders in that folder, one called “input” and one called “output”. This action only needs to be done once for your system.

2. Use a Quicktime-enabled application (any will do, as long as it has access to Quicktime’s exporting dialogs) to export your AVCHD files as MJPEG/PhotoJPEG inside the “input” folder. MJPEG is not exactly a lossless codec, but it’s the only high quality near-lossless codec that comes out of Quicktime that MEncoder will support.

3. By using OSX’s Terminal.app, navigate to the mplayer folder (it requires basic understanding of Terminal usage), and then use the following MEncoder command line to remove pulldown and export in Huffyuv, like this:
./mencoder input/INPUT_FILENAME.mov -aspect 16:9 -fps 30000/1001 -oac pcm -vf detc,scale=1440:1080 -ofps 24000/1001 -ovc lavc -lavcopts vcodec=huffyuv:pred=0:format=422P:vstrict=-1:aspect=16/9 -o output/OUTPUT_FILENAME.avi
You need to manually replace the filenames for INPUT_FILENAME and OUTPUT_FILENAME for each of your files.

4. After all the encodings are done for all your files, you can safely delete the files inside the “input” folder. Your final, true 24p files to be used with editing can be found on the “output” folder.

5. Install the “Perian” utility which will enable Quicktime-enabled video editors to read and edit these created Huffyuv .avi files. This action only needs to be done once for your system.

If you are proficient with Bash scripting or AppleScript, you can write a script that will automatically read all the files on the “input” folder and export them one by one using MEncoder without requiring your attendance. If you write such a script, please send it to me to incorporate it in this tutorial and help others. Please note that iMovie and Final Cut Express don’t support true 24p editing, so if these are the only video editors you got, then either don’t bother removing pulldown, or buy a PC to do the job (it will be cheaper to buy a fast PC with 2 GB of RAM and Vegas Platinum and use that as a dedicated video station, than buying Final Cut Studio or After Effects for the Mac).


Linux

There is no way to apply this method under Linux because MEncoder crashes when you try to read an AVCHD file, while ffmpeg has a known bug in the reading of such files that results the video to export twice as long as it should. As of this writing, no Linux library or application can read AVCHD files properly.


Important Notes

1. Admittedly, this is a slow way of doing things. For 1 hour of footage, it will take between 8 and 10 hours to complete the various exports, depending on the speed of your computer. If time is money for you, buy Cineform’s NeoSCENE. If not, let it run overnight. A trick you can do to speed up the various exports is to have the input and output files on different hard drives. For example, when exporting the AVCHD files in the beginning, have the AVCHD files on one drive, and export into the “input” folder of MEncoder on another drive. Then, while using MEncoder, encode the “output” files back to the first hard drive again. This can save up to an estimated 15% of time in the overall process because the hard drive’s head won’t jump like crazy back and forth to service both the input file reader and the exporting encoder, but instead each hard drive will dedicate itself to a single action.

2. You will need a lot of storage. We are talking about 180 GBs per 1 hour of footage, because there are two stages of Huffyuv/Lagarith encodings going on. After the export to the “output” folder is done, you can delete the files found on the “input” folder, in order to save some storage space. Always keep around the original AVCHD files though.

3. Editing Huffyuv or Lagarith files can be pretty slow, because their filesizes are so large. You can choose to edit them directly and be done with it, or export again in Cineform 1080/24p/progressive through Vegas/VMS’s .avi custom codec dialog, and then edit these Cineform files instead. It’s pretty fast to re-encode in Cineform, its format is fast to edit too, and because all these codecs are visually lossless you won’t see much of quality degradation after all these exports. Another way to deal with this problem is to use proxy files (faster way). But I leave this decision to you as to in which format you want to edit with, because exporting and re-exporting until you reach a fast codec can be nerve-wrecking.

4. Vegas Platinum 7/8 won’t export in full 1920×1080 (limited to 1440×1080 export size), so you will need to use either the “SUPER” or “Handbrake” freeware utilities, to go around the problem and export in full 1080/24p. Vegas Platinum 9 and Pro don’t have this limitation. If you are ultimately exporting for Vimeo’s glorious 720p HD web service, check my tutorials here.

8 Comments »

Alessandro wrote on January 4th, 2008 at 5:35 PM PST:

I don’t even know if it’s relevant, but I happened to read this today, where the guy explain how to transcode mts AVCHD files in Linux. But I may be wrong: I still have to understand what a mts AVCHD file is.


This is the admin speaking...
Eugenia wrote on January 4th, 2008 at 5:48 PM PST:

I’ve read the method he describes, but I am not convinced that the tools he used export in lossless formats. It seems that he is re-exporting in mpeg2, and then using ffmpeg to export to something else. This takes a lot more time, it’s difficult to get the right utilities in one place or not to lose quality during all these re-exports, and at the same time keep the cadence unchanged so mencoder can remove pulldown properly. There are too many “if” in this method, because we are not just trying to read AVCHD files here, we are trying to also process them without losing their original attributes.

So overall, while this method might be the last thing someone should try, I am not convinced. MEncoder and FFMPEG should add native support for AVCHD before the whole Linux thing becomes really viable for pulldown removal (or even plain AVCHD usage).


Yves Boisjoly wrote on January 9th, 2008 at 6:48 AM PST:

Well… I just bought the Canon HG10 last Sunday thinking that I would have a Full HD 1080p resolution on my SONY Bravia Full HD 1080p…

Now I understand that I will never achieve a real progressive 1920x1080p resolution, Am I right?

I still have some questions. I have a MacBook with Tiger and iMovie 06. After I plugged the Canon HG10, I was only able to open the new drive from the desktop. Nothing could be done with iMovie 06. Back on the specifications from the retailer, I realized that it was only compatible with version of iMovie 08. In the attempt to upgrade to this version, the retailer told me that the last version of the Mac OS X, version 10.5.1 called Leopard does include iLife with iMovie 08, so I bought that. This is unfortunately not true!

Yes iLife 08 come with a new computer with Leopard installed, but I did upgrade my Tiger with Leopard from the original CD and I finished with a new desktop environment but still with my previous version of iLife applications! iLife is NOT included with the OS X Leopard CD !!

My next step idea was to go and buy iLife 08. After I just read your article I have some questions…

Should I understand that even with iMovie 08 I should never use the 24PF setting?

I did a test with two movies, one in 60i and a second in 24PF, both were in mode “CINEMA” at 1920x1080i on the HG10. Then I imported these two clips into a PC with Windows XP Professional and ULead installed from the CD-ROM that came with the Canon HG10. My question is why these two clip formats were reported as 1440×1080 at 29.97fps ?

Does it mean that even at 1920×1080 we still record the movie at 1440×1080 ?? This isn’t it a compression ??

Yves


This is the admin speaking...
Eugenia wrote on January 9th, 2008 at 1:06 PM PST:

Haha, welcome to the cruel world of HD marketing.

So, to get support for your AVCHD camera, you need iLife 08. You didn’t need Leopard, you just needed iLife 08 that has iMovie 08 in it. iMovie 08 sucks, and has fewer features than iMovie 06. So what you need to do is give back Leopard if you don’t want it, buy iLife 08, capture from the camera with 08 to change the .m2ts files to .mov files, and then iMovie 06 can open these .mov files and edit them.

Now, iMovie OR Final Cut Express, DO NOT support true 24p. Neither Ulead does. You need a professional editor, or Vegas Platinum to get support for true 24p (after you remove pulldown). Which is what this tutorial here does, to tell you how to remove pulldown and change the bastardized PF24 format that Canon writes to the camera, to true 24p. However, if you don’t want to upgrade your editor, you just leave the pulldown inside the stream and edit as 60i, but you are risking ghosting. If you don’t remove pulldown, you get what you got: 29.97 fps, because the 24p is wrapped inside the 60i stream.

Now, as for the 1920 vs 1440, the current Canon cameras only record at 1440×1080 with aspect ratio 1.3333. It is not full HD. The sensor in the camera is full HD, but they write down in the hard drive a portion of that data. 1440*1.3333=1920. That’s how you get your 16:9 to fill up your screen, with the usage of that aspect ratio. But no, it’s not full HD, and it’s not progressive either. If you de-interlace the footage, you will get 1080/30p. But it will still be 1440, unless you resize to 1920.

The new Panasonic cameras that were announced at CES have full HD recording and 24p support. Although I must say, you don’t really need 24p. It’s a gimmick and NOT recommended for casual recording. Unless you are filming a movie or a music video clip for your local indie rock band, avoid.


Yves Boisjoly wrote on January 10th, 2008 at 4:46 AM PST:

Okééé !!!

First, for Leopard, I must say that I am a UNIX Administrator and that I used Linux for at least 15 years. I understand that iMovie 08 doesn’t need Leopard and I also have read into another tread that Leopard is hungry on memory BUT,… One thing present in Leopard that wasn’t present in Tiger but that I used to use a lot on Linux is the multiple desktops. Now that I get it back from Leopard, I need it 😉 And my MacBook is fill up with 2G of RAM. Right now I consume 822Mb of active memory and I have Mail, Safari, Text Edit, iTunes, iMovie 08 and iMovie 06 running all at the same time!!!

I don’t know if you ever work with multiple desktops, but since I used them with multiple servers to administrate, I cannot understand peoples that don’t use that feature, except for those who use Windows ! 😉

May be it is because I have a to much structured mind… (lol)

Picture a matrix of 16 desktops, 4 rows by 4 columns, you configure your preferred applications to always start on their respective desktop, that you choose yourself, and with a squeeze on your mighty mouse all your desktops zoom out onto your screen, then you move you pointer to the one you want and click! It come back in front plan… It is so nice….

Second, when I read your comments regarding iMovie 08 versus iMovie 06, I was a little bit frustrated. But the good thing is that I found that the installation of iMovie 08 actually keep your iMovie 06 into a new folder called “iMovie (previous version)” under the Applications folder, good! Now my frustration is gone 🙂

Still I would appreciate to heard your opinions regarding the pros and cons of each version respectively…

As for the camera, my first choice was the JVC Everio GZ-HD7U simply because it was the one with the higher price. I thought that this had the chance to be the better one. Then I compared all the HD available at Future Shop (Montreal). My first criteria was of course the MacBook compatibility and I kept all the models compatible with iMovie 08 (before I realized I had iMovie 06). Finally I kept the models with hard drive. I finished with three models. Here are their respective specifications resumed (I hope the tabulations will be respected here):

Model Canon HG10 SONY HDRSR7 JVC GZHD7U
========= ============ ============ ==========
Price 1099.99 1299.99 1499.99
24p Yes No No
60i Yes Yes Yes
Video AVCHD AVCHD Mpeg2
Resolution 1920 x 1080 1440 x 1080 1920 x 1080i
Audio 12 bits Yes No No
Audio 16 bits Yes Yes Yes

The first thing I noticed was the 1440 resolution of the SONY, I disregard this one. Then the JVC was in Mpeg2 and when I saw their movie publicity on the web, I realized that it was also 1440 not 1920 ! So with the Canon, same brand as my actual Canon Rebel XT camera, new version of the softwares “Canon Utility” and “Canon Browser” plus the 24p and the 1920 x 1080, it seem to be the better choice for me, not to mention the lower price…

What do you think? What is your opinion on the JVC one? Should I expect a more professional camera taking the price into account? I still can return the Canon and choose another one…

Basically, what I want to shoot are the Moon, Rising Sun and Falling Sun. I am an hobbies astronomer. See my pcitures…

Best regards,
Yves


This is the admin speaking...
Eugenia wrote on January 10th, 2008 at 10:47 AM PST:

Yves, I know what virtual desktops and Linux are. You probably don’t know who I am…

As for full HD, go for the new Panasonic.


Jason Marks wrote on January 14th, 2008 at 10:51 AM PST:

Hi, Eugenia.

i’ve got a PAL HG10 and am using vegas 8 to edit on my PC. i’ve tried the tutorial to pulldown but had no luck. am i right in thinking that i would have to change the “Project Properties” template to HDV 1080/50i instead of /60i? and would i also have to change anything in the mencoder command code or anything else for that matter in the whole tutorial?

thanks for your time

regards
Jason


This is the admin speaking...
Eugenia wrote on January 14th, 2008 at 2:13 PM PST:

Jason, yes, your project properties must be on 50i. However, YOU don’t need to remove pulldown. I really don’t understand why you are trying to do this, because this is clearly for 24p. PAL uses real 25p, without pulldown added, so YOU DO NOT need to remove any pulldowns. You just use the 1080/50i template, then change the field order to “non/progressive”, and de-interlacing option to “none”, and you edit directly on Vegas, you need to do nothing else.


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.