Skip to content

Joao-1/anime-gif-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Anime Gif Generator

The Anime GIF Generator is a tool that analyses animations and creates GIFs from transitions between scenes. The AGG analyses every frame of the provided animation and compares the last and current frames to determine if a transition has occurred. If a transition is detected, a new GIF is created using all frames that make up that scene.

This is the Rust version of my old Python code without too many differences, but it does have some issues listed below:

Issues

Time

The process of opening a video, analysing the frames to find for a transition and creating a GIF works almost perfectly (I'll talk about other problems later). However, processing the frame data takes ~9 seconds at high quality and ~1 second at low quality. This is terrible and takes a lot of time to create a small number of GIFs. To illustrate this, I set up the application to create GIFs from episode 1 of "K-on!!" and it took about 12 hours to go through the whole video and create all the GIFs of the episode.

I don't know why this happens in Rust but not in Python. Maybe the crate I'm using isn't optimised, or my logic needs to be different in Rust.

With the compression of the GIF to a smaller width and height, the creation of the GIFs increased significantly. It took ~20 minutes to analyze and create all the GIFs from the same episode.

False positive

Another issue identified is the high number of false positives when detecting scene transitions, particularly on anime with action scenes. The analysis system may generate a false positive if there are spells, high velocity, or excessive lighting present. This is because it analyses changes in pixels and provides a percentage of the difference. If the percentage exceeds a default value, the system will identify it as a new transition, even if it is not.

The number of false positives is low for slice of life animes such as K-on, Non Non Biyori, and Yure Camp. However, animes with many action scenes, such as Kimetsu No Yaiba, Sousou No Frieren, and Jujutsu Kaisen, have many false positive GIFs.

FPS

The most awkward and annoying issue is the low FPS of the GIFs, which makes them unusable. It is possible that OpenCV is the cause, but I am unsure how to improve this. See the example below (if the GIF does not run, please reload the page.): gif1706690361 Simply unusable.

Tasks

  • Add tests
  • Compress generated GIFs to reduce their file size. Some GIFs can be over 100Mb, making them unusable
  • Make it useable as a CLI tool
  • Set the GIF to start again after each time it is played
  • Set all the details of the GIF in the metadata (such as the start and end frame, time, name, episode, etc.)
  • Make it multithreaded (maybe)

About

A simple GIF generator for anime episodes

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages