[PATCH] FLIC demuxer fix for the first two X-COM games (also adds audio)
Good morning Last christmas I reverse-engineered the video format used in the first two X-COM games ("UFO: Enemy Unknown" and "X-COM: Terror from the Deep"). It turned out to simply be normal FLIC files with extra audio chunks. This patch detects the presence of such a chunk at the start of the file, and adds a 22050 Hz mono 8-bit audio stream in that case. It also calculates the proper framerate, since these videos appear to have been created in a two-step process (audio added later, thus altering the frame rate). In order to detect these videos I had to peek at the first preamble in the file, which means reading and rewinding six bytes. This should hopefully not be a problem since I'm fairly sure ByteIOContext has a small buffer for these sort of things. A similar trick is used in the Magic Carpet case, so I've figured it's OK anyway. Regarding audio, the code assumes all audio chunks contain the same number of samples and sets block_align accordingly. One final thing is that these audio chunks have an extra 10 B header not accounted for in the chunk header, which caused the old demuxer to "derail". I ran the regression test for good measure. They still pass. Samples uploaded to incoming/xcom/ (*.VID). Works for all five videos in the second game, but I haven't been able to test it on those in the first game. /Tomas
On Fri, Feb 26, 2010 at 10:05:00AM +0100, Tomas H?rdin wrote:
Good morning
Last christmas I reverse-engineered the video format used in the first two X-COM games ("UFO: Enemy Unknown" and "X-COM: Terror from the Deep"). It turned out to simply be normal FLIC files with extra audio chunks. This patch detects the presence of such a chunk at the start of the file, and adds a 22050 Hz mono 8-bit audio stream in that case. It also calculates the proper framerate, since these videos appear to have been created in a two-step process (audio added later, thus altering the frame rate).
In order to detect these videos I had to peek at the first preamble in the file, which means reading and rewinding six bytes. This should hopefully not be a problem since I'm fairly sure ByteIOContext has a small buffer for these sort of things. A similar trick is used in the Magic Carpet case, so I've figured it's OK anyway.
Regarding audio, the code assumes all audio chunks contain the same number of samples and sets block_align accordingly. One final thing is that these audio chunks have an extra 10 B header not accounted for in the chunk header, which caused the old demuxer to "derail".
I ran the regression test for good measure. They still pass. Samples uploaded to incoming/xcom/ (*.VID). Works for all five videos in the second game, but I haven't been able to test it on those in the first game.
/Tomas
flic.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 6 deletions(-) b303ed0974425f738f96476229cd75b8c01817a3 xcom.patch
looks ok, probably mike will want to add a test to fate and maybe flic needs a second maintainer [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Asymptotically faster algorithms should always be preferred if you have asymptotical amounts of data
Michael Niedermayer wrote:
On Fri, Feb 26, 2010 at 10:05:00AM +0100, Tomas H?rdin wrote:
Good morning
Last christmas I reverse-engineered the video format used in the first two X-COM games ("UFO: Enemy Unknown" and "X-COM: Terror from the Deep"). It turned out to simply be normal FLIC files with extra audio chunks. This patch detects the presence of such a chunk at the start of the file, and adds a 22050 Hz mono 8-bit audio stream in that case. It also calculates the proper framerate, since these videos appear to have been created in a two-step process (audio added later, thus altering the frame rate).
In order to detect these videos I had to peek at the first preamble in the file, which means reading and rewinding six bytes. This should hopefully not be a problem since I'm fairly sure ByteIOContext has a small buffer for these sort of things. A similar trick is used in the Magic Carpet case, so I've figured it's OK anyway.
Regarding audio, the code assumes all audio chunks contain the same number of samples and sets block_align accordingly. One final thing is that these audio chunks have an extra 10 B header not accounted for in the chunk header, which caused the old demuxer to "derail".
I ran the regression test for good measure. They still pass. Samples uploaded to incoming/xcom/ (*.VID). Works for all five videos in the second game, but I haven't been able to test it on those in the first game.
/Tomas
flic.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 6 deletions(-) b303ed0974425f738f96476229cd75b8c01817a3 xcom.patch
looks ok, probably mike will want to add a test to fate and maybe flic needs a second maintainer
Indeed. Thanks for the contributions. No game format is too minor. -- -Mike Melanson
On Mon, 2010-03-15 at 18:18 -0700, Mike Melanson wrote:
Michael Niedermayer wrote:
On Fri, Feb 26, 2010 at 10:05:00AM +0100, Tomas H?rdin wrote:
snip
flic.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 6 deletions(-) b303ed0974425f738f96476229cd75b8c01817a3 xcom.patch
looks ok, probably mike will want to add a test to fate and maybe flic needs a second maintainer
Indeed. Thanks for the contributions. No game format is too minor.
Ah, finally a response. I was about to bump this, but luckily I didn't have to :) I did a little more digging and it seems the first game uses normal FLICs with an audio sidecar somewhere. I therefore changed the wording of the patch a bit since it turns out it merely fixes support for videos from Terror from the Deep. Updated patch attached. /Tomas
On Tue, Mar 16, 2010 at 09:19:28AM +0100, Tomas H?rdin wrote:
On Mon, 2010-03-15 at 18:18 -0700, Mike Melanson wrote:
Michael Niedermayer wrote:
On Fri, Feb 26, 2010 at 10:05:00AM +0100, Tomas H?rdin wrote:
snip
flic.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 6 deletions(-) b303ed0974425f738f96476229cd75b8c01817a3 xcom.patch
looks ok, probably mike will want to add a test to fate and maybe flic needs a second maintainer
Indeed. Thanks for the contributions. No game format is too minor.
Ah, finally a response. I was about to bump this, but luckily I didn't have to :) I did a little more digging and it seems the first game uses normal FLICs with an audio sidecar somewhere. I therefore changed the wording of the patch a bit since it turns out it merely fixes support for videos from Terror from the Deep. Updated patch attached.
/Tomas
Now you have me wondering if this works with Hi-Octane. I'll let you know when i find the install disc.. -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
On Tue, 2010-03-16 at 23:30 +1100, Peter Ross wrote:
On Tue, Mar 16, 2010 at 09:19:28AM +0100, Tomas H?rdin wrote:
On Mon, 2010-03-15 at 18:18 -0700, Mike Melanson wrote:
Michael Niedermayer wrote:
On Fri, Feb 26, 2010 at 10:05:00AM +0100, Tomas H?rdin wrote:
snip
flic.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 66 insertions(+), 6 deletions(-) b303ed0974425f738f96476229cd75b8c01817a3 xcom.patch
looks ok, probably mike will want to add a test to fate and maybe flic needs a second maintainer
Indeed. Thanks for the contributions. No game format is too minor.
Ah, finally a response. I was about to bump this, but luckily I didn't have to :) I did a little more digging and it seems the first game uses normal FLICs with an audio sidecar somewhere. I therefore changed the wording of the patch a bit since it turns out it merely fixes support for videos from Terror from the Deep. Updated patch attached.
/Tomas
Now you have me wondering if this works with Hi-Octane. I'll let you know when i find the install disc..
-- Peter
Does anyone else want to weigh in on this? I could add myself as maintainer for it I guess - it's only five files that needs this patch to the best of my knowledge. Mike, do you want to add tests for this? I uploaded samples earlier (incoming/xcom) - I still have them if you need them. /Tomas
Tomas H?rdin wrote:
Does anyone else want to weigh in on this? I could add myself as maintainer for it I guess - it's only five files that needs this patch to the best of my knowledge.
Mike, do you want to add tests for this? I uploaded samples earlier (incoming/xcom) - I still have them if you need them.
Thanks for the samples and the patch. I got to test it out today and it seems to work fine. -- -Mike Melanson
On Sat, 2010-04-10 at 15:45 -0700, Mike Melanson wrote:
Tomas H?rdin wrote:
Does anyone else want to weigh in on this? I could add myself as maintainer for it I guess - it's only five files that needs this patch to the best of my knowledge.
Mike, do you want to add tests for this? I uploaded samples earlier (incoming/xcom) - I still have them if you need them.
Thanks for the samples and the patch. I got to test it out today and it seems to work fine.
Applied. FATE tests left I suppose, which I have no idea how to set up. /Tomas
participants (4)
-
michaelni@gmx.at -
mike@multimedia.cx -
pross@xvid.org -
tomas.hardin@codemill.se