Convert a movie to a 16 bit image sequence

I’ve been tinkering with some pipeline tools for a short shot on a DSLR that outputs "MTS" AVCHD files, which have proven to be a pain to deal with.

For doing the effects, I naturally wanted to convert to an image sequence. Normally, I would just use ffmpeg, or mplayer to make an 8 bit PNG sequence. But, I decided to be sort of insanely paranoid about losing color information in the process. Since the MPEG-4-ish AVCHD is basically a YUV format, there is theoretically a little bit of possible loss of color when going to RGB. So, I have been cooking up a transcode workflow that should preserve whatever color has survived the compression to AVCHD.

I am sharing a utility that turns a movie file into 16 bit TIFF’s. It’s a small test program that I made while working on a small part of a larger internal workflow utility for the project shot on DSLR. It sort of grew out of an R+D side project to see if it was possible. You have to run it from the command line. It takes exactly one command line parameter – the name of the video file to turn into a TIFF sequence. If you drag and drop a movie file onto the executable, it’ll sort of work, but it won’t know what directory it should be working in, so it just dumps the frames into "c:\Documents and Settings\USERNAME" (or the equivalent on your version of windows.)

So far, I have tested this utility on exactly two types of files: M2T files captured from my Canon HV20 with HDV video, and the MTS AVCHD files from a Panasonic Lumix GH-1. Running this utility with anything else may cause an explosion. OTOH, it uses the ffmpeg libraries to handle all of the decoding, so it may well coincidentally work with almost any common video you throw at it.

Like I said, this is something that grew out of a proof of concept on a larger project. i don’t currently have any plans to improve this utility, or to distribute the larger project. I just figured there might be somebody out there who would find this useful, and it wouldn’t hurt to share it.

FFMPEG handles the conversion to 16 bit RGB itself, so if there is ever a "superwhite" that clips in the conversion to RGB, AFAICT, it’ll still be clipped in the conversion to 16 bits. This uses an int format, not float, so I don’t think it’ll preserve values greater than 1.0. It should just give slightly better precision in the conversion to RGB. (Unless I’m horribly misunderstanding the ffmpeg documentation, which is entirely possible, because there basically is none.)

http://www.forkforge.org/files/tools/movie_to_tiff.zip

I think I’ve bundled all of the dll’s that this depends on. I don’t have a second Windows machine to test deploying it on a clean install. It’s like a 40KB utility that depends on 20MB of third-party dll’s, so I can’t claim credit for most of the work in this. 🙂

Anyhow, if anybody does find this sort of thing useful, let me know.

No Responses to “Convert a movie to a 16 bit image sequence”

Post a Comment