Joining multiple H.264 MOVs using AviSynth and QTSource

> Coding, hacking, computer graphics, game dev, and such...
User avatar
fips
Site Admin
Posts: 166
Joined: Wed Nov 12, 2008 9:49 pm
Location: Prague
Contact:

Joining multiple H.264 MOVs using AviSynth and QTSource

Post by fips »

I've finally decided to make my friends happy and provide them with the video I took during our summer holidays a few months ago. I didn't want to spend much time editing it, so came up with an idea just to quickly join the individual clips together, rescale them and encode the resulting video back into H.264 / MPEG-4.

I thought AviSynth / MeGUI would be the most straightforward tool to deal with this task, but was immediately disappointed when I found out I was not able to import the clips as they had been shot with my Nikon D7000 (Full HD, 1920x1080 at 24 fps) that produces a H.264 / MPEG-4 encoded QuickTime (.mov) container, and unfortunately AviSynth was not able to open it on its own.

Luckily, after a bit of googeling, I came across the QTSource plugin, which enables AviSynth to open QuickTime (.mov) containers (note that QuickTime Player also needs to be installed on the machine). Then I just put QTSource.dll alongside my AviSynth script (.avs) and all started to work.

Here's a simple AviSynth (.avs) script, showing the idea:

Code: Select all

LoadPlugin("QTSource.dll")

clip = \
QTInput("clip_1.mov", color=2) ++ \
QTInput("clip_2.mov", color=2) ++ \
QTInput("clip_3.mov", color=2)

clip = clip.Spline36Resize(1280, 720)
clip = clip.ConvertToYV12()

return clip
I've also experimented with fast motion to speed up some of the boring clips. Basically there are two simple options how to speed up a video without changing the actual FPS. Firstly, you can drop some of the frames. Secondly, you can blend frames together to get smoother frame transitions (a kind of motion blur):

Code: Select all

# drop frames
clip = clip.SelectEvery(2, 0) # 2x speed-up
clip = clip.AssumeFPS(2997, 125) # 23.976

# or blend frames
clip = Merge(clip.selectEven(), clip.SelectOdd()) # 2x speed-up
clip = clip.AssumeFPS(2997, 125) # 23.976