Log in

View Full Version : Extracting video and audio from a FLI file, can it be done?


Chainmax
3rd May 2006, 17:35
I want to make a DVD with intros from my games. I was recently able to make an animated GIF out of the X-Com1 intro (which is a .FLI), but of course it doesn't have any sound. Does anyone know how to make and ncompressed AVI with sound from it?

celtic_druid
3rd May 2006, 18:52
Have you tried ffmpeg? It is listed as a supported format.

Chainmax
3rd May 2006, 23:56
Would it allow me to set huffyuv + PCM as output codecs? Where can I find more info on how to do it?

celtic_druid
4th May 2006, 02:40
First thing to do would be to try ffplay. If it plays ok with audio (I get choppy audio with my sound card, due to SDL, this does not effect converting), then you know ffmpeg can decode it. Yes ffmpeg supports huffyuv and PCM. The ffmpeg docs would be a good place to start I guess.

Mug Funky
4th May 2006, 05:53
FLIC format doesn't support sound... it's basically animated gif with temporal run-length coding. i think it pre-dated animated gif actually, as AA only ever supported gif87a

there must be a separate sound that's being loaded at the same time as the FLI when the game plays.


Autodesk Animator was the coolest program ever. so simple, but powerful. used to spend days making stuff in it during highschool.

Chainmax
4th May 2006, 13:11
celtic_druid: I'll try ffplay and report back.

Mug Funky: really? I'll browse through the game's folders to see if I can find sounds that would correspond to the intro.

Chainmax
4th May 2006, 13:42
Mug Funky: I found the audio, it's stored as three separate midi files. They sound awful when played on WinAmp, at least to what I recall them sounding when playing the game a couple of weeks ago.

I'm about to download "ffmpegGUI Beta build 3c (with ffmpeg CVS 2006-04-28)" from free-codecs. Wish me luck! :)


Does any of you have a good soundcard that can make these midis sound better and transcode them to PCM WAV for me?

jon.schaffer
4th May 2006, 14:10
Does any of you have a good soundcard that can make these midis sound better and transcode them to PCM WAV for me?
Can you put a link? If the result seems good with my card, I'll make the conversion.

Chainmax
4th May 2006, 15:57
Sure, I'll upload them soon. What soundcard do you have?

jon.schaffer
4th May 2006, 16:08
I've got an "old" Sound Blaster PCI 128 which is not too bad and I'll try this first. In fact, my cousin is a musician and has some MIDI software with good MIDI instruments banks and a decent synthesizer. I heard some MIDIs that sounded quite realistic with his material. It's worth the try.

Chainmax
4th May 2006, 16:25
I have a SoundBlaster 5.1 MP3, so your SB128 probably won't sound better. The idea of sending it to your cousin sounds much more appealing.

Chainmax
5th May 2006, 01:06
Ok, here are the three parts that form the intro music. I'd like the end result to be the three files concatenated in order as a single uncompressed WAV.

Heh, this is the first time I ever used the forum's built-in attachment mode :).

Chainmax
5th May 2006, 01:37
I used the following CLI line:

C:\ffmpeg.exe -hq -i ufoint.fli -f avi -vcodec huffyuv ufo.avi

And nothing happens. If I remove the -hq switch, a dos windows appears for a split second and a 0KB AVI is created. What am I doing wrong?

foxyshadis
5th May 2006, 01:44
Try running "cmd" and then run that command in the window, you'll be able to see the error messages that way.

Chainmax
5th May 2006, 01:57
Good idea. Here's the error message:

http://img207.imageshack.us/img207/5241/ffmpegerrormessage8yy.png (http://imageshack.us)

It seems that some parameters have to be set, but the only change I want is to use huffyuv, everything else should remain as-is and the only command that seems to do so is copy in the vcodec option which I can't change :confused:.

Inventive Software
5th May 2006, 12:49
If you want the parameters for the FLI, find in the "Plugins" section of Winamp.com an FLI/FLC input, assuming you have Winamp. The info tag can then give you the info you need to stop ffmpeg assuming frameratese etc.

Inventive Software
5th May 2006, 12:52
As for the ffmpeg help, try :search:. ;)

Chainmax
5th May 2006, 21:47
As you can see, ffmpeg guessed correctly the parameters. I'll try that plugin just to be sure though, so thanks for the tip. As for the documentation, I already found it before my post as should have been evident by

the only command that seems to do so is copy in the vcodec option which I can't change


that still doesn't help me track down the reason for the error message.

Chainmax
6th May 2006, 18:53
Downloaded the plugin and played back the file:

http://img410.imageshack.us/img410/7741/xcom1introinf6qv.png (http://imageshack.us)

So ffmpeg indeed guessed the settings correctly.

Inventive Software
6th May 2006, 20:18
So it thinks. However, it reckoned that it was from a film source. Force the framerate and resolution, and see what happens...

Chainmax
6th May 2006, 20:47
Will do.

[edit]Done, no luck yet:

http://img334.imageshack.us/img334/7260/ppp7ch.png (http://imageshack.us)

celtic_druid
7th May 2006, 09:23
Try ffvhuff or ffv1.

Chainmax
7th May 2006, 20:05
I replaced the vcodec line with both, no luck either. I can upload the FLIC file somewhere, it's only about 2.5MB.

