dvgrab - Man Page

Capture DV or MPEG-2 Transport Stream (HDV) video and audio data from FireWire

Synopsis

dvgrab [options] [base] [-]

Description

dvgrab is a program that captures DV or HDV (MPEG2-TS) video and audio data from digital camcorders via FireWire (IEEE 1394). The data is stored in one or several files and can later be processed by video editing software. dvgrab can remote control the camcorder  but it does not show the video's content on screen.

dvgrab also supports UVC (USB Video Class) compliant DV devices using Linux kernel module uvcvideo, which is a V4L2 driver. In this mode, there is no AV/C VTR control and therefore interactive mode is almost useless. interactive feature is

The base argument is used to construct the filename to store video data: base-num.ext. num is a running number starting from 001, and ext is the file name extension specifying the file format used, e.g. avi. A different naming scheme is used whenever the -timestamp, -timecode, or -timesys is given (see below). If base is a full filename including extension, then dvgrab attempts to determine the output file format from the extension, but it still inserts num. The default value for base is "dvgrab-".

If you specify a trailing '-' then the format is forced to raw DV or HDV and sent to stdout. dvgrab will also output raw DV or HDV to stdout while capturing to a file if stdout is piped or redirected.

You can use dvgrab's powerful file writing capabilities with other programs that produce raw DV or HDV. Using the -stdin option and if dvgrab detects that  it is on the receiving end of a pipe and it is not in interactive mode, then it will try to read raw DV or HDV on stdin.

Options

Options longer than a single character can be specified with either one or two leading hyphens. Also, you can use a space character or equal sign to separate the option name and its argument value.

-a[num], -autosplit[=num]

Try to detect whenever a new recording starts, and store it into a separate file. This can be combined with the -frames and -size options, and a split occurs whenever a specified event arises. Autosplit is off by default.

num is optional. Without it, dvgrab determines when to split using a flag in the stream or a discontinuity in the timecode, where timecode discontinuity is anything backwards or greater than one second. If you set the optional argument num you can set the time sensitivity in seconds and ignore the stream's new-recording flag. This basically lets you split on larger time increments such as minutes or hours. For example, -autosplit=3600 splits the recording whenever there is a gap in the recording that is an hour or longer.

-buffers num

The number of frames to use for buffering device I/O delays. Defaults to 100.

-card num

Tells dvgrab to receive data from FireWire card num. The default behaviour is to automatically select the first card containing the first discovered camera If used in conjunction with -noavc, then no bus probing is performed If used in conjunction with -guid hex, then only the specified bus is probed for node with guid hex.

-channel num

Isochronous channel to receive data from. Defaults to 63, which is pretty much standard among DV camcorders these days. If you specify anything different, no attempt is made at this time to tell the device which channel to use. You must have some manual way to tell the transmitting device which channel to use.

-cmincutsize num

This option is used to start the collection if a cut occurs num megabytes (actually, mebibytes) prior to the end of the collection. This option reduces small files being created when using the -csize option. When a new collection is started in this manner, the amount of free space in the previous collection is stored, and while the following clips fit within the previous collection, the new collection starting point is reset.

-csize num

This option tells dvgrab to split the files when the collection of files exceeds num . This option is used to create collections of files that fit perfectly into num megabytes (actually, mebibytes) (i.e. for archiving onto DVD). When this occurs, a new collection is started (See also the -cmincutsize option)

-debug type

Display HDV debug info, type is one or more of: all,pat,pmt,pids,pid=N,pes,packet,video,sonya1

-d,  -duration time

Set the maximum capture duration across all file splits for a single capture session (multiple sessions are possible in interactive mode). The time value is expressed in SMIL2 MediaClipping Time format. See http://w3.org/AudioVideo/ for the specification.

Briefly, the formats are:

XXX[.Y]h, XXX[.Y]min, XXX[.Y][s], XXXms,

[[HH:]MM:]SS[.ms], or smpte=[[[HH:]MM:]SS:]FF.

-every n

This option tells dvgrab to write every n'th frame only (default all frames).

-f,  -format dv1 | dv2 | avi | raw | dif | qt | mov | jpeg | jpg | mpeg2 | hdv

Specifies the format of the output file(s). File format can also be determined if you include an extension on the base name. The following extensions are recognizable: avi, dv, dif, mov, jpg, jpeg, and m2t (HDV).

dv1 and   dv2 both are AVI files with slightly different formats. dv2 stores a separate audio track in addition to the DV video track, which is more compatible with other applications. dv1 only stores a single, integrated DV track since the DV format natively interleaves audio with video. Therefore, while dv1 produces smaller output, some applications won't grok it and require dv2 instead. dvgrab is capable of creating extremely large AVI files—well over 2 or 4 GB—however, compatibility with other tools starts to decrease over  the 1 GB size.

