The Problem:
There is a bunch of video files that can only be played with a custom player and I'd like to reverse engineer it so that the video can be played on common media players (like VLC or MPC).
What I have discovered so far:
Probing the files revealed that they are EBML type which is used by the Matroska Media containers.
So I changed the file extension to .mkv and further examined the file with MKVToolNix and FFMPEG.
MKVToolNix probing revealed that there was a video track encoded with h.264 and an audio track encoded with AC3 encoding.
But the audio track had been "marked" as a video and the video track as an audio, by deliberately changing the "track type" tag.
MKVToolNix screenshot of the track info:
- FFMPEG also confirms the same:
[matroska,webm @ 0x7f966c800a00] Failed to open codec in avformat_find_stream_info
[h264 @ 0x7f966c811a00] Codec type or id mismatches
[ac3 @ 0x7f966c812600] Codec type or id mismatches[matroska,webm @ 0x7f966c800a00] Could not find codec parameters for stream 0 (Audio: h264 (High), 0 channels): unspecified sample rate Consider increasing the value for the 'analyzeduration' and 'probesize' options
[matroska,webm @ 0x7f966c800a00] Could not find codec parameters for stream 1 (Video: ac3, none, 192 kb/s): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options
(redacted)
Duration: 01:46:42.00, start: 0.035000, bitrate: 2629 kb/s
... Stream #0:0(eng): Audio: h264 (High), 0 channels (default)Stream #0:1(eng): Video: ac3, none, 192 kb/s, 31.25 fps, 31.25 tbr, 1k tbn, 1k tbc (default)
Doubts:
Is it possible to edit the Matroska container and change the "track type" tag of the media tracks?
Is it possible to use ffmpeg to specify the correct input codec for both the video and audio track, and extract them (preferably without reencoding)?