making-videos

Making Videos with Free Software

I recently got an old computer (a VIA based, Pentium-III with Asus V7700 (GeForce 2 GTS, with vivo but no TV-tuner)) by a friend who didn't need it anymore. It has a video-capture chip with a S-VHS port, so this was the time to digitalise those Hi8 tapes that have piled up since I bought my video camera in 1998. Unfortunately the technical specs of the graphic chip has not been published by the vendor (evil nvidia) so the free software support for it is not quite as good as the support in MS Windows.

However, the MS Windows support was not so good either: only in Windows 98 the video capture worked, the drivers for Windows XP didn't work. So I had to use Windows 98 to do the capturing, and first I tried the OEM proprietary video-capturing/editing programs that came with the box - ASUS Live and Ulead Video Studio 6 SE Basic - but they simply wouldn't do what I wanted: capture large amount of raw video (uncompressed or losslessly compressed). Since harddiskspace is cheap, and I will process the video with various filters such as deinterlacers and the intended end format is high quality theora or mpeg-2 ("DVD") files raw losslessly captured video is the only alternative.

Free software was my rescue. Virtualdub (published under the terms of the GPL) could capture large amounts of raw uncompressed video, even under the silly limits that the file system of Windows 98, FAT32, puts on filesizes (4GB). Virtualdub happily captured to series of AVI files at the appropriate size.1 Virtualdub could not only capture as I wanted, it also makes a good environment for applying filters that enhances the video, and to split it up in to scenes.

Colorspace restrictions **

Virtualdub, and the filters that are available for it, are very good, but the work internally in RGB colorsspace. For speed and quality reasons, one should avoid converting between RGB and YUV colorspaces, and the target files will be in YUV, thus I use a YUV-only toolchain. This means capturing in "UYVY" (instead of RGB16 which I did at first). There is a free lossless encoder for yuv, huffyuv, here: http://neuron2.net/www.math.berkeley.edu/benrg/huffyuv.html

Virtualdub does not convert to RGB24 from YUV when you use the "Direct Stream Copy"-mode or "Fast recompress..."-mode, but those modes excludes the possibility to use the filters within Virtualdub.

Video processing tool chain **

http://neuron2.net/kerneldeint/leakkerneldeint154.zip2 LoadPlugin("C:\Program\Avisynth 2.5\plugins\leakkerneldeint.dll") LeakKernelBob(order=0,threshold=10,sharp=true,twoway=false,linked=false,map=false) Crop(0,8,688,558) AddBorders(8,9,8,9)

For movies with (chroma?) noise as an effect of too little light, use a smart smoother. I have only tried Smart Smoother HiQ by Klaus Post, but that only works in RGB-space. One round trip YUV->RGB->YUV shouldn't introduce artifacts, but it is slow. MSmooth should be tried, though it is primary aimed at anime.

As I want theora and mpeg-2 as the final format for the videos, I tried another program, SUPER, to encode the uncompressed video that virtualdub puts in the avi files. I haven't seen the license for SUPER, so I'm not sure it is Free software. It handles theora and vob/mpeg-2 and is extremely easy to use.

While SUPER did work good under MS Windows, it does not install under WINE. Virtualdub works under WINE, and under WINE it can save to files larger than 2 GB.3

So I ended up doing only the capturing under MS Windows 98, all post-processing is made with Virtualdub under WINE. Encoding to mpeg-2 and theora is done by ffmpeg and ffmpeg2theora respectively.

Normal case: encode multiple avis in standard sizes 704x576 from virtualdub

tccat -i foo.00.avi -i foo.01.avi -i foo.02.avi -i foo.03.avi -i foo.04.avi -i foo.05.avi -i foo.06.avi > foo.avi This does not work, probably due to some avi length limit in tccat. Instead use virtualdub under wine and save as one long avi.

ffmpeg -i foo.avi -b 5000 -acodec ac3 -ar 48000 -ab 384 -f dvd -aspect 4:3 foo.vob ffmpeg2theora -i foo.avi -o foo.ogg -V 1999 -A 160

When the clip is cropped in virtualdub and thus has a non standard size, the following works:

Resizing with transcode

transcode —use_rgb -i foo.avi -o bar.avi -y raw -Z 720x576 -N 0x2000 -b 384 —export_asr 2

Making vob/dvd-files with ffmpeg

Making theora-files with ffmpeg2theora

ffmpeg2theora -i bar.avi -o foo.ogg -V 1999 -A 160

stuttering movies/deinterlacing

In a deinterlaced 25 fps movie movements does not feel soft enough. This can be resolved using a special deinterlacing algorithm, which results in a 50 fps movie. That deinterlacer, "deinterlace - smooth v1.1", works on fields that virtual dub cannot separate, but which one have to use avisynth to separate, in particular, the function "separatefields". Now avisynth messes up the colors on uncompressed rgb16 avi, which I capture in (avisynth understands rgb24, but I cannot capture in rgb24). So now I have to capture in UYVY instead av rgb16. There is a free lossless yuv codec from the author of avisynth that works well, and can be imported by avisynth.


1. Virtualdub has one disadvantage, it uses AVI as its export file format, while I want theora or mpeg-2 as the final format. AVI files should not be larger than 2 GB, unless an extension to the AVI-format is used. I don't how widespread the support for that extension is. Under MS Windows 98, the 4 GB limit on filesizes makes this limitation unproblematic, but if I hade used Virtualdub under MS Windows XP and thus could have worked with larger files, then it might have mattered (depending on wheter or not the other program in the production chain supported the AVI-extension or not).

2. According to Donald Gruft Leakkerneldeint is prefered over his own KernelDeint.

3. For virtualdub to work under WINE, uncheck "use DirectX for display panes" in "Options/Preferences.../Display". Also note that in order to successfully save from Virtualdub under Wine, you have to have a version of WINE newer than 200506 something, in particular 20041019 does not work.

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019