Mug Funky
9th May 2006, 09:52
oh, i just remembered another oddity about the FLIC format: frame rate is expressed in terms of "jiffies" per frame, rather than frames per second. the default speed was usually "4", meaning 4/60 which is 15fps (i'm assuming 1 jiffy = 1/60 sec, which i believe is correct). think of it as "number of NTSC fields per frame". this might make the MIDI timing go off a tad, but that'd be easily fixed by assuming the framerate later to match the audio.

you could upload it for the ffmpeg guys to look at too - i think they have an ftp for this sort of thing. it might be a matter of manually adding colourspace conversions to get it up to RGB 24 so huffy can digest it. i wouldn't recommend chroma subsampling a 320x200 image, as that'd be very noticable at full screen...

[edit]

btw, a sample would be great!

also, there _may_ be a VfW FLIC codec out there... not sure, but it's worth a search as i remember seeing autodesk stuff in "codecs" way back when.

celtic_druid
9th May 2006, 14:20
Also there is Gabest's flicsource filter.

Chainmax
9th May 2006, 15:29
Mug Funky: how developed would this vfw FLIC codec be?

celtic_druid: how developed is Gabest's filter?


You can download the FLIC from here:

http://rapidshare.de/files/20021353/UFOINT.FLI.html


If this turns out to be a flaw in ffmpeg, I'll upload it to its devs.

celtic_druid
9th May 2006, 16:11
Plays fine in MPC. Plays fine in mplayer to and converts ok with mencoder.

Chainmax
9th May 2006, 16:14
So what am I doing wrong?

celtic_druid
9th May 2006, 16:42
Well since mencoder worked here. I'd suggest that you try that instead of ffmpeg. Otherwise there is AVISynth with directshowsource() or Graphedit.

Chainmax
9th May 2006, 16:45
I'll try mencoder then, thanks for the tip :).

Chainmax
9th May 2006, 17:48
The following line:

mencoder ufoint.fli -o ufo.avi -of avi -ovc raw

worked like a charm. Thanks :).



[edit]The raw avi has a weird fourcc:

http://img469.imageshack.us/img469/5576/t5lz.png (http://imageshack.us)

and I can't open it with AVISource or DirectShowSource. Even enabling ffdshow VFW decoding of raw video doesn't help. What should I do?

Chainmax
9th May 2006, 22:58
I tried changing the FourCC with Nic's FourCC changer, but the stream only had black frames. I tried something different without results:

http://img524.imageshack.us/img524/5135/damnit3tp.png (http://imageshack.us)

I don't know what else to do.

celtic_druid
10th May 2006, 02:51
"YV12 is not supported by huffyuv; use vcodec=ffvhuff or format=422p."

Chainmax
10th May 2006, 04:12
I had tried ffvhuff, but mencoder said it was experimental so I didn't go through with it. I didn't see the format=422p though, I'll try it and report back.

celtic_druid
10th May 2006, 05:13
I wouldn't let the fact that it is experimental bother you too much. Any recent ffdshow build should handle it fine. Just probably not recommended for long term backup since support may change in the future.

You could also convert to YUY2 and use huffyuv. When I tested I actually used x264, since it was quicker (less typing). It also supports lossless encoding.

Chainmax
10th May 2006, 13:04
Well I'd rather use a future proof codec, besides I don't know where to put the switch to force ffvhuff encoding. In any case, the format=422p doesn't seem to be a valid switch and I couldn't find out how to convert to YUY2. I'll try lossless x264.

Chainmax
11th May 2006, 19:14
So how do I convert to YUY2 and where do I put it in the CLI? I couldn't find that info on MEncoder's doc page.

celtic_druid
12th May 2006, 07:13
I just tried. mencoder seems to always want to convert to YV12 and feeding huffyuv YUY2 input just results in:
Cannot find codec matching selected -vo and video format 0x32595559.

Compressed it for you using Gabest's filter:
http://celticdruid.no-ip.com/temp/huffyuv.7z
Saved out a bmp sequence, then compressed with VDub, since I was getting out of memory errors using the filter via AVISynth.

Chainmax
12th May 2006, 13:49
Thanks, I owe you one :).

[edit]It's been encoded at 29.97fps, the original is 14fps, so this will run twice as fast :(. I'm sorry to have to ask you, but could you please do it again, this time at 14fps?

celtic_druid
12th May 2006, 14:02
'Tis nothing more than a flag.

Like I said I decoded to an image sequence, then compressed that. VDub defaults to 29.97 and I didn't bother changing it. You can just open, set to 14 and resave using direct streaming.

Chainmax
12th May 2006, 14:17
Are you sure that won't incur in funky framerate changes?

celtic_druid
12th May 2006, 14:38
The only thing it effects is the runtime, which is what you want anyway. The number of frames remains the same, you are just changing the flag that says how many to play per sec.

Chainmax
12th May 2006, 14:57
Awesome. I really can't thank you enough :).

Chainmax
13th May 2006, 02:00
Just out of curiosity, what did you use to encode to lossless x264?

celtic_druid
13th May 2006, 02:46
I didn't that time. I used ffdshow set to handle raw RGB32 to save out an image sequence from MPC. Then I encoded with VDubMod and ffdshow.

Chainmax
13th May 2006, 02:55
I see. What line should I use for lossless x264? I might want to use it for future conversions.

foxyshadis
13th May 2006, 04:28
"x264 -q 0" ought to be sufficient and quick.

quick comparisons of some random clean anime .m2v from another thread:

"-q 0"
encoded 1152 frames, 10.21 fps, 19508.93 kb/s
"-q 0 --threads 2 --subme 1 --analyse none --me dia"
encoded 1152 frames, 21.89 fps, 20886.48 kb/s
"-q 0 --subme 1 --analyse none --me dia"
encoded 1152 frames, 13.91 fps, 20844.00 kb/s

This should give you a quick idea of the speed/size tradeoffs (I included 2 threads in case you have dual-core, I don't remember).