Kino Tips: Installing from Scratch and Exporting MPEG Videos
The December issue of Linux Journal includes our feature article "Making Movies with Kino". Here, we offer a companion article with instructions for installing or upgrading Kino, as well as some tips for what you can do with this popular video editing program.
Before we start building the program, here's one non-Linux tip: if your PC does not have a built-in IEEE1394 card or if you wish to buy an extra IEEE card, try to find one with an IEEE1394 cable--it is cheaper in the long run. If you do buy a cable separately, remember that a nice-looking cable labeled Sony in a video shop may cost much more than an ordinary one labeled 1394 in a computer shop, but there are no differences in how they work.
Kino is not a monolith program, but it does call some extra stuff and uses many libraries while running. A tree of the main dependencies is shown below in Figure 1. In order to compile Kino successfully, you have to install all the needed packages beforehand and compile them from source. Hopefully, the configuration script will help you determine the required software.
Start by finding the recent sources on SourceForge.net and loading them. Unzip and untar the file and follow the README instructions. By running the ./configure script, you can learn in detail all that you have to add to your machine in order to compile Kino successfully. You need to install the missing components according to the distribution. In such cases, you have to install with run-time libraries the corresponding files for developers, such packages contain "devel" or something similar in their names.
As a rule of thumb, the newer the version of Kino you want to compile, the newer libraries you need to install or update. Some of them may be not available for your distribution at all. In such cases, you have to compile the libraries from source or find pre-compiled ones. More details on this step are offered below, in "Installing from Packages".
If the ./configure script finishes without errors, run make and then make install. If a problem arises with the make scripts, an error message gives you complete information about what happened. The README file also can help you finding the reason for the unsuccessful compilation.
Kino plugins timfx timfx and dvtitler provide some extra functions. The process of installing timfx requires a C++ interface and signal framework libraries. On SuSE, you probably will not have any problems compiling this module, but it's possible that you may need to point to the Kino header location:
~tiger/timfx ./configure ~tiger/timfx make KINO INCLUDE=/opt/gnome/include ~tiger/timfx make install
Compiling dvtitler is a similar process--do not forget to load the grey-scaled images for the timfx Luma effect. They are located here. Knowing how these images work can help you develop your own interesting effects.
In order to simplify installing all of these libraries, we created tarballs containing all the necessary packages for SuSE 9.1 and for Fedora Core 2. The SuSE 9.1 tarball can be found here, and the Fedora Core 2 tarball can be found here. Using these tarballs, we suggest the following procedure for installing Kino:
Load all packages according to your distribution, as outlined in Tables 1 and 2. Some packages from the tables are not included in the standard distributions, and some of them we compiled specifically for use with Kino. To install them as root, issue the command rpm -i foo, where foo is the packages' filenames. To upgrade, use rpm -U foo instead.
Try to install Kino with the command rpm -U foo, where foo is the Kino package name according to the distribution. It is kino-0.7.3-2.i586.rpm for SuSE and kino-0.7.3-2.i386.rpm for Fedora Core 2.
If rpm complains that you missed something in the system, read the rpm output and install or upgrade the necessary programs.
For SuSE, simply install timfx and dvtitler with rpm; use timfx-0.2.1-2.i586.rpm and dvtitler-0.1.1-1.i586.rpm. For Fedora Core 2, first install the two packages not available in the standard release, as noted in Table 3. After that, install the plugin packages, timfx-0.2.1-2.i386.rpm and dvtitler-0.1.1-1.i386.rpm.
Table 1. Packages for SuSE 9.1
|MJPEG Video Capture and Processing Tools||mjpegtools-1.6.2|
|The Quasar DV Codec for DV video||libdv-0.102|
|Library to Read and Write Quicktime Files||libquicktime-0.9.2|
Table 2. Packages for Fedora Core 2
|Sample Rate Converter Library||libsamplerate-0.1.0|
|Library to Handle Various Audio File Formats||libsndfile-1.0.10|
|MJPEG Video Capture and Processing Tools||mjpegtools-1.6.2|
|Library to Read and Write Quicktime Files||libquicktime-0.9.2|
To work with your camera through the IEEE1394 interface, you need drivers and devices supported by the kernel. Standard SuSE (9.0 and above) and Debian 3.1 have all of these things in their standard releases. Fedora Core 2 does not have them, so you have to update your Fedora installation to the new official Fedora kernel release, 2.6.8. You can download it here.
Before running Kino, check for IEEE1394 devices availability. Kino uses a device called /dev/ieee1394 for capturing and one called /dev/dv1394 for outputting. Issue ls -al /dev/*1394* to reflect your system. These files usually are created by MAKEDEV scripts that run while installing the system.
Having these devices is not the enough, however; you must have corresponding components in your system to work with them. SuSE provides these modules out of the box, while Fedora Core 2 offers them only after upgrading. MandrakeLinux release 9.2 also contains these modules.
You have to create /dev/dv1394 by hand. In case of PAL, the command is:
mknod -m 666 /dev/dv1394 c 171 34
For NTSC, the command is slightly different:
mknod -m 666 /dev/dv1394 c 171 32
Do not forget to load the module with modprobe dv1394. You can find more details about this part of the process by visiting linux1394.org.
On its own, Kino offers only minimal exporting features; you can use it to write a movie to a DV tape or to a .dv or dv .avi file. A dependency tree for exporting other functions is shown in Table 4. Packages marked in red are not included in the standard distributions, so you must load them from tarballs available for download from the LJ FTP site. Use rpm -i foo to install these packages. Start from the top (libogg) and go down (rawrec), according to the table.
Table 4: Dependencies for Exporting Movies
|Software||SuSE 9.1||Fedora Core 2|
|Ogg Bitstream Library||libogg-1.1||libogg-1.1|
|The Vorbis General Audio Compression Codec||libvorbis-1.0.1||libvorbis-1.0.1|
|Video and Audio Converter||ffmpeg-0.4.8(red)||ffmpeg-0.4.8(red)|
|Library for Reading DVD-Video Images||libdvdread-0.9.4||libdvdread-0.9.4(red)|
|Library for Portable Network Graphics (PNG) Format||libpng-1.2.5||libpng-1.2.5|
|Tools to Help You Author a DVD||dvdauthor-0.6.10(red)||dvdauthor-0.6.10(red)|
|Raw Audio Recording/Playing Utilities||rawrec-0.9.98(red)||rawrec-0.9.98(red)|
Dropped frames often occur if the hardware is not working quickly enough. As a result, while capturing images the number of dropped frames increases constantly. As a temporary solution to dropped frames--before you install more memory or buy a new motherboard--try the following:
Exit all X functions and re-run Kino with fvwm.
Close X completely. Use dvgrab to pull all the files, and then assemble the movie with Kino using files grabbed in this way.
Many special effects in an amateur movie can distract viewers. Such effects should be applied only if you think they are needed to relay your ideas.
Kino with timfx provides the following video filters and effects: black and white, sepia, reverse video, mirror, kaleidescope, swap, color hold, blur and soft focus. Modern camcorders have such filters built-in, but we rarely use them while recording because if they are part of the actual image, it's much harder to undo them. It is a better idea to do this kind of filtering with Kino during the editing stage.
When you look at a filter's name, it usually is easy to guess what the filter does. Take a look at these images for some examples:
Figure 2. Image Before Filter
Figure 3. Image After Colour Hold Filter Applied
Figure 4. Image Before Filter
Figure 5. Image After Left-to-Right Filter Applied
Video transitions are images that join two scenes. The most interesting joining effect is Image Luma, because you can create your own filters. Examples of joining are represented below; we used standard files from the Kino site.
Figure 6. A Type of Joining Effect
Figure 7. As Applied to Image with Blur = 1
Figure 8. As Applied to Image with Blur = 0
Other transition options include Fade, Push Wipe, Bar Door Wipe and Differences. Experiment with them all until you find the ones you like.
Although a digital camcorder can be used to show the exported movie on a TV screen, we do not recommend wasting the limited camcorder resources. Keep the full-quality version of the movie on a DV tape so you can work with it later.
Because the human eye barely can detect the difference between an MPEG 2 compressed movie and the original DV format when shown on a TV screen, making a DVD for general viewing is more useful.
The structure of a DVD is not simple. In general, it is possible to make a DVD that contains a movie, additional photos and so on, but this is a topic for another article. With Kino, you can build a simple DVD structure to use with a standalone DVD player.
Begin at the Export tab. Select DV Pipe and than choose the tool FFMPEG DVD-Video Export. In Profile, select Output Standard DVD-Video directory (All only); in cases of widescreen sources, use widescreen output. Next, type the output file name without any file extension. This name becomes the top name on the DVD directory tree. Press Export.
Exporting may take hours. We like to start the process before going to bed. When exporting is complete, you have the resulting DVD directory tree (VIDEO_TS and AUDIO_TS), named according to your input. You then can check the results with mplayer or xine.
Before burning the final DVD, you should make the image. We prefer to use the following command, assuming the name movie_dvd :
mkisofs -dvd-video -o movie dvd.iso movie dvd
You have to burn this image; we usually use growisofs for this task:
growisofs -dvd-compat -Z /dev/dvd=movie dvd.iso
The option -dvd-compat is used to provide maximum media compatibility.
You then can design your own image for the DVD label, print it out and put this new DVD into a real DVD box.
If you have the movie saved as a .dv file, you easily can turn it into an MPEG 4 video and burn it to a CD. Because not all of our friends are Linux users yet, we prefer to export to an .avi MPEG 4 file.
To increase the quality of the video, we suggest using a two-step encoding process. For the first pass, use:
ffmpeg -i foo.dv -f dv -pass 1 -passlogfile foo -vcodec mpeg4 -g 250 -qscale 2 -bf 2 -acodec mp3 foo.avi
For the second pass, use:
ffmpeg -f dv -i foo.dv -s 640x480 -4mv -part -strict strictness -pass 2 -passlogfile foo -vcodec mpeg4 -g 250 -hq -bf 2 -b 1500 -acodec mp3 -ab 128 foo.avi
The input file, the output file and the log file in both of these steps must be the same. Also, you have to specify your desired bit-rate during the second pass. The larger the bit-rate you set, the better quality movie you will have. We cannot suggest a value, however; it usually is based on the size of the requested file. You can repeat the encoding a few times, though. Start with a high bit-rate, and if you are not satisfied with the size, decrease the rate and repeat. Do not forget check the quality as you go.
Processing the file takes some time. Depending on the size of the movie, it can take more than five hours for one step. In the example above, we used PAL sources. If you have NTCS instead of PAL, use -g 300 rather than -g 250. Play with the options and have fun!
Olexiy Tykhomyrov ([email protected]) has been using Linux since 1994. He works for the Department of Experimental Physics at Dnepropetrovsk National University and teaches physics and communications. He loves his son Misha, who calls him Tiger because some of his students are afraid him. Tiger likes swimming and traveling.
Denis Tonkonog, a former student of Tiger, also works at Dnepropetrovsk National University and likes traveling and fishing with a gun. Friends call him Black Cat but nobody explains why. He can be reached by e-mail at [email protected].