Well, I found a way to convert a video from variable framerate to a standard one, and it’s actually pretty simple. Not only that, I found the example about it on transcode’s wiki entry for Matroska. Obviously the last place I would have been looking for it, since I know all about those two things, right? 🙂
The wiki says to pre-process the video with mencoder, by forcing the output fps to a certain rate. The command is simply something like this:
mencoder input.vob -ofps 24000/1001 -oac copy -ovc copy -o output.avi
That’s copying the audio and video directly, but dropping frames on the segments that are not 23.97. You would think that this would drop a lot of frames, but from most cases I’ve seen so far, there are only a few segments where it jumps back to 29.97, so it turns out pretty well, and the video looks good. There’s only a few problems, though.
First of all, mencoder doesn’t (or can’t, I’m not sure yet) create an AVI index in output.avi, so you can’t seek the file at all. You have to rebuild it first:
mplayer output.avi -saveidx avi.idx
That will do two things: build the index before playing, and use it while playing. Another way to play the file later is to load the index while playing the file:
mplayer output.avi -loadidx avi.idx
Then you can seek again.
The second problem is that it’s visibly noticable that you are dropping frames. On playback there are weird black blocks that show up when you do any kind of seeking. A small pain, I know, but that’s the price you pay. It’s really not that annoying, actually. My bigger concern is the index.
I’m playing with ways to get both fixed at once, and I’m hoping that transcode will either re-index the AVI and/or cleanup the funky blocks. Now that the video is all the same framerate, at the very least it won’t have any A/V sync issues. That’s the great part.
Another option is to get mencoder to somehow rebuild the index, but I’m going to have to do some research to find out that stuff. While I started on that though, I did find this great documentation on how to deal with progressive framerate video. Essentially, it looks like I’m on the right track. The bummer part is that there’s a little more to it than I thought, and I might have to do research for each TV series to see how they are encoded, as far as telecine and interlacing goes.
Either way, all this research boils down to one simple principle that I keep harping on: there’s really no solution that is going to work for every video you throw at it. You can come close, of course, with some generic encoding options that will fix 90% of what you have and make it viewable. But if you want best results, smallest filesize, and cleanest video, you’re just going to have to do some research. Personally, I think it’s worth it.