WTV is the new container format used to record television shows in Microsoft Windows Vista Media Center starting with Windows Media Center TV Pack 2008.
WTV is the successor of DVR-MS which is is being replaced with WTV since the introduction of Windows Media Center TV Pack 2008.<ref>Fiji beta over, Windows Media Center TV Pack 2008 hits RTM</ref><ref>Microsoft Fiji beta over; final ‘TV Pack’ due soon</ref> WRT is also the default recording format for Windows 7 Media Center, its video encoder will support encoding to H.264 1-pass CBR Baseline profile up to 1.5 Mbit/s, 640x480pixels at 30 frame/s, and the aadio encoder will support low complexity AAC stereo at 44.1 or 48 kHz sample rate and 96, 128, 160 or 192 kbit/s bit rate.
The file format is based on observations from WTV file hex dumps. The information is not verified against source code or any MS specification and may contain inaccuracies.
- UInt - 4 byte little endian
- ULong - 8 bytes little endian
- String - zero terminated unicode (UTF-16)
- ClassID - 0x10 byte unique identifier. Represented as hex value as stored (not little endian)
- a 0x40000 sized file piece. Currently know chunk types are meta and data chunks
- Meta Chunk
- a subdivision of Chunk with a size of 0x1000.
- Data Chunk
- holds AV stream data, subdivided by Class
- a unique identifer and lowests level container. Format and size varies.
Master Meta Data Chunk
- Main Meta Data Chunk (@0x0)
- classId (ClassID) "B7 D8 00 20 37 49 DA 11 A6 4E 00 07 E9 5E AD 8D"
- subClassId (ClassID) "8C C3 D2 C2 7E 9A DA 11 8B F7 00 07 E9 5E AD 8D"
- unknown (0x18 bytes) Pointers? Always seems to be the same. "01 00 00 00 02 00 00 00 00 10 00 00 00 00 04 00 08 04 00 00 00 00 00 00"
- (0x38) metaTablePointer (UInt) Pointer to the master meta table (0x11 00 00 00) ???
- unknown (0x1C bytes)
- (0x58) fileLen (UInt) File lenght in meta units
Tables Meta Data Chunk
Located at 0x11000 (possible pointed to by UInt at 0x38). Defines the location of tables. This is import because the table Meta Chunks must be removed from the data stream
- Table Meta Class (@0x11000)
- classID (ClassId)- 92 B7 74 91 59 70 70 44 88 DF 06 3B 82 CC 21 3D
- classLen (ULong) - From start of class
- unknown (8 bytes)
- descriptionLen (UInt) - The number of chars in the description. Actual len = descriptionLen * 2;
- description (String - descriptionLen * 2)
- offset (UInt) offset of the item in Meta Chunk units (0x100)
- flag (UInt) 1=list of UInts pointing to the location of data (zero terminated), 0=This is the location of data
- unknown - remainder of packet
Import entry - "table.0.entries.legacy_attrib" contains the metadata for the program
Data Chunk Format:
The A/V packet stream consists of classes with the following format. Usually starts @ 0x40000:
- Header (0x20) - DWord (8 byte) aligned
- classId: ClassID (0x10)
- len: UInt - includes header length + payload len.
- streamId: UInt - AV SubStream ID.
- packetCounter: ULong
- Payload (len - 0x20) varies by classId
- Padding - Used to force DWord (8 byte) alignment of headers: paddingLen =(len % 8==0) ? 0 : 8 - len % 8;
Known ClassID formats
- http://msdn.microsoft.com/en-us/library/cc963726.aspx Specification of Consumption of a WTV file in DirectShow
- http://samples.mplayerhq.hu/wtv/ Samples
- http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/115023 Patch