Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Animation Locked Duration #10

Open
Rulonkobalski opened this issue Oct 5, 2020 · 8 comments
Open

Animation Locked Duration #10

Rulonkobalski opened this issue Oct 5, 2020 · 8 comments

Comments

@Rulonkobalski
Copy link

This is the Trouble that have with the plug-in:

When I select a file the animation locks to 1 second, doesn't matter if the file is larger or shorter than that.
image

The weird thing is I used the tool before and let me import animations correctly, this issue happened just now and I don't know why. I didn't make changes to Krita or ffmpeg.

I have installed version 4.2.8 of Krita. And my OS is Windows 10.

@KnowZero
Copy link

KnowZero commented Oct 6, 2020

Is it a gif? There is an issue with the gif frame calculations and you get stuck with wrong frame counts like 1 second.

Try my fix:

#8

@scottpetrovic
Copy link
Owner

Is it a gif? There is an issue with the gif frame calculations and you get stuck with wrong frame counts like 1 second.

Try my fix:

#8

Thanks. I can take a look at this GIF fix and try to test it out and include it in the plugin. I have been MIA for a bit on this plugin. There were some various ideas of not using ffmpeg going forward for the Krita application. In the Krita application, we are wanting to have something like FFMPEG built-in so people don't have to download and configure it separately. It causes a lot of headaches for a lot of people.

@Rulonkobalski - if the GIF fix doesn't work, could you attach the GIF to the ticket. That helps to be able to test it out and see what is going on to make sure it works with whatever we do.

@KnowZero
Copy link

@scottpetrovic - After some thought there might be an issue with the -count_frames method, I mostly had small files to test with so it worked fine but I now tried a full sized video and it took a long time to load. Which a better solution would be first to check if its a gif, and only then do count_frames. Either through reading the ending format or more reliably to run ffprobe twice if it is a gif via the codec_name field.

As for including something into Krita, you mean including ffmpeg itself, make something from scratch, or forking parts of the ffmpeg code?

@scottpetrovic
Copy link
Owner

Ok. the -count_frames probably needs a bit more testing. I am pretty sure the script knows the file name since it needs to read it, so I am sure it could grab the file extension and use that to add the flag.

In terms of adding ffmpeg, the idea was to add a custom ffmpeg build directly in Krita. That is a separate project than this plugin, but would affect how this works potentially. There was talks about not using ffmpeg and using a different library for doing animation. I think the application will probably be sticking with ffmpeg and doing some modifications. Not exactly sure when that will happen though.

@KnowZero
Copy link

That would work if it is properly labeled, but sometimes things aren't always properly labeled.

For example, here I took a random gif on the internet and labeled it png. If you try to save it, it will be a png despite it being a gif.
test

That is why I said running ffprob twice is more reliable. For 99.99% using the file name is good enough, but just wanted to note that the files type doesn't always match the format.

As for the bundling, as long as it isn't being written from scratch as it'll take a lot of work away from other aspects that are needed.

Speaking of bundling, will this plugin ever get merged into Krita by default? Cause not everyone knows where to find it and being able to import gifs and videos should really be a basic feature. Or is the reliance on an external library like ffmpeg the blocking point?

@scottpetrovic
Copy link
Owner

Until FFMpeg is bundled with Krita by default, I don't think this plugin could be pre-installed.

If you look through the "issues" on this plugin, most of the stem from people not being able to setup FFMpeg in general. It is a bit funky the way it is done now since you have to use environment variables for python to be able to access the executable.

I don't think any animation software has steps like Krita has with FFMpeg.

@KnowZero
Copy link

KnowZero commented Oct 15, 2020

Well, Krita does rely on ffmpeg anyways for exporting animations. And it should be possible to do a check if ffmpeg exists via "ffmpeg -version", if not try a few common paths via file exists, and if that fails than do a search. Or is there some permissions limitations outside?

Though I do agree that Krita should just bundle it.

Edit:
I started a windows 10 vm and tested to see if it would run it outside the ENV path and it worked.

import subprocess

print ( subprocess.check_output(['ffmpeg','-version'],shell=True,cwd="C:\\Users\\Test\\Downloads\\ffmpeg-4.3.1-2020-10-01-full_build\\bin\\") )

Appimg version also worked:

import subprocess

print( subprocess.check_output(['ffmpeg2','-version'],cwd="/home/test") )

Flatpak failed to load external but that version bundles ffmpeg anyways

@Rulonkobalski
Copy link
Author

The FIx of @KnowZero worked for me.

@scottpetrovic The file I used was indeed a Gif, here's the file:
Pokemon Loli

Found the Gif from this tweet https://twitter.com/KkiArts/status/1310611040422379520
Twitter doen't let you download directly a gif or video, so I used this site to convert the file to something downloadable https://ezgif.com/video-to-gif
The website has tools to modify some specs of the video/gif you want to downloand, One of them is the possibility to chance the frame rate. By default is 10, don't quite sure but I chanced it to 20.

Come to think of it, maybe the encoding of the site was the problem but I'm not really sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants