Standard-definition (SD) and high-definition (HD) video data, packed as MPEG-2 and MPEG-2 TS or just TS in short, are transmitted digitally according to DVB-S and DVB-S2 specifications. Once received, the data is decoded to the moving picture frames displayed on the screen of the SDTV or HDTV.
The digital data packed in MPEG-2 or TS format can easily become broken during transmission and/or storing processes. A broken MPEG-2 or TS file could become quite disturbing when it’s being played or converted. Media players crash, pause, or get out of synchrony, and media converters refuse to open, partially convert, or get out of sync when dealing with such files.
Broken MPEG-2 or MPEG Transport Stream (MPEG-TS) video files are not necessarily transmitted or stored erroneously, since I’ve come across many MPEG2/TS files which are OK by the needs of say Media Player Classic - Home Cinema (MPC-HC), but have stuttering async frames when analyzed seriously.
To fix broken MPEG-2 or MPEG Transport Stream files, follow the instructions for the tools described below:
MPEG2Repair
MPEG2Repair is the lightest and fastest solution around.
Browse for the broken file, hit Find PID's, select an output file, and hit Start.
There are rare cases where its Find PID's button complains about the file being seriously broken, damaged, or incomplete: “Failed to find video PID. Try different program number or video track.” This is when you need to take DGIndex or Project-X steps.
VideoReDo Plus / VideoReDo TVSuite
VideoReDo Plus is proprietary software not specifically targeted to repair TS or MPEG-2 streams; a DVD authoring and editing tool, but able to do the repair as well.
Open the broken file, and from File menu, hit “Save Video As…” Then answer Yes to the dialog asking “There are no cuts defined. Do you wish re-mux the entire input file?” Now select your demanding output type from MPEG Program Stream (*.mpg), Elementary Streams (*.mpv), or Transport Stream (*.ts), and hit Save.
There are rare cases where VideoReDo Plus and VideoReDo TVSuite export only a portion of the stream, or misplace portions of the stream along the generated file, this is also desperately in need of DGIndex or Project-X to get fixed.
DGIndex
DGIndex, part of DGMPGDec package, is a powerful yet easy-to-use tool primarily designed to index MPEG video streams. DGIndex is able to decode and index most MPEG1/2 streams including elementary streams, program streams, VOBs, VCDs, SVCDs, PVA files, and transport streams. More importantly—at least to us—it supports video demuxing (m1v/m2v) and audio demuxing (ac3, dts, aac, mpa, and lpcm) as well as optimized iDCTs, luminance filtering, cropping, and more.
Open the broken file, and from File menu, hit Save Project and Demux Video. For a given MPEG2-TS containing MPEG-2 video and MPEG-1 Audio Layer II, DGIndex will generate an M2V video file, plus an MP2 audio file, also kindly providing you with the audio/video delay in milliseconds as a portion of the audio file name!
The only downside to DGIndex for the rookies is DGMPGDec DGIndex demuxes container’s video and audio apart, which is actually appropriate if you’re going to open it in VirtualDub. The M1V/M2V file feeds the VirtualDub’s “Open video file…” and the audio file—after it’s converted to a VirtualDub-friendly format—feeds VirtualDub’s “Audio from other file…”
To convert the MP2 file into a VirtualDub-friendly WAV file, use FFmpeg as follows:
ffmpeg.exe -i "input.mp2" -f wav -acodec pcm_s16le -y "output.wav"
The name of the audio file generated by DGIndex contains the audio PID, format, channel count, sample rate, bit rate, and generally ends to DELAY -{delay in milliseconds}ms (e.g., Cascada - Dangerous PID 060 L2 2ch 48 256 DELAY -362ms.mp2)
You need to put the delay preserving its sign inside VirtualDub’s audio option here: Audio \ Interleaving… \ Delay audio track by
Project-X
Project-X, a free DVB demux tool written entirely in Java, tries its best to handle and repair many stream types. Many users are looking for a Windows application, and ignore it just because it’s a Java executable (JAR), but believe me, it’s the most powerful MPEG/TS repair tool around supporting the vastest stream types.
If you’re looking for a Windows portable edition of ProjectX, just because you’re not willing to install Java Development Kit (JDK) or Java Runtime Environment (JRE), ProjectX 0.90.4.00.b32 Portable created by Dirk Paehl is downloadable here.
Please note under Aero-enabled Windows Vista, Windows Server 2008, Windows 7, and Windows Server 2008 R2, the JRE behind Project X disables Windows Aero temporarily while it’s running, imposing Windows to show “The color scheme has been changed to Windows 7 Basic.” The reason is behind JRE’s incompatibility with Windows Aero’s composition.
Open the broken file, and on the upper-left corner of the GUI, hit QuickStart. This will demux the DVB file to a video (e.g., M2V) and an audio (e.g., MP2) file. An advantage of ProjectX over DGIndex is the demuxed audio file using ProjectX is artificially synchronized against the demuxed video stream, so there’s no need to specify a delay value when remuxing audio/video streams together.








Thank you for your post. Very interesting.
ReplyDeleteAnyway, I'm still waiting for something to fix TS's captured from digital terrestrial TV in my country, which are not DVB.
Here in Argentina, we use ISDB-T. The video in the TS is h264.
Regards.