Simple utility for blending series of TGA shots into PNG images.

  • 3 heads
  • 2 releases
  • git clone https://klva.cz/src/tools/tga-merge.git
  • Updated download link. 56576df, 18 Jun 2020
    sample/
    LICENSE.md
    README.md
    tga-merge.go

    TGA Merge

    This tool lets you combine sequence of TGA images into less PNG images by blending specified number of surrounding input frames into one output frame.

    Specific use case is generating smooth video files from Quake 3 and derived games using cl_avidemo, which tells the game how many frames per second should be exported into TGA files. While it's true humans perceive about 30 frames per second as continuous movement, it's more complicated when it comes to video games or rendered scenes. Unlike a video camera, game without built-in blur support produces sequence of perfectly sharp images. So, when a camera recorded object is moving, you might notice it gets fuzzy (in direction of movement) when pausing the video. This is why we perceive the movement as smooth, while an old game running at 30 FPS seems jerky; frames lacks transitions between them.

    To solve this issue, games are usually played at high framerates (over 100 FPS), which makes the missing transitions less noticeable. But, because it's impractical to deal with video files having over 100 frames per second (instead of standard 30), you might want to introduce scene blur on your own.

    We're gonna raise number of recorded frames per second, let's say 150 (little bit of experimenting needed, just make it a multiple of desired output framerate):

    cl_avidemo 150
    

    Game generates 150 TGA images for each second of the demo (usually it slows down because of limited hard drive speed).

    Sample input frames

    This is just a small area of screen, for clarity. Notice the bush movement between first and last frame.

    Now, we're gonna blend each 5 images into one like this:

    frame1    100% opaque
    frame2     80% opaque
    frame3     60% opaque
    frame4     40% opaque
    frame5     20% opaque
    

    Right now, we have one blurry frame instead of 5 sharp.

    Merged frame

    As you can see, objects which moved are now fuzzy. At this point, you can concatenate all merged frames into a smooth video file!

    Usage

    See releases for download.

    TGA-Merge -i screenshots/shot*.tga -o merged/merged%04d.png -m 5 -b 2
    

    License

    Released under MIT license.