Introduction
An .mpg or .mpeg file usually holds an MPEG-1 or MPEG-2
program stream: MPEG video and audio interleaved for storage on a reliable medium such
as a disc or a hard drive. MPEG-1 files were the video of Video CDs and early PC
multimedia, and MPEG-2 program streams are the basis of DVD video.
The .vob (video object) files in the VIDEO_TS folder of a
DVD are MPEG-2 program streams with DVD restrictions. They also carry DVD navigation
packets, AC-3 or other audio, and subtitles as images. Each VOB file is at most 1 GB, so
a film is split across several.
Structure
A program stream is a series of packs. Each pack starts with the
pack start code
00 00 01 BA and the system clock, and holds one or more
PES packets. Each
PES packet starts with 00 00 01 and a
stream ID: E0 to
EF for video, C0 to DF for MPEG audio, and
BD for private stream 1, which DVDs use for AC-3 audio and subtitles. A
system header (00 00 01 BB) describes the streams, and the end code
00 00 01 B9 closes the stream.
0Pack header00 00 01 BAand the system clock12 or 14 bytes…System header00 00 01 BB, in the first packvaries…PES packets00 00 01, stream ID, then video or audiorepeated…further packs, then the end code00 00 01 B9repeated
Not described
Known, not yet covered
- Reference: the bit layout of the MPEG-1 pack header and the fields of the program stream map were written from memory of ISO/IEC 11172-1 and ITU-T H.222.0, whose text is in PDFs that were not opened. The pages say so.
- Viewer: there is no MPEG program stream viewer plugin yet; the explorer shows the file as bytes.
Links
Software
- VLC media player – free media player that plays MPG and VOB files (Windows, macOS, Linux, mobile)
- mpv – free, minimal media player (Windows, macOS, Linux)
- HandBrake – free video converter for DVDs and MPEG files (Windows, macOS, Linux)
- FFmpeg – command-line tools that read, write and convert program streams (Windows, macOS, Linux)
- MakeMKV – copies DVD titles into MKV files (Windows, macOS, Linux)
Developers
- libavformat – FFmpeg’s container library, which reads and writes program streams (C)
Reference
- ITU-T Recommendation H.222.0 – MPEG-2 Systems, which defines the program stream