Converting the family videos from raw DV format to MP4 with Handbrake.

Going on 3 years in the parenting saga, we have a bunch of MiniDV tapes yet to be imported and shared with the family. I refused to use the built-in windows software as it doesn't support the most common or open formats, making an automatic "Windows Media Encode" out of the question.

Finally, I found a solution that is, at this moment, about 75% of the way through the latest MiniDV tape.

Steps and 3-line windows script (batch file) are:

  1. Import the raw DV files from your camcorder to disk. This part should be the easiest and requires little cpu, but a lot of temporary disk space (about 60G/hr).
  2. Install Handbrake if you haven't already. On Windows, the GUI download option now includes the CLI (command line interface). You can test one-off compression while tweaking settings in a mostly-complete UI. Note: Some options in the CLI are not yet in the Windows GUI, such as the latest de-interlacing option which uses less cpu while producing far higher quality video.
  3. Run the following script, by copying it's contents exactly to a file "compress.bat" in the directory with the video files you wish to encode. Note: you can rename the compress part, but need the ".bat" suffix. Also, this script will by default compress *all* *.avi files in the directory.









for %%i in (*.avi) do (




  "C:\Program Files (x86)\HandBrake\HandBrakeCLI.exe" -i "%%i" --decomb -t 1 -c 1 -o "%%~ni.mp4" -f m4v -p -e x264 -b 1500 -2 -T -a 1 -E faac -B 160 -6 dpl2 -D 1 -x ref=2:bframes=2:me=umh -v 




)






Items of note:
  1. As of today, the Handbrake Windows GUI didn't support the --decomb option, so I added it manually while removing the older-style de-interlace flag.
  2. The "%%~ni.mp4" line is something I copied from another script on the Handbrake forum. I thought "ni" was part of the filename so changed it to "vi" (i.e. *.avi"), and this broke the script. Thus, leave as-is for an exact filename usage while substuting the .avi for .mp4.
  3. I used the current Handbrake defaults, with the exception of --decomb, so this is probably pretty safe.
  4. Always make backups and do not run this script on files that are not backed-up. I take no responsibility whatsoever if this script does anything crazy. No warranty blah blah...
  5. You may need to change the path to "C:\Program Files (x86)\HandBrake\HandBrakeCLI.exe" to match your local install.
Hope this helps someone out there... Good luck!

Comments

  1. Good tip about the decomb option -- i'm converting some Sony/Panasonic proprietary AVCHD clips to H.264, but noticed the comb effect. Was going to live with it, but seems now I don't have to. HaxxorNF FTW.

    ReplyDelete
  2. [this may be a double post] Good tip about the decomb filter option. I am converting some Sony/Panasonic proprietary AVCHD files to standard MP4, but noticed the combing. Had resigned to live with it, but it seems now I don't have to. HaxxorNF FTW.

    ReplyDelete

Post a Comment

Popular posts from this blog

Mexican Shredded Chicken Slow Cooker Recipe