Author Topic: Full motion video  (Read 48474 times)

0 Members and 1 Guest are viewing this topic.

Offline Kawa

Re: Full motion video
« Reply #60 on: March 18, 2016, 11:02:53 AM »
This is fantastic, guys. Great program.
Which one?  :D

Offline Collector

Re: Full motion video
« Reply #61 on: March 18, 2016, 12:46:21 PM »
Yeah, there are two. The heart of my GUI program uses Kawa's code. I had nothing to do with his command line version.
KQII Remake Pic

Offline Collector

Re: Full motion video
« Reply #62 on: March 18, 2016, 01:04:47 PM »
I almost hate to ask, but source for the new version?
KQII Remake Pic

Offline Kawa

Re: Full motion video
« Reply #63 on: March 18, 2016, 01:51:21 PM »
I almost hate to provide.

You'll notice there's a new feature in this which isn't in the precompiled version: -x switch on playback, acts as shown.

Offline Collector

Re: Full motion video
« Reply #64 on: March 18, 2016, 03:34:48 PM »
Is this to display the pixel changes between frames?
KQII Remake Pic

Offline Kawa

Re: Full motion video
« Reply #65 on: March 18, 2016, 04:25:48 PM »
It appears to be that, yes.

In other news, just SysWinDrawing won't cut it if I want to explode animated GIFs -- they're converted to 24bpp, which my toolkit then refuses to work with. I suppose if I really want to support that, I could maybe write my own GIF reader?

Offline Collector

Re: Full motion video
« Reply #66 on: March 18, 2016, 08:27:28 PM »
If by explode you mean to dump all individual images in an animated GIF, I came up with this method:
Code: [Select]
        Image[] getFrames(Image aniGIF)
        {
            int numFrames = aniGIF.GetFrameCount(FrameDimension.Time);
            Image[] frames = new Image[numFrames];
            for (int i = 0; i < numFrames; i++)
            {
                aniGIF.SelectActiveFrame(FrameDimension.Time, i);
                frames[i] = ((Image)aniGIF.Clone());
            }
            return frames;
        }

and called with:
Code: [Select]
Image[] frames = getFrames(Image.FromFile(aniGIFPath));
Given that this dumps them as GIFs they stay 8-bit paletted. As long as the animated GIF is 320x200, it seems to work flawlessly for dumping images ready for converting to a SEQ.
« Last Edit: April 02, 2016, 11:50:41 AM by Collector »
KQII Remake Pic

Offline Kawa

Re: Full motion video
« Reply #67 on: March 18, 2016, 08:59:16 PM »
...You didn't "come up" with that. That's one of the search results, you cad.

But whatever, I'll try again tomorrow.

And we're back awake. Happy Saturday everyone! Now, loading a non-animated GIF like this
Code: [Select]
using (var maybeAnim = new Bitmap(filename))and looking at maybeAnim in debug reveals that its PixelFormat to be Format8bppIndexed, which is good. Loading an animated gif -- the one attached, in fact -- reveals it to be Format32bppArgb. Indeed, extracting a frame with
Code: [Select]
var newFrame = ((Bitmap)maybeAnim.Clone()); and looking at newFrame.PixelFormat reveals it too to be 32-bit.

I know it's not a quirk of the input image -- this forum's Marquee toolbar button () and the last-seen Tumblr Radar also do this.
« Last Edit: March 19, 2016, 06:11:35 AM by Kawa »

Offline Collector

Re: Full motion video
« Reply #68 on: March 19, 2016, 04:23:21 PM »
...You didn't "come up" with that. That's one of the search results, you cad.
Oh spare me the attitude. I never claimed that I wrote it from scratch. Actually it came from another project of mine that was the result of yes, Google  ::) and experimentation.
KQII Remake Pic

Offline Kawa

Re: Full motion video
« Reply #69 on: March 19, 2016, 05:06:29 PM »
Next time I want to be sarcastic, I'll try to find even more old-fashioned things to call you, okay? :)

Offline Kawa

Re: Full motion video
« Reply #70 on: April 02, 2016, 10:21:25 AM »
I figured there's a few ways to load an image. I like to use x = new Bitmap(file), but there's also y = Bitmap.FromFile(file) (which oddly returns an Image, not a Bitmap, hence my preference), and z = Image.FromFile(file) plus a few that don't use filenames. So I thought, what if this causes my animated gifs to load as anything but 8bpp indexed?

So I wrote a quick test program that loads two different gifs, attached below, in three different ways, and reports on their PixelFormat properties.

Unsurprisingly, the one returns an image with PixelFormat.Format8bppIndexed, and the other is always PixelFormat.Format32bppArgb.

How, then, does this line from Collector's SEQTool apparently return 8bpp images?
Code: [Select]
Image[] frames = getFrames(Image.FromFile(aniGIFPath));

Offline Collector

Re: Full motion video
« Reply #71 on: April 02, 2016, 11:57:22 AM »
That is just calling the method I posted above. It is just cloning each frame in the ani GIF. Of course I am writing each to a file so they can be easily edited.
KQII Remake Pic

Offline Kawa

Re: Full motion video
« Reply #72 on: April 02, 2016, 01:03:35 PM »
I'm rightfully angry now. Last time I tried to explode a gif and save the individual frames, Image.Save used the wrong format -- the .gif files were secretly PNG. Yet somehow,

Code: [Select]
var img = Bitmap.FromFile("ArArea5R.gif");
Console.WriteLine(img.PixelFormat); //<-- Format32bppArgb
img.SelectActiveFrame(FrameDimension.Time, 1);
var frame = ((Image)img.Clone());
Console.WriteLine(frame.PixelFormat); //<-- Format32bppArgb
frame.Save("ArArea5R_A.gif");
var newimg = Bitmap.FromFile("ArArea5R_A.gif");
Console.WriteLine(newimg.PixelFormat); //<-- Format8bppIndexed

On the other hand, there's always the possibility of GIF files to have per-frame palettes to make me feel a little better.

Offline troflip

Re: Full motion video
« Reply #73 on: April 02, 2016, 04:30:03 PM »
That's not surprising to me. I think the Image stuff in the .net libraries is wraps gdiplus for a lot of it's functionality. That's what Companion used to use for loading gifs, but it wouldn't always give me an 8-bit indexed image (it depended on the particular gif). So I ended up switching to a 3rd party library to load gifs.
Check out my website: http://icefallgames.com
Groundhog Day Competition

Offline Kawa

Re: Full motion video
« Reply #74 on: April 02, 2016, 05:24:37 PM »
That's not surprising to me. I think the Image stuff in the .net libraries is wraps gdiplus for a lot of it's functionality.
Correct! Also, I should get one of the earlier gifs I tried to load, see what happens when I try to save a frame from those.

Cos I distinctly remember trying to save to a file with one type's extension, only to get the other unless I explicitly specified an ImageFormat. Hence my toolkit's inclusion of an extension method that guesses the ImageFormat from the extension given. Yet in the experiment earlier today I got perfectly valid gif files.

Update: Collector, I despise you so much right now. Know that this feeling will pass as I sleep. I didn't change a single line of code in SeqMaker2, nor even in the project settings -- it still used "giphy2.gif" as the command line parameters. Not one thing, and yet... well, see the attachment. Good night, everyone.
« Last Edit: April 02, 2016, 05:42:42 PM by Kawa »


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.056 seconds with 21 queries.