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

Gifs loop adding 1 frame per loop until the full video is played, then playing halts #940

Open
brendenhoffman opened this issue Sep 19, 2023 · 5 comments

Comments

@brendenhoffman
Copy link

Kind of a mouthful. There is two problems, the first being the gif doesn't play in full, it goes through multiple loops adding a new frame each loop. This is only an issue the first time the gif is played so long as a new gif does not get selected (switching to a jpg and back to the gif plays the full gif once). Second, after it has finally finished playing a full gif, it stops.

So how do we cache the full gif, then loop the gif?

Here is an example of the issue, sorry its made pretty long by the first issue:

2023-09-19_072943.mov

This is my config. It is an issue with either chafa or the show-sixel script from #419. I am using Wayland and foot terminal.

fileviewer *.bmp,*.jpg,*.jpeg,*.png,*.xpm,*.gif
"	\ show-sixel %c %pw %ph %pd
	\ chafa -f sixel -s %pwx%ph %c:p %pd %N 2>/dev/null
@xaizek
Copy link
Member

xaizek commented Sep 19, 2023

I'm quite surprised GIF is played with Sixel at all. I never thought of trying it, but I think I know what seems to be going on. chafa or img2sixel are adding a frame with a delay, every time that happens Vifm does a redraw playing the whole (still partial) buffer with no delays, at the end buffer stops changing and there are no redraws.

%pd preview is just a bunch of terminal-specific escape codes for Vifm and it simple passes it to a terminal. I don't really see a way to fix this without embedding image parsing and animation support into Vifm which I don't want to do.

I think ueberzugpp works on Wayland and you can try this plugin (see how to install and comments in init.lua) to get proper handling of GIFs and likely better performance.

@brendenhoffman
Copy link
Author

Gifs definitely work with sixel. Chafa in the terminal works perfectly, just not in vifm. Before I jump back into the Ueberzug rabbit hole, there is no way we can pause drawing to vifm until the buffer is complete? I'm expecting a blank preview or still thumbnail while it builds.

@xaizek
Copy link
Member

xaizek commented Sep 20, 2023

Chafa in the terminal works perfectly, just not in vifm.

In a shell Chafa works synchronously and communicates with the terminal directly. In Vifm it's run detached from the terminal and asynchronously. Different environments, different expectations of the result.

Before I jump back into the Ueberzug rabbit hole, there is no way we can pause drawing to vifm until the buffer is complete?

%pu disables caching and waiting for result asynchronously, but you would still have to wait for GIF to play without being visible first unless there is a setting to have no delay in Chafa.

@brendenhoffman
Copy link
Author

%pu would be acceptable for me, if it didn't lock up the program until the gif has processed and since the cache is disabled it no longer plays immediately if you were to switch to a still image then back to a gif.

@xaizek
Copy link
Member

xaizek commented Sep 20, 2023

%pu would be acceptable for me, if it didn't lock up the program until the gif has processed

There is no flag that disables drawing of partial result. %pu is the closest thing to it.

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

No branches or pull requests

2 participants