-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
feat(local): support both time and percent for video thumbnail #7802
Conversation
The percentage determines the point in the video (as a percentage of the total duration) at which the thumbnail will be generated.
Could you please consider implementing a feature that allows configuration using both frame numbers and percentages? For example, it would be useful to be able to enter a plain number for frames and append a Additionally, given that the integer setting value is ultimately converted to a float64, it would be beneficial to directly accept a float64 in the setting. This would allow users to have more precise control with a single line change of code. |
I think it may be easier to use if the number represents the time in seconds rather than the frame number. Consider the following config option: "video_thumb_pos": "Video thumbnail position",
"video_thumb_pos-tips": "The position of the video thumbnail. If the value is a number (integer or floating point), it represents the time in seconds. If the value ends with '%', it represents the percentage of the video duration." |
This looks great to me. If floating-point numbers are supported, I believe this would meet the needs of most users. |
I implemented this feature. If the time in the configuration is longer than the video duration, the seek point will be set to the end of the video. The flag |
There are two segments of code that are duplicated, and it's unnecessary to parse every time when getting thumbnail. You can add two private field to struct like thumbTokenBucket: a value storages the float number, and a flag determines whether the value represents a percentage or time. Lines 36 to 37 in 189c80d
By the way, I suggest you provide some test docker images. Refer to the documentation in the PR that has not been merged yet, and bring the ffmpeg build argument: https://deploy-preview-397--alist-doc.netlify.app/guide/install/docker.html#compile-image docker build -t xhofe/alist:latest-ffmpeg --build-arg INSTALL_FFMPEG=true . It seems like xhofe has already merged this PR, maybe you can fire a new one or let me write it. |
The percentage determines the point in the video (as a percentage of the total duration) at which the thumbnail will be generated.
The old implementation selects the 10th frame of the video as its thumbnail, which is typically near the beginning. This approach is not effective for distinguishing videos that have similar starting frames. Using a percentage parameter allows user control over the thumbnail generation point. Users can achieve similar behavior to the old implementation by setting the percentage to 0.