How to Repair Corrupted Quicktime Files

A few weeks ago I participated in a three-camera shoot of a concert using two 7Ds and a 550D. When I tried to transfer the files to a computer, I was shocked to discover that two of the files were corrupt. Worse still, they happened in the same scene from two different cameras, which also happened to be the most important song of the concert. What horrible luck. I have been shooting with DSLRs for quite some time, and I have never had a corrupt file, much less two on the same night, at the same time, on two different cameras! I immediatly began to research how to fix them, but found the info on the internet to be a bit lacking. I hope this post will give someone with the same problem a slightly easier time. 

Repairing Quicktime files for $
The UI of Treasured by Aero Quartet 
One clue that the data was salvagable was that, even though Quicktime (or any other program for that matter) couldn't open them, the files were of an appropriate size (about 2GB). The first solution I found was a program called Treasured from Aero Quartet. I downloaded it for free, ran it on one of the files and it immediately showed me the recovered frames. It was only then that I realized that you have to pay per file with this solution. I have read online that people have had good results with this program and you only pay if they can fix the file but I thought if Treasured can show me the frames, there must be a way to fix it for free.

Repairing Quicktime files for free
After some time I found two free methods which worked for me. The first is very simple, but only worked for one file. What perplexed me about the corrupt file from my camera (the 550dD) was that I had watched it in the camera the night before. I put the chip back in, and sure enough, the file that would not play in Quicktime played back in the camera perfectly. On both the 7D and the 550D you can trim videos in the camera. I trimmed a frame or two from the heads and tails and chose the option to save a new file. Bingo! The new file played back perfectly in Quicktime. Excited, I put the file from the 7D on to my SD card, but the 550D couldn't read it. I had my friend try the same thing from the original CF in her 7D, but the 7D was unable to read the file as well. Damn. 

The UI of HD Video Repair by Grau GbR

Eventually I found another solution: A free program called HD Video Repair from a company called Grau GbR. The program looks complex, but really is quite simple. You select the file you want to fix and as well as a reference file (which is a non-corrupt quicktime from the same camera).  You then click "Scan" and wait. It is hard to tell that it is doing anything once you click scan, but be patient it is working. The program seems like it was relatively quickly hacked together, so it lacks some polish. Eventually, the filename will appear in the space below the scan button. By default, the repair file will go to a folder called repaired in the same location as the corrupt file. The resulting repaired Quicktime still seemed to have some codec glitches in my case, but converting it to ProRes seem to fix that. The audio was also out of sync, which I imagine is fixable in the advanced settings, but since I am using an external recording anyway, it didn't matter to me. HD Video Repair is Donationware

TL;DR
Repair Corrupt Quicktime Files for Free by: 

Repair Corrupt Quicktime Files at a Price

Other Arbitrary Blog Posts
Songwriting & Solitude with Christina Maria
Goodnight Company by Jane Lui
Kodachrome is Dead  

How to Hack your Canon G9 Firmware for HD Timelapse.

Photo: Karla AriasLately, I have been shooting a lot of time lapse footage using my Canon G9 that has been hacked with the custom CHDK firmware. This user-developed firmware works on a variety of Canon Point and Shoot cameras and enables all kinds of extra functionality (expanded ISO, higher shutter speeds, RAW capture, and more.) The best feature of CHDK is the ability to add scripting to your camera. One of the script possiblities is an intervalometer -- which programs your camera to take pictures at a desired interval, which you can later make into a movie in your computer. This allows you shoot greater than HD (up to 4000x3000) timelapse footage that you can downsample to full 1920x1080p for the highest possible image quality. The G9 is the most professional camera that this hack currently works on. It has high resolution, easy manual control, and a good lens. But in order to use CHDK, you must first install it -- which is not the most transparent process. So, with out further ado, here's how to hack your G9 (note: I use a Mac, so some of this is specific to OSX. A link at the bottom may help Windows users).

1. Determine what firmware version your G9 is running. You do this by creating a blank text file and saving it as ver.req (make sure it does not have a .txt extension). Copy this file onto your SD card with a card reader and put it into your camera. Turn your camera on in playback mode, then hold down (func. set) and press (disp.) This should display your firmware version. For Example 1.00G.

2. Download the appropriate version of CHDK. You can find all versions of CHDK here. Make sure you get the Full Version.

3. Prepare your SD card. This got a whole lot easier with the release of an apple script that does this for you. Download this script. Insert your SD card into a card reader. Run the script and select the SD card drive when it asks. (note: Be very careful not to select the wrong drive because it will ERASE it.) This will take a few minutes to process. Be patient. When it is done, you will see that the SD card has been made into two partitons. One is the boot partion, where CHDK is booted from. The other is for storage of pictures and CHDK files.(CHDK's How To Page for Mac)

4. Copy the DISKBOOT.BIN file and the PS.FI2 to the boot partition and the CHDK folder structure to the storage section of the SD card. Both of these will be in the CHDK version your downloaded in step 2.

5. Download this intervalometer script (and the optional motion detection script) and put these files in the Scripts folder on your CHDK prepped SD card.

6. Eject the card and lock it with the switch on the side. This sounds strange, but CHDK won't boot if the card is not locked. Don't worry, it will still be able to save your images.

7. Insert the SD card into the camera and turn your camera on. If you did everything correctly, you should see the CHDK boot logo appear. Now you have CHDK loaded onto your camera. The next steps will explain how to enter the CHDK menu and set up for a timelapse.

8. Enter the CDHK menu. To do this press the (direct print/shortcut) button that is on the upper left of the back of the G9. You will see <alt> appear on the bottom of the screen. Now when your press (menu) you will see the CHDK menu instead of the Canon menu. Feel free to play around with the options in this menu. It takes some experimenting to figure out.

9. For a time lapse, navigate to the scripting menu. Load the intervalometer script. Move down the the settings and set them as desired. I like to only set the interval in seconds, and then set the Endless option to 1 -- this will make the script run until you stop it or the battery dies.

10. Exit <alt> mode by pressing the (direct print/shorcut) button again. Now you need to set up your shot. Enter manual exposure mode and set your exposure. Also set your focus to manual. Use a tripod. Once your shot is set enter <alt> mode again. When your press the shutter button, the script will run.

11. That's it! Your G9 is now shooting timelapse! When you are done, press the shutter button again.

Once you transfer your shots to the computer you can compile them into a movie. There are several ways to do this which would be an entire other post.

Note: When you fill your card, do not format it to erase them. This will erase CHDK as well. Instead use the Erase All Images function in the camera menu.

Have fun shooting timelapse!!! If you have any questions about this, please ask in the comments section.

You can download all files mentioned in the article Right Here.

Link for Windows Users.

BONUS: Here is a time lapse I shot using this method at the Geneva Motor Show for Image Engineers.

Tips for Better Youtube Quality

A while back I posted an article to my old blog called '6 Tips for High Quality Youtube Videos.' Well that site doesn't exist anymore and Youtube is quite a bit different now so its probably time I update that article.

When posting to Youtube the first thing to remember is that it will make your video look worse. No matter what. Youtube is compressing your video and compression makes things worse. Period. However, if you follow some simple rules, you can minimize this worsening, or 'Youtubeification', to the point where it is not noticable. Read on.

1. Shoot the highest resolution and the lowest compression possible

There are about a million different video cameras on the market. There about 500,000 different video formats that they shoot in. Ok, I exaggerate, but your choices in shooting formats are immense. Some of these formats are better than others. To achieve the best results on youtube, choose the highest resolution and the lowest compression possible. For resolution, you should pick an HD camera (1920x1080 or 1280x720 pixels) over an SD camera (720x480 or 720x576 pixels). As far as compression goes, you want a camera that has the biggest file size possible once it gets onto your computer. Also, if you can see compression artifacts in your original video, these artifacts will get worse on Youtube. Ok, so you probably already own a camera and maybe its not perfect for Youtube. What else can you do to get better quality?

2. Use a Tripod!

That's Right! Using a tripod makes your video look more professional and it helps minimize the compression problems associated with Youtube. Why is this? Video compression is based on motion -- the more motion in the frame, the more work the compression has to do. When you shoot hand held, every frame is a little bit different which makes a compression algorithms go crazy. When you use a tripod, the image only changes when something in the frame moves which is a relatively small change. Or it changes when you pan or tilt, but these changes are smooth and predictable enough to be easy on compression.

3. Have plenty of light

Compression is based on detail. If things are dark it will be harder to achieve nice compression. This can be as simple as opening the blinds, turing on a lamp or going outside. In general, bright is better than dark for compression.


The following has changed due to Youtube's introduction of widescreen video. A new post is coming soon.

4. The secret ingredients to encoding for Youtube: at least 6000kbps h.264, 640x480 (640x360 for widescreen), Multipass encode, deinterlace.

No matter what you use to encode your video, these magical settings should insure a clean version to post to youtube. I personally use Quicktime Pro. So I will go over these particular settings here:

 

 

The Quicktime Pro Export Menu

Selecting the h.264 codec and setting

 

  • h.264 is the most modern codec available and is able to compress video in the best looking way possible.
  • At a data rate of at least 6000kbps the compression should be virtually invisible for a frame size of 640x480.
  • The frame size of 640x480 or 640x360(for wide screen) are chosen because this is the native frame size that Youtube displays
  • A Multipass encode checks each frame at least twice to ensure that it is encoded the best.
  • If you shoot on an interlaced format, you must deinterlace because computers are a progressive format. If you don't, you will see the so called 'mice-teeth' effect.
  • If you shoot on a widescreen format(16x9) then choose the output size of 640x360 (under custom in QTPro size menu)
  • One more tip: Try to get as close to the 1 gigabyte files size limit as possible by increasing the data rate. Don't go over board though. A 10 second clip won't ever be that big

There. Now you know the best settings to get the best out of Youtube. As a public service I have posted below two examples. One with the right way of doing things and one with the exact opposite. Enjoy!

This clip was shot with a Sony Z1U. It is a clip from my upcoming documentary "Legacy of the Great Aletsch"

This clip was shot with a janky $99 DV-DA1 VP crap camera. It is a clip of my cats shot a few hours ago.

PAL HDV to NTSC DVD

Well my Hell is over.I have been trying to figure out a sure-fire method of creating a NTSC DVD from a 1080i50 HDV source. I think I have finally discovered the best method. If you are trying to do this and its driving you crazy, then try following these steps. (this requires Final Cut Studio 2)

1. Export your final movie as a 1440x1080 50i Prores 422 file. Do this by going to file->export->quicktime movie and then selecting the Apple Prores 1440x1080 50i setting.

2. Open this quicktime in Cinema Tools. Select conform->23.98. This changes the frame rate by making the video playback 4% slower. This will be perceivable in the audio and will be fixed later.

3. Drag the conformed quicktime to into Compressor. Drag the Apple ProRes preset onto the file. Change the settings to:

  • In the frame controls pane select
    - Resize Filter: Better
    - Output fields: Progressive
    - Deinterlace: Better
    - Everything else at its defaults
  • In the geometry pane
    - Dimensions: Select 720x480 from the drop down
    - Pixel Apsect: Select NTSC CCIR 601/DV (Anamorphic)
4. Submit your compression job. For me this took approximately 4x realtime.

5. You now have a NTSC 24p ProRes 422 file. Import this into final cut pro, make a new sequence and drag it in. When it asks if you want to match the sequence to the file say yes.

6. Double click the audio in the sequence and apply the audio filter AUPITCH. Change the first setting called 'pitch' to 80. Leave everything else alone.

7. Export this file as a quicktime movie with the default settings

8. Bring this file into compressor. Drag the default settings for DVD encoding onto your movie (either 90min, 120min or 150min Best -- pick the one that your movie is less than or equal to)

9. The automatic settings should work but double check that it is making a 16x9 progressive NTSC movie. Submit you job.

10. Congratulations. When you are done this should make a nice NTSC DVD. It is not that commonly known that DVD NTSC can be 24p but in fact most commercial DVDs are 24p. All dvd players are able to convert the video to 29.97 in real time.

A couple of notes:
This work flow was for a project shot on a Sony Z1 your camera may vary.
If you have extra time you can de-interlace with the "best" method. But this takes MUCH longer and I think the benfits are negligible.
If you have ALOT of extra time you can do this all in one step by importing your HDV into compressor and changing the framerate to 29.97 with Framerate conversion set to 'Best.' But this take A VERY LONG time. My 55 minute project was going to take over a week on a top of the line Mac Pro. I have used this method with shorter projects at the results with this new method are the same if not better.

If you have any questions feel free to leave a comment. I a relieved to have figured this out and am happy to have shared it.