There are many variants of the DV format, officially specified in:
- IEC 61834 - basic DV and HDV
- SMPTE 306M - DVCPRO (obsoleted by 314M)
- SMPTE 314M - DVPCRO, DVCPRO50
- SMPTE 370M - DVCPRO HD
A large part of each of these standards defines tape formats, but we are only concerned with the DV interchange format (DIF) which uses the same basic elements for all variants.
Other sources of information:
- Adam Wilt's DV technical details
- Sony's overview of the DVCAM tape format. This has separate physical tracks for video, audio and timecode and has error-correcting codes which do not appear in DIF. However, the helical tracks in the tape format translate 1:1 into sequences in DIF.
- US government information on DIF
- ffmpeg source files libavcodec/dv* and libavformat/dv*
- libdv source code, particularly dv_types.h
All bits and bytes not defined are reserved and should be set to 1.
Frame format
Each video frame is compressed separately (except in HDV). The video, the corresponding audio and metadata are divided into 80-byte blocks which are multiplexed in the following 150-block (12 KB) sequence:
- block 0: header (type 0x1f)
- blocks 1-2: subcode (timing metadata) (type 0x3f)
- blocks 3-5: VAUX (video metadata) (types 0x50-0x5f)
- block 6 and every 16th block after: audio and AAUX (audio metadata) (types 0x70-0x7f)
- all other blocks: video (types 0x90-0x9f)
This sequence is repeated between 10 and 48 times depending on the DV variant and video standard used, for a frame size of between 120 and 576 KB. DVswitch only supports the 25 Mbit (video) variants of DV, which have 10 (NTSC) or 12 (PAL) sequences per frame.
Block format
Each block begins with a 3-byte header identifying its type and position in the frame, to aid resynchronisation:
- byte 0:
- bits 5-7: block type = 0 (header), 1 (subcode), 2 (VAUX), 3 (audio) or 4 (video)
- bits 0-3: arbitrary
- byte 1:
- bits 4-7: sequence number (range [0,9] or [0,11] depending on video system)
- bit 3: channel number = 0 (usual) or 1 (second half of frame in 50 Mbit/s variants)
- byte 2: block number (within sequence and type)
The format of the remaining 77 bytes varies between types.
Header block
- byte 0: type = 0x3f (60-field variants) or 0xbf (50-field variants)
- byte 1:
- bits 0-2: track application id (APT) = 0 (IEC 61834 variants) or 1 (SMPTE 314M variants)
- byte 2:
- bits 0-2: audio APT
- bit 7: audio valid flag, inverted
- byte 3:
- bits 0-2: video APT
- bit 7: video valid flag, inverted
- byte 4:
- bits 0-2 subcode APT
- bit 7: subcode valid flag, inverted
Subcode blocks
Each block contains 6 of the following subcode structures followed by 29 reserved bytes.
- byte 0:
- bits 0-3: arbitrary
- bits 4-6 (structure 0): subcode APT
- bits 4-6 (block 1 structure 5): general APT
- bit 7: = 1 (first half of channel) or 0 (second half of channel)
- byte 1:
- bits 0-3: subcode sync block number
- bits 4-7: arbitrary
- bytes 3-7: time code, binary group or no info pack
VAUX blocks
These contain 15 packs followed by 2 reserved bytes.
Audio blocks
These contain 1 pack followed by 36 16-bit PCM samples or 48 12-bit companded PCM samples. The samples are not stored in original order but are shuffled, perhaps to aid audio playback from a limited number of blocks during fast-forward or rewind.
Video blocks
Video compression is complex and will not be described here. Metadata is stored separately in the VAUX blocks.
Pack format
Packs are 5 bytes long, with the first byte being a type code.
Time code (TC)
This is based on LTC but without the sync word. The user bits may be encoded in a binary group pack.
Appears as pack 3 in each subcode block, and also as pack 5 in subcode blocks in the first half of each frame.
- byte 0: pack type = 0x13
- byte 1:
- bits 0-5: frames past second, binary-coded decimal (BCD)
- bit 6: drop-frame timecode flag
- bit 7: colour frame synchronisation flag (irrelevant for DV?)
- byte 2:
- bits 0-6: seconds past minute, BCD
- byte 3:
- bits 0-6: minutes past hour, BCD
- bit 7: binary group flag 0
- byte 4:
- bits 0-5: hours past midnight, BCD
- bits 6-7: binary group flags 1-2
Binary group (BG)
Appears as pack 4 in subcode blocks in the first half of each frame.
- byte 0: pack type = 0x14
- bytes 1-4: dependent on binary group flags from accompanying time code pack
AAUX source (AS)
Appears in audio block 3 (sequence block 54) in even sequences and audio block 0 (sequence block 6) in odd sequences.
- byte 0: pack type = 0x50
- byte 1:
- bits 0-5: number of audio frames in video frame minus minimum value
- bit 7: unlocked audio sample clock flag
- byte 2:
- bits 0-3: audio mode = 0 (first channel or shuffled pair), 1 (second channel or shuffled pair) or 0xf (invalid audio)
- bit 4 (IEC 61834): pair flag = 0 (usually; not sure what this is for)
- bits 5-6: number of audio channels shuffled together, minus 1
- bit 7: lumped stereo flag = 0 (usually; not sure what this is for)
- byte 3:
- bits 0-4: signal type = 0 (25 Mbit) or 2 (50 Mbit)
- bit 5: video system = 0 (525/60 "NTSC") or 1 (625/50 "PAL")
- bit 6: multi-language flag = 1 (usually; not sure what this is for)
- byte 4:
- bits 0-2: sample quantisation = 0 (16-bit LPCM), 1 (12-bit companded PCM) or 2 (20-bit LPCM)
- bits 3-5: sample frequency = 0 (48 kHz), 1 (44.1 kHz) or 2 (32 kHz)
- bit 7: emphasis flag, inverted
AAUX source control (ASC)
Appears in audio block 4 (sequence block 70) in even sequences and audio block 1 (sequence block 22) in odd sequences.
- byte 0: pack type = 0x51
- byte 1:
- bits 0-1: source and recorded situation = 0 (emphasis off) or 1 (emphasis on)
- bits 2-3: volume compression level = 0 (once), 1 (twice), 2 (thrice) or 3 (unknown)
- bits 4-5: input signal type = 0 (analogue), 1 (digital) or 3 (unknown)
- bits 6-7: copy protection = 0 (unrestricted)
- byte 2:
- bits 0-2: = 7 (usually; not sure what this is for)
- bit 3: recording mode = 1 (original) or 0 (dubbed)
- bit 4: flag for fading at recording end
- bit 5: flag for fading at recording start
- bit 6: recording end flag, inverted
- bit 7: recording start flag, inverted
- byte 3:
- bits 0-6: playback speed = 32 (IEC 61834) or 4 * frame rate (SMPTE 314M)
- bit 7: playback direction = 1 (forward) or 0 (reverse)
- byte 4:
- bits 0-6: genre category = 0x7f (unknown)
Audio/video recording date
- byte 0: pack type = 0x52 (audio), 0x62 (DV video) or 0x92 (MPEG-2 video)
- byte 1: time zone
- bits 0-5: hours ahead of UTC, modulo 24, BCD, or 0x3f (unknown)
- bit 6: flag for half-hour ahead, inverted
- bit 7: daylight savings flag, inverted (the examples imply that daylight savings is not included in the offset encoded by the other bits)
- byte 2:
- bits 0-5: day of month, BCD, or 0x1f (unknown)
- byte 3:
- bits 0-4: month of year, BCD, or 0x1f (unknown)
- bits 5-7: day of week, in range [0,6] (Sunday-Saturday) or 7 (unknown)
- byte 4: year % 100, BCD, or 0xff (unknown)
Audio/video recording time
- byte 0: pack type = 0x53 (audio), 0x63 (DV video) or 0x93 (MPEG-2 video)
- byte 1:
- bits 0-5: frames past second, BCD, or 0x3f = unknown
- byte 2:
- bits 0-6: seconds past minute, BCD
- byte 3:
- bits 0-6: minutes past hour, BCD
- byte 4:
- bits 0-5: hours past start of recording, BCD
VAUX source (VS)
Appears as pack 9 in VAUX block 2 (sequence block 5) in even sequences and pack 0 in VAUX block 0 (sequence block 3) in odd sequences.
- byte 0: pack type = 0x60
- byte 2:
- bits 4-5: colour frames (CLF) id (defined in ITU-R BT.470-4)
- bit 6: CLF valid flag, inverted
- bit 7: colour flag
- byte 3:
- bits 0-4 (SMPTE 314M/370M): signal type = 0 (DVCAM, DVCPRO), 4 (DVPCRO50), 0x14 (DVCPRO HD 1080i) or 0x18 (DVCPRO HD 720p)
- bits 0-4 (IEC 61384): undefined = 0 (usually)
- bit 5: video system = 0 (525/60 "NTSC") or 1 (625/50 "PAL")
- byte 4: Vertical Interval Subcarrier phase (VISC) = 127 (no information) or in range [-120, 120] (phase -180° to 180°)
VAUX source control (VSC)
Appears as pack 10 in VAUX block 2 (sequence block 5) in even sequences and pack 1 in VAUX block 0 (sequence block 3) in odd sequences.
- byte 0: pack type = 0x61
- byte 1:
- bits 6-7: copy protection = 0 (unrestricted)
- byte 2:
- bits 0-2: frame aspect ratio = 0 (4:3), 1 (16:9 letter-boxed in 4:3) or 2 (16:9)
- bits 3-7: reserved = 0x19
- byte 3:
- bits 0-3: reserved = 0xc
- bit 4: interlace flag
- bit 5: flag for frame differing from previous = 1 (usually)
- bit 6: flag for field 1 encoded before field 2 = 1 (usually)
- bit 7: flag for both fields present = 1 (usually)
No info pack
This appears where information is missing or in the subcode and VAUX blocks where no pack is assigned.
- bytes 0-4: = 0xff