The editing techniques described here are compatible with workflows that preserve quality by avoiding intermediate editing formats. Examples of these types of workflows are described in DV Video Workflow in Linux, HD Video Workflow in Linux and H264 HD Video Workflow in Linux.
If you are editing DV source using Cinelerra please check the page on Upsampling DV Chroma by Inpainting for improved resampling of the 4:1:1 colorspace.
The following patches allow Cinelerra to perform colorspace conversions correctly:
When interpreted as two fields of interlaced video this frame consists of a blue square moving to cover part of a red square. When this frame is replicated and placed in a video stream the visual effect is that the center rectangle flashes red and blue.
Encode this image to interlaced 4:1:1 DV using the commands
$ dd if=/dev/zero bs=4 count=960960 | sox -t raw -s -w -c2 -r48000 /dev/stdin test.wav $ pngtopnm itst.png | ppmtoy4m -F 30000:1001 -A 8:9 -n 600 -r -Ip -S 444 | y4mscaler -O chromass=411 | ffmpeg -f yuv4mpegpipe -i /dev/stdin -i test.wav \ -interlace 1 -top 0 -flags +ildct+ilme \ -vcodec dvvideo -acodec pcm_s16le -y test.aviand to interlaced 4:2:0 mpeg2 using the commands
$ toolame -b224 -s48 test.wav test.m2a $ lav2yuv test.avi | yuvcorrect -T INTERLACED_BOTTOM_FIRST | mpeg2enc -M0 -nn -a2 -f8 -G18 -b7000 -V230 -q5 -o test.m2v $ mplex -f8 test.m2v test.m2a -o test-mjt.mpgOther methods for encoding DV to mpeg2 can be found in DVD compliant mpeg2 on Linux.
The video clips test.avi and test-mjt.mpg should look the same in Cinelerra if the chroma upsampling routines are working correctly. To check how close they are, load both into Cinelerra and subtract one from the other to obtain the error. The following screen grab shows both tracks on the Cinelerra timeline with one subtracted one from the other.
I performed this test on both patched and unpatched versions of Cinelerra. Where the video tracks are black the images match; where there is color the images differ.
The progressive upsampling algorithm in the unpatched version of Cinelerra doubles the width of the red and blue lines in the interlaced part of the frame. This results in obvious error. The patched version of Cinelerra does not have this error.
Note that getting the chroma fields correct is particularly important in obtaining quality chroma key results from HDV video.
The effects that need additional attention are blur, freeze frame, linear blur, radial blur, reverse video, scale, sharpen, title, translate, unsharp, wave and whirl. To use a one of these effects place frames to fields before it and fields to frames after it. Make sure to specify the field interlacing order in both fields to frames and frames to fields. Suppose you want to zoom in on part of a top field first interlaced video. This can be done with the translate and scale effects as shown by
#!/bin/sh yuvfps -s 30000:1001 -r 30000:1001 | yuvcorrect -T PROGRESSIVE 2>/dev/null | yuvfps -s 60000:1001 -r 60000:1001 | y4minterlace -it | yuvfps -s 30000:1001 -r 30000:1001 | mpeg2enc -M0 -nn -a3 -f8 -G18 -b7000 -V230 -q9 -o $1
Reinterlacing during rendering is necessary because it is not possible to insert fields to frames after the compositor. Screen grabs showing the settings in Cinelerra are
Almost every video effect in Cinelerra can be used on interlaced video by inserting frames to fields before the effect and fields to frames after the effect. The compositor requires doubling the frame rate and moving the reinterlacing step to the rendering.