Make sprite sheet out of Avi file

I don’t know if it’s discontinued in the latest CGE version (I cannot find it after re-installing) but there was a command line tool where I could convert an AVI file into a number of images and saving it as one .png file.
??
I need this badly (or something better with a GUI).

We didn’t have a command-line tool for such operation on AVI files, as far as I recall. But you can use examples/images_videos/simple_video_editor.lpr to achieve this (load AVI, save image@counter(1).png).

We did have a command-line tool to make atlases, this was replaced by sprite sheet editor. Which is only GUI now, not command-line.

So:

  1. To convert AVI to a series of images:

    • Use https://ffmpeg.org/ on the command-line. Something like this should work:

      ffmpeg -i my.avi -y -qscale 1 -f image2 image%d.png
      
    • Or use examples/images_videos/simple_video_editor.lpr. Load my.avi, save image@counter(1).png. But note that it expects to find ffmpeg on the command-line available on PATH anyway (we cannot open AVI otherwise), so you will need to install and set up https://ffmpeg.org/ anyway.

  2. To make atlas from a series of images, just use our sprite sheet editor. Load there a series of images, save as xxx.castle-sprite-sheet and it automatically creates an atlas from your images.

I tried this but got an exception after loading the avi?

Have you tried clicking Continue?

Exactly :slight_smile: It is normal to see 1 exception there. We allow numbering video frames from 0 or from 1, and for simplicity we handle it just by trying first to open frame 0 – and if it fails, we catch exception and try from 1.

( We don’t check for file existence, as it would not work on remote URLs. )

So it’s normal to see exception there in debugger. The application will continue without problems.

Hm, one would not expect that.
:slight_smile:
Ok, but now it only worked once; I had to find a range of png files in map temp.
But the second time it did not work anymore. (no png files in temp?)
And it would have been more comfortabler if the outmap map for png can be chosen first and the filenames were not that large.
Meanwhile I have found a little program “VirtualDub” that outputs png from a AVI file okay. It is not perfect but…
It would be cool if one could load a video file in CGE sprite editor and do the job. (hint).
:wink:

The temporary files you found were exactly that – temporary :slight_smile: We were not supposed to use them or look at them. The name is long to guarantee being unique (from other application and from same instance of the same application).

See my above post for 2 ways of doing that:

So you can use https://ffmpeg.org/ on command-line.

You choose the image name and location yourself.

So you can use GUI examples/images_videos/simple_video_editor.lpr. Press Ctrl + S after loading movie, and choose where to save it. You can save to a special filename with @counter(xxx) inside , following docs Texturing component - extensions | Castle Game Engine . So you can input in the dialog box and save to image@counter(1).png, and it will save a sequence of PNG files.

Again, in this way, you choose the image name and location yourself.