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

Unloadable image detection is slow with Imlib2 ≥ 1.6 #505

Closed
zotho opened this issue Jan 28, 2020 · 13 comments
Closed

Unloadable image detection is slow with Imlib2 ≥ 1.6 #505

zotho opened this issue Jan 28, 2020 · 13 comments

Comments

@zotho
Copy link

zotho commented Jan 28, 2020

When I run feh Folder_name and iterate over the images, feh is stuck on large .mp4 files. It logs:

feh WARNING: *.mp4 - No Imlib2 loader for that file format
...

And feh may just not respond to any commands.
Is it possible to add command line arguments:

  • list of extensions that can be opened
  • list of extensions that can't be opened
  • file size limit

All optional

@derf
Copy link
Owner

derf commented Mar 29, 2020

It's possible, but I'd rather not re-implement functionality already provided by other tools. Do you see a case where a variation on feh $(find Folder_name -not -name '*.mp4') wouldn't work?

@derf derf added the feature label Mar 29, 2020
@zotho
Copy link
Author

zotho commented Mar 29, 2020

I think with find this will work fine

@derf
Copy link
Owner

derf commented Mar 29, 2020

Glad to hear. Closing this issue as wontfix for now.

@mallniya
Copy link

mallniya commented May 7, 2020

Hello, it seems that I'm not the only one bothered by this issue (#520 another example).
Generic unix tools work (as they always do), but this is quite cumbersome to print, especially if one has many other formats in target directory. It's finite list of formats feh supports, so why just don't try to load files with unsupported format or at least has an option to?
Also there are 2 cases where unix tools are inapplicable: opening directory from UI and setting white-/blacklist through themes.
@derf, please reconsider this feature in one form or another.

@kpcee
Copy link

kpcee commented May 8, 2020

Nice to see that others also have problems with this behavior of feh. The workaround mentioned here is unfortunately absolutely useless for me. As soon as the path or filename contains spaces, the output of find doesn't work with feh or does anyone know how to put the output of find in quotes so that feh loads the paths correctly?

@Ferada
Copy link
Contributor

Ferada commented May 11, 2020

Nice to see that others also have problems with this behavior of feh. The workaround mentioned here is unfortunately absolutely useless for me. As soon as the path or filename contains spaces, the output of find doesn't work with feh or does anyone know how to put the output of find in quotes so that feh loads the paths correctly?

Not arguing either way, but find . -print0 | xargs -0 feh will deal with all paths.

@kpcee
Copy link

kpcee commented May 11, 2020

Thank you very much for this solution, it works for me too. I had spent over 2 hours on the internet to find a working solution the last days and didn't find one, but was close to it, only the -0 at xargs was missing.

I would suggest to extend the manual to include the info, so that others don't have to search for an own solution. Anyway, I am satisfied with it.

find . -type f -iregex ".*\.\(jpg\|jpeg|bmp|png|pnm|tiff|gif\)$" -size -30M -print0 | xargs -0 feh

This catch only supported formats and files smaller than 30 MB.

@kpcee
Copy link

kpcee commented May 11, 2020

One disadvantage of this method I noticed now. the processing of the paths is done in chunks. If the paths are long enough and there are enough images, only a part of all paths is passed to feh. If you end feh with q, feh starts immediately again with the next chunk until all chunks are passed to feh. You can see this behaviour already with less than 1000 images, if the paths are long enough.

@derf
Copy link
Owner

derf commented May 29, 2020

Apparently, Imlib2 1.6 (released in nov 2019) introduced major changes in its image loader. It has been reported on IRC that feh takes much longer to dismiss unloadable files as unloadable with Imlib 2 1.6 compared to 1.5.

So my previous assumption (feh doesn't get stuck on unloadable files for long when not using --magick-timeout) was wrong. I can reproduce the issue now, but hope that I can fix it by changing the way feh interacts with Imlib2. I'll update the title accordingly, as I assume that this caused the issue for you as well, @zotho.

@derf derf reopened this May 29, 2020
@derf derf changed the title Feature request: Add file extension whitelist and blacklist Unloadable image detection is slow with Imlib2 ≥ 1.6 May 29, 2020
@derf
Copy link
Owner

derf commented May 31, 2020

Judging from the Upstream Issue, it might be an Imlib2 regression and unrelated to feh. Let's see how it turns out and whether feh needs a workaround in the meantime.

@eepykate
Copy link

I have this issue and feh is borderline unusable when opening a dir that has mp4 files and cycling through them.

imlib2 v1.6.1, feh v3.3, ubuntu

In the meantime I'll hunt down and install an older imlib2 version, but it would be nice for it to be fixed, even if this isn't exactly your problem.

@derf
Copy link
Owner

derf commented Nov 30, 2020

You're right, I forgot about this issue. Thank you for reminding me!

It doesn't look like Imlib2 is making progress, so I'm making feh check whehter a file looks like an image before attempting to load it via Imlib2. The check is based on magic bytes, so it should be fairly reliable. It will be possible to override it using an environment variable.

@eepykate
Copy link

It doesn't look like Imlib2 is making progress

That's honestly a serious bummer - for people who want an older version, i got mine from debian's website (missing dep here), and it makes it so much more responsive.

Thank you for reminding me!

And thank you for making such a nice project.

@derf derf closed this as completed in 2d37cd9 Nov 30, 2020
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Dec 19, 2020
Sun, 06 Dec 2020 08:34:15 +0100  Daniel Friesel <derf+feh@finalrewind.org>

* Release v3.6.1
    * Fix excessive memory consumption when showing long-running slideshows
      with thousands to tens of thousands of images and feh has been compiled
      with exif=1 (see derf/feh#553)
    * Fix memory leak when showing long-running slideshows with relatively few
      images and feh has been compiled with exif=1 (ibid.)
    * Fix memory leak when reloading an image and feh has been compiled with
      exif=1
    * Fix memory leak in --draw-exif
    * Fix memory leak when reloading HTTP files with --no-conversion-cache

Mon, 30 Nov 2020 19:44:47 +0100  Daniel Friesel <derf+feh@finalrewind.org>
* Release v3.6
    * Add flip and rotate options to the menu
    * Improve unloadable image detection time (e.g. for large video files) by
      checking a file's header before passing it to Imlib2. For rarely used
      image formats, there is a very small chance that an image which could be
      loaded by feh 3.5 is reported as unloadable by feh 3.6 due to this
      change. Set FEH_SKIP_MAGIC=1 to bypass the header check in this case. See
      <https://phab.enlightenment.org/T8739> and
      <derf/feh#505> for details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants