Video Editing Process
Importing Video
Disk Space EstimatesPre-processing
Kernel 2.6.15 Firewire (1394) Hotplug
Import video with Kino
Importing video with dvgrab
Importing video with dvconnect
Importing live TV
Determining file type
Cut/Splice AVI FilesMedia Resolution
DVD Authoring
DVD Production FlowEditing Video with Cinelerra
Building and Maintaining CinelerraExporting to Camcorder
Output Dimensions
DVDUse Clips
YouTube
Fragmented AVI files
Subtitles and Credits
Other Cinelerra Tips
Producing Quicktime Movies
Producing AVI Movies
Exporting clips to Mac OS
Syncing Audio
Sending Raw DV with dvconnectBatch Conversion Recipes
Determine file typeTV Tuner/Video Capture Cards
Convert Quicktime to AVI
Demux Quicktime to AC3 and MPEG 2 (VOB) for DVD
Convert AVI to Quicktime/MPEG-4 and strip audio
Extract audio from AVI to WAV
Convert AC3 48 KHz audio to WAV 44.1 KHz
Extract portion of VOB file to MPEG and strip audio
Downsampling video by dropping frames
Summarize movie times
Not much to it, really.
1. Insure that /lib/modules/kernel/modules.dep contains: ieee1394, ohci1394, raw1394, dv1394, video1394. If not, compile and install these kernel modules.
2. Insure that /lib/modules/kernel/modules.ieee1394map contains raw1394, dv1394, and video1394. If not, figure out why not.
3. Add these to /etc/modules.autoload.d/kernel-2.6 so your Firewire (1394) card is recognized (otherwise, the kernel won't care about events sent from the card):
# For IEEE-1394 (Firewire) bus.
ohci1394
4. Create file /etc/modules.d/ieee1394 (you can name it anything) and put in these driver dependencies:
# Specials for ieee1394 devices.
# Video camera:
below raw1394 dv1394
below video1394 raw1394
5. Reboot to start fresh. Or, you can remove all 1394 modules with modprobe -r, load ohci1394 with modprobe ohci1394, and run modules-update to incorporate your new modules.d file.
When you
plug in the camera, the raw1394
module
will load automatically, and will force dv1394 to load before it.
If you do not have ieee1394,
ohci1394, dv1394, and
raw1394 all loaded, you will have problems.
When the camera is unplugged, raw1394 is not unloaded. The system appears to consider the camera's ieee1394 node in a "suspended" rather than "gone" state. The modules uses a small amount (about 20Kb) of kernel memory, and you can unload them manually with modprobe -r dv1394, though this may also unload ohci1394, too, and then hotplug will no longer work.
Debugging hotplug: Uncomment the "DEBUG=yes" line in /etc/hotplug/ieee1394.agent. Plug camera in. Look for messages in /var/log/messages.
Hibernate: Well, this all sounds good, but appears to not work with hibernate. Use this script to set things right:
#!/bin/bash
# Reset kernel modules for IEEE-1394 needed to access Canon GL1 camera.
# Remove all ieee1394 modules
modprobe -r video1394
modprobe -r dv1394
modprobe -r raw1394
# Load in correct order
modprobe dv1394
modprobe raw1394
dvgrab is recommended for capture from IEEE-1394 (Firewire). Made by the Kino people (http://kino.schirmacher.de), dvgrab is a command line utility. These instructions also apply to Kino.
Normally, you can just insert a tape in your camera and start dvgrab. It will find your camera and control the playback.
Here's what worked with my camera:
Connect camera to computer with Firewire cable. Turn camera on in VCR mode. Insert tape and position at beginning of segment.
Use lsbus ieee1394 to find the camera's GUID. The Canon GL-1's is 0x00008500001426B6. Use dvgrab 1.8 with the --guid 0x00008500001426B6 option. Might work fine with other cameras without this option. Earlier versions do not work well with automatic camera control (AV/C), so also use the --noavc option. The minimum version of dvgrab which worked with this camera was 1.4.
For recording longer than 4m40s (~1 Gb), use the --autosplit option. It will split the input files at around 1 Gb and also when the recording was stopped and restarted (nice!).
Supply a base name of the form: summer-vacation- (note trailing hyphen)
Start dvgrab with these options.
Recent versions of dvgrab will automatically start the camera playback. If not, start the camera (from stop, not pause). dvgrab will detect that the camera has started playing and will begin capturing. When done, stop dvgrab with Ctrl-C (it won't stop if you stop the camera, though will not store blank frames on disk).
dvgrab produces AVI files. These may be used directly by either Kino or Cinelerra, and may be viewed with mplayer.
dvconnect can
capture video using the video1394
driver, though it
does not split the source into scenes, or limit the capture file size,
as dvgrab can.
Unlike dvgrab,
dvconnect starts
capturing as soon as
it is started,
and stops when playback stops. Start the dvconnect before starting
the
camera playback. Stop dvconnect
with Ctrl-C after
the camera is stopped.
dvconnect produces Raw DV files. These may be viewed with playdv or mplayer.
Run playdv like this on my system because's default display produces a black picture:
playdv -d 1 file
Use TVTime to view the source material and to adjust the picture.
All options to -tv must be joined together. The above command captures interlaced video from a video card receiving PAL-M (Brazil). A good VCR which can play video tapes other than NTSC is the Samsung SV-5000W (tip: while playing the tape, change the "Play System Mode" to something other than "auto" to prevent the VCR from choosing a different standard in poorly encoded sections).
The above command captures interlaced video. It does not look to good in Cinelerra, but today the end result is a DVD played on an NTSC monitor. NTSC expects interlaced video, so I might as well put interlaced on the DVD, and capture it that way, too. Otherwise, I would have to(imperfectly) generate progressive images from the interlaced only to have them converted back again.
See this for a comparion of transmission standards. See Video Interchange for lots of tech info and conversion services.
Options:
To see v4l2 options, run:
mencoder -v -v -v tv:// -tv driver=v42l:device=/dev/video0
| input=1 | 1 = Composite1 -- see v4l2 options |
| normid=5 | 5 = PAL-M -- see v4l2 options |
| brightness, contrast, saturation, hue | Copy from TVTime |
| outfmt=yuy2 | YUV encoding -- see v4l2 options. |
| amode=1 | 1 = stereo |
| alsa | Capture through ALSA |
| forceaudio | TV card does not export audio to ALSA, and instead is wired to the sound card. forceaudio tells mencoder to capture sound even though v4l2 driver reports no sound is available. |
| -vf-add harddup | Forces duplicate images to be output; better for reprocessing |
| -ovc lavc | Use libavcodec |
| vcodec=mjpeg | Use libavcodec's Motion J-PEG encoder. Although it uses more disk space,this produces better images than MPEG-4. Also, Cinelerra can read MJPEG, but not MPEG-4. |
| vhq | Configure
high-quality encoding parameters. Disk space: 2.42 MB/sec |
| -noautoexpand | ? |
| -oac
pcm -srate 48000 | Encode sound in PCM format (as opposed to lossy MP3), and capture at sound card's native sample rate. |
| -endpos HH:MM:SS | How long to capture for |
| -o file | Output filename |
Trouble options:
Unnecessary options:
Mencoder status line:
| A-V:0.000 | A/V sync offset, according to encoder. |
| [vvvv:aaaa] | Average bitrate of video and audio, in Kbits/sec. Also shown in final summary. |
| A/Vms | milliseconds/buffer for audio/video. Example: 270/14 means 270 msec to capture an audio buffer, and 14 msec to capture a video buffer (not clear how large a buffer is). |
| D/B/S | Duplicate frames/Bad frames/Skipped frames |
Determine file type with transcode (also see Transcode Recipes):
tcprobe -i file
Transcode is good for batch pre-processing before the editing begins. However, it's a pain to figure out. Here are some recipies.
Someone asked for a copy of some video you shot. You want to give them something as close to native format as possible so they can edit it themselves. Most likely, that means Micro$oft's AVI format. Use:
avisplit cuts and splices together AVI files. Cinelerra doesn't render to AVI format, nor do you wish for rendering to take place when only cut and splice are required. Read the man page, and check the warning on matching the number of video and audio chunks.
| Media | Resolution
(NTSC) |
|---|---|
| VCD | 352x240 |
| SVCD | 480x480 |
| DVD | 720x480 |
| DV
(Digital Video) | 720x480 |
Set the the video editor to match the output dimensions early in the editing process. Otherwise, the output may be clipped unexpectedly if the dimensions are changed later, or are altered with transcode in batch mode.
| -speed=n | Burn speed |
| -publisher publisher_data | Insert publisher data into DVD header. Upto 128 characters. |
| -p preparer_data | Insert preparer data into DVD header. Upto 128 characters. |
| -V volume_id | Specifies volume ID (or volume label). Upto 32 characters. |
| -volset volset_data | Specifies volume set (what's this for?). Upto 128 characters. |
About burn speed. The maximum speed for my DVD burner is 12. Writing 3.577 GB to several DVDs, this is what I got:
| Write Speed | Actual average speed |
| Maximum (12x) | 6.3x |
| speed=8 | 7.3x |
Is
faster better?
Apparently not.
This guy has a utility which displays how many errors are encountered on a disc. Only works for recent Plextor drives. It suggests that writing at a drive's maximum speed produces more errors. That was for a Plextor. Not sure how that relates to your drive. Plextors have a good reputation, though.
QPxTool is a new utility for Linux that works for several types of drives. Appears to not work on mine, though.
| Mfgr | Mfgr ID | Results |
| TDK | TTG02 | Problems reading in some consumer players. |
| Memorex | CMC MAG. AE1 | Works well in consumer players. |
| Maxell | TYG02 | Works well in consumer players (Taiyo Yuden) |
All media burned reliably and were readable in other computers and professional studio equipment. The problem was with consumer players.
I use Cinelerra
to edit video. It allows multiple video and audio tracks, and
separation of video from audio. Kino does not (though simpler is
sometimes better).
Know your output dimensions before you start. If you need to crop after editing, you'll be sorry.
(From You Tube's answer page)
Limits: 100 MB or 10 minutes, whichever limit is met first.
(From You Tube's answer page)
From cinelerra mailing list:
Render as for DVD, then:
ffmpeg -i file.mpeg -b 600k -s 320x240 -acodec mp3 file.small.mpeg
Cinelerra allows only one audio/video sequence to be edited at a time. Clips allow you to save a switch between different bits of work.
Sometimes dvgrab
fragments the
video into many small pieces.
Cinelerra can piece these together into "clips". Clips are not files,
but descriptions of how to piece together fragments of files so they
appear to be a single piece (logically concatenated). The leader and
trailer of the clip may be shortened before committing.
It is best to join together fragments into clips before actual editing begins.
Also: AVI files may be merged together before beginning editing with avimerge
Cinelerra
supports simple subtitles and scrolling credits. Use the
"Title" video effect. Limitations: in any one title, typeface family,
size, and color must all be the same; scrolling credits are limited in
size (to what?), pictures may not be included, and advanced page layout
is not supported.
For advanced titles, create a PNG image with The
Gimp and import
into Cinelerra as a resource. Tips:
Cinelerra supports
"Quicktime for Linux",
which apparently is not exactly the same as Apple's Quicktime, but
sometimes is compatible. Files
that Xine
or mplayer can read
may not be readable by Apple's Quicktime. I
installed Apple's Quicktime
for Windows using wine.
These codec
combinations worked for both
the Xine and Quicktime players.
Audio:
Video:
2007-Jan: Quicktime for Linux does not work with Apple's Quicktime viewers. Tried versions 6.5.2 and 7.1.5 of Quicktime for Windows. Not clear why, as some older movies that did work no longer do, yet some other people's movies do. What works is converting Cinelerra's output to MPEG-4:
ffmpeg -i input.mov -sameq output.mpg
Also See: Cinelerra Community Center, Cinelerra Tutorial, Cinelerra TWiki On-line Manual, Kino
Cinelerra doesn't do a good job creating AVI files. Sometimes it works, and occasionally the target platform has trouble. Create output as for Quicktime and then convert to AVI with mencoder:
mencoder
-o
file.avi -ovc lavc -oac lavc
-lavcopts
acodec=mp3:vcodec=msmpeg4vs:vbitrate=6000
-srate 48000 file.mov
Use AVI to export clips to Mac OS. Settings:
Audio:
Video:
Videos with background music
usually
sound bad because the music is not recorded well by the camera's
microphone. If you have a copy of the background music, it
can be mixed into the video during editing. Don't replace the recorded
audio, as it contains important ambient sound.
Background music
from a CD player is an
ideal audio source because
accurate digital clocks insure distortion-free audio. The CD audio can
be ripped
and then easily inserted into the movie editor and aligned with the
recorded audio. You'd think so, anyway. In practice, I have found
2 minute songs which are synced at the beginning of the song and out of
sync at the end. The cause is either a too fast or too slow CD audio
player, or a too fast or too slow camcorder, on the order of 0.2%.
Solution: stretch or shrink the ripped audio to fit the video
recording. Procedure:
If you imported
the video using dvgrab,
then the images are
compressed in DV format (within an AVI file). DV is a lossy
format, and it is best to
avoid re-encoding it. For the most part, Cinelerra avoids re-encoding
source frames, but does so for frames which are mixed or
overlayed. Someone out on the Internet suggested that this leads
to a perceptable shift in video quality, and can be avoided by forcing
Cinelerra to re-encode everything by mixing in an empty video track. If
the destination is VHS, I don't think it's a problem.
Three primary tools are available:
Transcode is a powerful tool and is initially difficult and painful to use. Mencoder seems somewhat better, but I haven't used it much. Some general tips:
Input may be any recognized format.
transcode -i sourcemov -y ffmpeg -F wmv2 -o dest.avi
or with mencoder:
mencoder
-o dest.avi -ovc lavc -oac lavc
-lavcopts
acodec=mp3:vcodec=msmpeg4vs:vbitrate=6000
-srate 48000 source.mov
Input may be any recognized format.
ffmpeg -i source.mov -target ntsc-dvd -vn -f ac3 dest.ac3
ffmpeg -i source.mov -target ntsc-dvd -an -f
mpeg2video dest.m2v
MPEG-4 is more compact. Note that input may be any recognized format.
transcode -i source.avi -y mov,null -o dest.mov -F ffmpeg_mpg4
Note that input may be any recognized format. Output is probably not the correct sample rate, or correct multiple of blocks, for audio CD.
transcode -i source.avi -y null,wav -o dest.wav
Or to extract sound from all AVI files and store in a subdirectory named audio:
for F in *.avi; do transcode -i $F -y null,wav -o audio/${F%.*}.wav; done
ffmpeg suports a wide variety of codecs, and the command line options are minimal:
ffmpeg -i source.ac3 -ar 44100 dest.wav
The VOB of interest with Xine by mounting the media and selecting the file by name. Note segment start and end offsets in Xine (press space to pause and display time offset). This example is copying from 8 minutes and 16 seconds to 14 minutes and 7 seconds (multiple time spans may be concatenated in the same option). --export_prof dvd retains the same image dimensions as the original (if it came from DVD). Transcode can copy from unencrypted VOB files.
transcode -i source.vob -c 0:08:16-0:14:07 --export_prof dvd -y ffmpeg,null -o dest
(.m2v suffix added automatically)
Note: I encountered at least one VOB where xine reported a time code which slower than real time by 50%, and transcode's clock was correct. Extract a small sample close to the beginning of the source to verify the reported time.
The fps
filter works by dropping frames. Rather course, as it only allows
integral divisors, though it works well that time-lapse look. This
speeds up the video by x10.
transcode -i source.mov -y mov -F ffmpeg_mpg4 -o dest.mov -J fps=299.7:29.97
Reverse the fps ratio to slow down the motion. The right-hand number should be your target frame rate.
The movie_times script reports the duration of all movie files given to it on the command line, and then adds the times together for a total.
| Copyright © 2004-2006 Craig Lawson | ||
| Index | ![]() |