raw stores the data unmodified and have the .dv extension. These files are read by a number of GNU/Linux tools as well as Apple Quicktime.

dif is a variation of raw DV that names files with a .dif extension so they can be more immediately loaded into MainConcept MainActor5.

qt is Quicktime, but requires that dvgrab be compiled with libquicktime.

jpg or jpeg is for a sequence of JPEG image files if dvgrab was compiled with libdv and jpeglib. This option can only be used with a DV input, not HDV (MPEG2-TS).

mpeg2 or hdv is for a MPEG-2 transport stream when using, for example, a HDV camcorder or digital TV settop box.

Defaults to raw

-F,  -frames num

This option tells dvgrab to store  at most num frames per file before splitting to a new file, where num = 0 means ulimited. The corresponding time depends on the video system used.  PAL shows 25, NTSC about 30 frames per second.

-guid hex

If you have more than one DV device, then select one using the node's GUID specified in hex (hexadecimal) format. This is the format as displayed in /proc/bus/ieee1394/devices or the new kernel 2.6 /sys filesystem. When you specify a GUID, dvgrab will establish (or overlay) a peer-to-peer connection with the device instead of listening to the device's broadcast. If you supply a hex value of 1, then dvgrab attempts to discover the device as well as setup a peer-to-peer connection. This is especially handy with MPEG2-TS settop boxes, which typically require a connection management procedure to start transmitting.

-h,  -help

Show summary of options.

-I,  -input file

Read from file instead of FireWire. You can use '-' for stdin instead of using -stdin.

-i,  -interactive

Make dvgrab interactive where single keypresses on stdin control the camera VTR or start and stop capture. Otherwise, dvgrab runs in session mode, where it immediately starts capture and stops as directed or interrupted (ctrl-c).

-jpeg-deinterlace

If using -format jpeg, deinterlace the output by doubling the lines of the upper field. This is a cheap form of deinterlace that results in an effective 50% loss in resolution.

-jpeg-height num

If using -format jpeg, scale the output of the height to num (1 - 2048).

-jpeg-overwrite name

Write to same image file for each frame, instead of creating a sequence of image files.

-jpeg-quality num

If using -format jpeg, set the JPEG quality level from 0 (worst) to  100 (best).

-jpeg-temp name 10

Use a temporary file to create the jpeg, rename the file to the target file name when done. Useful when using dvgrab with -jpeg-overwrite for generating a webcam image.

-jpeg-width num

If using -format jpeg, scale the output of the width to num (1 - 2048).

The JPEG scaling width and height must be both either less than or greater than the normal frame size. For example, the scaled size of 700 wide by 525 high yields a nice 4:3 aspect image with square pixels, but it is illegal for NTSC because 700 is less than the normal width of 720 while the height is greater than the normal height of 480.

Since DV uses non-square pixels, it is nice to be able to scale to an image based upon a 4:3 aspect ratio using square pixels. For NTSC, example sizes are 800x600, 640x480, and 320x240. For PAL, example square pixel sizes are 384x270 and 768x540.

-jvc-p25

Remove repeat_first_field flag and set frames per second to 25 to correct a stream recorded in JVC's HDV P25 mode.

-lockstep

Align capture to a multiple of -frames based on timecode. This is useful for redundancy, when more than one machine is capturing from the same FireWire device, and you want to ensure each file contains the same footage. To ensure the files from each machine have the same name use the -timecode option and the same base name.

-lockstep_maxdrops num

If num frames are dropped consecutively, then close the file and resume capture on the next lockstop interval. If num is -1, then permit an unlimited number of consecutively dropped frames; this is the default.

-lockstep_totaldrops num

If num frames are dropped in the current file, then close the file and resume capture on the next lockstep interval. If num is -1, then permit an unlimited number of total dropped frames; this is the default.

-noavc

Disable use of AV/C VTR control. This is useful if you are capturing  live video from a camera because in camera mode, an AV/C play command tells the camera to start recording, perhaps over material on the current tape. This applies to either interactive more or non-interactive because non-interactive stills sends a play and stop to the VTR upon capture start and stop.

-nostop

Disables sending the AV/C VTR stop command when exiting dvgrab.

-opendml

If using -format dv2, create an OpenDML-compliant type 2 DV AVI. This is required to support dv2 files >1GB. dv1 always supports files >1GB.

-r,  -recordonly

When the camcorder is in record mode, this option causes dvgrab to only capture when the camcorder is recording and not paused. Normally, when in record mode, dvgrab always captures to let you use the camcorder purely as a camera where the computer operator is in control. This option makes dvgrab act like the VCR where the camera operator controls when capture takes place. This is very handy when used with the -autosplit option to automatically create a new file for each shot. This option requires AV/C and will not work with the -noavc option.

