Discussion:
[KPhotoAlbum] Would like an option to not extract multiple frames for video thumbnails
Robert Krawitz
2017-06-19 01:02:16 UTC
Permalink
The video thumbnail process is unpleasantly slow and CPU-intensive;
I'd prefer to simply be able to extract the first frame of the video
and use that. But before I hare off and do that, I'd like to get
other thoughts on this and possible alternatives.
--
Robert Krawitz <***@alum.mit.edu>

*** MIT Engineers A Proud Tradition http://mitathletics.com ***
Member of the League for Programming Freedom -- http://ProgFree.org
Project lead for Gutenprint -- http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
Johannes Zarl-Zierl
2017-06-26 15:59:38 UTC
Permalink
Hi Robert,
Post by Robert Krawitz
The video thumbnail process is unpleasantly slow and CPU-intensive;
I'd prefer to simply be able to extract the first frame of the video
and use that. But before I hare off and do that, I'd like to get
other thoughts on this and possible alternatives.
Sorry for not coming back to you sooner (and I haven't forgotten about your
patches, either). I wanted to take the time to think about the issue and
answer afterwards. As I don't see that happening for the foreseeable future,
here are my ad-hoc thoughts:

Thought A:
I just saw that we call ffmpeg with the "-ss" parameter after "-i". This means
that we do an accurate seek[1]. Changing this could possibly improve
performance.

Thought B:
If we make this configurable, my gut instinct for the UI would be:
Let the user decide how many frames per minute to extract.

The downside to this is that I'm not sure if we always know the video duration
when we start the thumbnail extraction. So a (configurable but) fixed number
of frames is probably better from the implementation point of view.

Thought C:
Changing the number of video thumbnails to 1 means that the "select the next
thumbnail" won't work anymore.

Thought D:
With a low number of video thumbnails, choosing a good offset becomes ever
more important. Taking e.g. the first/last frame of a video is almost
guaranteed to give you a bad preview image.


Johannes



[1] https://trac.ffmpeg.org/wiki/Seeking
Robert Krawitz
2017-06-26 16:13:39 UTC
Permalink
Post by Johannes Zarl-Zierl
Hi Robert,
Post by Robert Krawitz
The video thumbnail process is unpleasantly slow and CPU-intensive;
I'd prefer to simply be able to extract the first frame of the video
and use that. But before I hare off and do that, I'd like to get
other thoughts on this and possible alternatives.
I just saw that we call ffmpeg with the "-ss" parameter after "-i". This means that we do an accurate seek[1]. Changing this could possibly improve performance.
My own experience has been that it can make a significant difference.
Post by Johannes Zarl-Zierl
Let the user decide how many frames per minute to extract.
The downside to this is that I'm not sure if we always know the video duration when we start the thumbnail extraction. So a (configurable but) fixed number of frames is probably better from the implementation point of view.
Depends on the video type. For MP4's and such it can be determined
easily; for streaming containers (such as TS) it might not.

Another option would be X frames per limit, with an upper limit of Y
total. This obviously will result in the entire video not being
thumbnailed, but I'm not sure how necessary that is.
Post by Johannes Zarl-Zierl
Changing the number of video thumbnails to 1 means that the "select the next thumbnail" won't work anymore.
Right, which I don't care about.
Post by Johannes Zarl-Zierl
With a low number of video thumbnails, choosing a good offset becomes ever more important. Taking e.g. the first/last frame of a video is almost guaranteed to give you a bad preview image.
Depends on the video. In my case I have a lot fewer videos than
stills (by close to 3 orders of magnitude) and even the first frame
will usually tell me enough. People who add titles to their videos
might typically start that on the first frame, making it easier.

As usual, different people have different needs here, which is why I
think it should be configurable. In my case, I don't normally shoot
many videos, but when I do, it greatly slows down the thumbnailing
process (and my entire system, since ffmpeg is using lots of threads).
--
Robert Krawitz <***@alum.mit.edu>

*** MIT Engineers A Proud Tradition http://mitathletics.com ***
Member of the League for Programming Freedom -- http://ProgFree.org
Project lead for Gutenprint -- http://gimp-print.sourceforge.net

"Linux doesn't dictate how I work, I dictate how Linux works."
--Eric Crampton
Loading...