-
Notifications
You must be signed in to change notification settings - Fork 592
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
Fix short videos thumbnail generation #765
Open
glubsy
wants to merge
14
commits into
lrsjng:master
Choose a base branch
from
glubsy:PR_fix_short_video_thumbs
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 8280aff fixes #695. |
Keep the default assignment in case there are more types.
* Use ffprobe/avprobe to get the total duration of each video file first. * Compute a desired optimal timestamp of 15% of the total duration to seek for and get the thumbnail from. * Fix capture of ffmpeg's output (from stderr) in exec_cmdv() by using an optional redirection to stdout. * Capture of sub-process output is optional (possible slight performance gain).
Overwrite already existing thumbnails if the source file's mtime is more recent
* Return stdout as expected from ffprobe to get duration. * Avoid throwing an exception in favour of a default value for potential malformed total duration got from ffprobe.
* Conflict with the newly added boolean arguments if they are explicitely passed by the caller. * cmdv has to be an array.
* Allows users to specify which percentage of the total video duration to seek in instead of hardcoding 15%. * Now defaults to 50%.
* This fixes a denial-of-service exploit that would allow the client to generate an infinite number of thumbnails and fill up the storage completely. Since the client had control over the requested thumbnail sizes, it could make arbitrary requests for thumbnails, and every time the backend did not find an already generated thumbnail with the specified sizes, it would happily generate a new one. * Remove the ability of the client to decide thumbnail dimensions and only let the back-end do this by reading the configuration. * Limit the number of generated thumbnails per file to only one, with "landscape" dimensions (4/3). * Use CSS "object-fit" property to adjust displaying of landscape thumbnails into squares. Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
glubsy
force-pushed
the
PR_fix_short_video_thumbs
branch
from
January 24, 2021 17:09
204838e
to
8ac7f6a
Compare
* This fixes a denial-of-service exploit that would allow the client to generate an infinite number of thumbnails and fill up the storage completely. Since the client had control over the requested thumbnail sizes, it could make arbitrary requests for thumbnails, and every time the backend did not find an already generated thumbnail with the specified sizes, it would happily generate a new one. * Remove the ability of the client to decide thumbnail dimensions and only let the back-end do this by reading the configuration. * Limit the number of generated thumbnails per file to only one, with "landscape" dimensions (4/3). * Use CSS "object-fit" property to adjust displaying of landscape thumbnails into squares. Ref: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
* We now use only one thumbnail file src for both square and rational thumbnails so remove superfluous requests. * Set the same src for both square and landscape dom classes.
Only compute thumbnail configured dimensions on thumbnail API requests.
@Hi-ImKyle I have enabled issues just now thanks for the heads up. Yes master branch includes all my changes. No idea what your issue is, does this happen with the original version of h5ai? What server are you using? What php version? What do you see in the developer console in the web browser? |
I'll create an issue on your fork instead of polluting this one~ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes #763, fixes #565, fixes #754, fixes #436, fixes #695.