-rewind

Rewind the tape completely to the beginning prior to starting capture. Naturally, this requires AV/C; however, perhaps not so obvious is that this does not apply to interactive mode.

-showstatus

Normally, the capture status information is displayed after finished writing to each file. This option makes it show the capture status during capture, updated for each frame.

-s,  -size num

This option tells dvgrab to store at most num megabytes (actually, mebibytes) per file, where num = 0 means unlimited file size for large files. The default size limit is 1024 MB.

-srt

Generate subtitle files containing the recording date and time in SRT  format. For each video file that is created two additional files with the  extension .srt0 and .srt1 are created. They contain the recording date and  time as subtitles in the SRT format. The .srt0 file contains the subtitles  with timing based on the running time from the start of the current file.  Use this file if you transcode to a format like AVI. The .srt1 file contains  the subtitles with timing based on the time code as delivered by the camera.  The mplayer program understands this type of subtitles.

-stdin

Read the DV stream from a pipe on stdin instead of FireWire.

-timecode

Put the timecode of the first frame of each file into the file name.

-t,  -timestamp

Put information on date and time of recording into file name.

-timesys

Put system rather than recording date and time into file name. This is useful when using converter devices that do not change the recording date time in the DV stream.

-V,  -v4l2

Capture from a USB Video Class (UVC) device that supports DV. This uses the uvcvideo kernel module via V4L2. The default device file is /dev/video. Use the -input option to set a different device file.

-v,  -version

Show version of program.

-24p

For Quicktime DV, set the frame rate as 24 fps in the Quicktime file. This only works as expected when the video has been shot in 24p mode.

-24pa

For Quicktime, DV, in addition to setting the frame rate to 24 in the Quicktime file, also reverse the 2:3:3:2 pulldown process by removing the interlaced "C" frame. This only works as expected when the video has been shot in 24p Advanced mode. See http://www.adamwilt.com/24p/

Examples

dvgrab foo-

Captures video data from the default FireWire source and stores it to files foo-001.avi, foo-002.avi, etc.

dvgrab -frames 25 foo-

Assuming a PAL video source, this command records one  second's worth of video data per file.

dvgrab -autosplit -frames 750 -timestamp foo-

Records video data from the default FireWire source, cuts it into chunks of 30 seconds (assuming PAL) or when a new recording starts and names the resulting files according to date and time info in the videostream.

dvgrab -autosplit -size 1998 -csize 4400 -cmincutsize 10  foo-

Records video data from the default FireWire source, cuts it into chunks when a new recording starts or when the current file exceeds 1998 megabytes (actually, mebibytes), or the current collection of files exceeds 4400 megabytes. It also reduces the size of the smallest file made due to a collection size cut to 10 megabytes.

This option is perfect for backing up DV to DVD's as 2 Gb is around the maximum file size that (the current) linux implementation of the ISO9660 filesystem can handle!

Warning: It is possible to make ISO9660 filesystems with files greater than 2 Gb, but the current linux IS09660 driver can't read them! Newer linux kernels may be able to handle ISO9660 filesystems with filesizes greater than 2 Gb.

dvgrab -format hdv -autosplit

Capture from a HDV camcorder.

dvgrab -format mpeg2 -guid 1

Record from a digital TV settop box.

dvgrab -jpeg-over -jpeg-w=320 -jpeg-h=240 -d smpte=1 webcam.jpeg

Capture a single frame, save it as a JPEG named webcam.jpg and exit. This example also demonstrates option handling. You only need to specify enough of a long option name to uniquely identify it. You can use space or equal sign to separate option name and argument. The file format is inferred from the filename extension. Also, since -jpeg-overwrite is used, the filename will be exactly "webcam.jpeg" and not include any numbers.

dvgrab -V

Capture over USB from a UVC compliant DV device.

dvgrab -v4l -input /dev/video1

Capture over USB from a UVC compliant DV device using device file /dev/video1.

dvgrab -format=hdv -autosplit=28800 -srt foo-

Capture from a HDV camcorder, splitting whenever there is a gap in the recording that lasts longer than 8 hours. This will likely generate a separate file for each day (useful for holiday videos). It will also generate subtitle files. Assuming that the files foo-001.m2t and foo-002.m2t are generated, the corresponding subtitle files will be foo-001.srt0, foo-001.srt1 and foo-002.srt0, foo-002.srt1. You can use the subtitle files to show the recording date and time while viewing the video.

Author

Dan Dennedy <dan@dennedy.org> and Daniel Kobras kobras@debian.org>

See http://www.kinodv.org/ for more information and support.