LVPE: Capturing & Deinterlacing DV Footage
(this post is part of the Linux Video Production Experience series, which chronicles my experiences with creating a high-quality home movie almost entirely in open source software.)
OK, just so I'm not wasting a bunch of time explaining something that someone else has already explained much better, go to 100fps.com and learn about the evils of interlacing, and why it's such a pain to work with under most circumstances. I'll just say straight up that I much prefer working with progressive frames while editing, so that's what I'm going to use in this production. I used mencoder to generate AVI files for Cinelerra. The most recent version in the Ubuntu repositories will be just fine (if you use Ubuntu, of course).
I captured all of my DV footage using Kino. Kino splits your DV files by timestamp. Capture all of your DV files to a directory just for DV files (let's call it "DV"). Kino is pretty self-explanatory, but you may have some permissions issues with the FireWire device in /dev. I always do, and they're easy to fix with a sudo chmod (and permanently with some udev settings, but I'm lazy).
Just so you know, I've tried doing the editing of interlaced footage in Cinelerra, both with and without Cinelerra's deinterlacer enabled, and it works, but it can get weird, especially when you accidentally move a camera or projector on a timeline with interlaced footage. I also like the deinterlacer in mencoder much better. :)
Create a directory alongside (not within) the DV directory and call it "Deinterlaced". Now, open a shell window and cd to the directory that contains the "DV" and "Deinterlaced" directories.
We're going to be reading the DV files and deinterlacing them using the very nice and very fast Yet Another DeInterlace Filter which was originally built for mencoder. We're then going to save each deinterlaced file out as an AVI file with WAV audio and almost-lossless MJPEG video frames. Cinelerra reads these files quite well. This small bash script will do the trick:
#!/bin/bash
for i in DV/*; do
echo $i
file=$(expr "$i" : '.*/\([^/]*\).dv')
rm Deinterlaced/divx2pass.log
for pass in 1 2; do
mencoder -oac pcm \
-ovc lavc \
-af resample=48000:channels=2 \
-lavcopts vcodec=mjpeg:nr=200:vbitrate=15000:aspect=16/9:vpass=$pass:mbd=2 \
-vf yadif \
-ofps 30000/1001 \
-o "Deinterlaced/$file.avi" \
"$i"
done
done
You can also download this script instead of copying and pasting it from the site: dv_deinterlace.sh.
If you're shooting with a consumer level camera and the lighting's bad, the footage will be noisy. The nr option in -lavcopts controls the strength of the noise reduction. 200 is pretty low, but it worked well enough for this production. Go too high and the footage gets blocky.
Note that this script assumes you've shot 29.97 FPS NTSC video that was interlaced by your camera, which most NTSC consumer level cameras will do (indicated by the -ofps 30000/1001 option). If you're already shooting 24p footage (23.97 FPS progressive), then you don't need to do this, you lucky Panasonic DVX100 owner. You can still use mencoder to denoise your footage, though. Remove the -vf yadif line, replace 30000/1001 with 24000/1001, and change the nr value as necessary.
This script also assumes you're shooting with a 16:9 aspect ratio (widescreen). If you're shooting 4:3, change the aspect option in the -lavcopts line from 16/9 to 4/3.
Now, this produces some very nice looking output when compared to the original frame (DV first, yadif second):
And a short video to illustrate the deinterlacer in action: Tasha deinterlaced (h.264 MP4, no audio, 1.5 MB)
If you really need to pump up the quality, and don't mind burning a ton of extra CPU time to do so, replace the -vf yadif line in the above script with this:
-vf yadif=3:0,mcdeint=1:0:10,framestep=2
This turns on both yadif and the motion compensation deinterlacer. This deinterlacer combo is of extremely high quality, probably as good as the hardware deinterlacers that are out there (I'm guessing). However, it will slow your processing time down to a crawl. For the footage I shot, I compared the results of just yadif to yadif+mcdeint, and the quality difference wasn't worth having my computer run at 100% for days. It only took a few hours for yadif alone to deinterlace an hour and forty minutes of footage. If it really matters, though, you know how to turn it on.
See what else is here...
- Jasmine and Vim, a happy pairing
- Fast JavaScript and CoffeeScript Unit Testing with jasmine-headless-webkit
- Actually Throwing One Away
- Slice and dice Cucumber run-times
- Site migrated and future plans
- Bash magic: convert a high-res PNG to a small PDF with convert and sam2p
- Bash magic: Get the chronological Originals contents from an iPhoto library that will fit on a CD
- What's the deal with "johncoswell"?
- Flex 3: Better SWF Embedding
- Ustreaming your desktop on Ubuntu Intrepid Ibex
- Mom's Delicious Pizza Dough Recipe
- LVPE: Avidemux and JPEG Photo AVI files not working?
- Guest strip!
- Dawn's Dictionary Drama is back!
- Video: The DC Conspiracy at Beyond Comics for Free Comic Book Day
- Joining the cartoon party: Myself as a Teen
- Quick Drying Paint: Profiling Inkscape using Valgrind
- LVPE: Encoding High Bitrate 24p Footage for DVD
- LVPE: Rendering and Exporting Video & Audio from Cinelerra
- LVPE: Processing a Bunch of Photos for Cinelerra
- LVPE: Color Correction in Cinelerra
- LVPE: Capturing & Deinterlacing DV Footage
- A Linux Video Production Experience
- Tons of .msp files in C:\Windows\Installer?
- A Moment of Inkscape Screenshots!
- The Amelia Rules! Charity Auction this Veterans Day
- PayPal and Visa: One card per account, ever?
- A Moment of Clarity Volume 2 Chapter 1 Reviewed!
- The Inkscape Perfect-Bound Cover Template Generator
- Freedom Dance wins in the 2007 Peer Awards!
- Untwisting the Spine of Perfect-Bound Books
- Small Press Expo 2007
- AMoC in Prismacolors and Brush Pens!
- Xinerama/TwinView + Single Screen + GTK = FAIL
- Baltimore Comic-Con
- ImageMagick: A simple, and kind of overkill, way to resize and pad an image
- Comics and Time Management
- Practical Inkscape for Comic Artists: The Right-Handed Illustration Keyboard Layout
- Red Hat High 2007 Update
- Cinelerra DV Rendering Problems? Try JPEG Photo
- Red Hat High 2007
- Freedom Dance!!
- One Reason Why Drawing Comics in Vector is Better Than in Bitmap
- Ogg Theora/Vorbis Conversion Information
- Linux iPod Video Conversion Information
- Libre Graphics Meeting 2007 - Creating Comics in Inkscape Presentation Video
- More Cinelerra and Mencoder fun!
- Libre Graphics Meeting 2007 - The Coswell Productions Report
- Libre Graphics Meeting 2007 - Wallpapers and Shirts!
- Indy Comic Review reviews A Moment of Clarity Volume 1
- Libre Graphics Meeting 2007
- Comics in Inkscape 0.45 with John Bintz
- Cinelerra Hints for Rendering
- Automating WinTV-PVR/ivtv captures in Ubuntu Edgy
- Inkscape 0.45 About Screen Content Entry
- Staircase Visualization for Volume 2
- Digital Minicomic Production - Using Free Software to Do Inexpensive Digital Paste-Up
- Blue Dot Television Commercial - A New Face
- Marylanders in Snow (Animation)
- Slippie Slide
- Blue Dot Television Commercial - Warm Up with Blue Dot
- TP Monitor
- Virus