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

[chore] Thumbnail only first frame of animated media #3448

Merged
merged 1 commit into from
Oct 18, 2024

Conversation

tsmethurst
Copy link
Contributor

Description

If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.

If this is a documentation change, please briefly describe what you've changed and why.

Updates our ffmpeg call to just take the first frame and not use the thumbnail filter, which was giving unexpected results for thumbnails of short media.

We could probably do some more nuanced logic here (check the first 1% of frames if media is longer than x amount of time) but I don't think it's that necessary right now.

Closes #3447

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have not leveraged AI to create the proposed changes.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@Ryuno-Ki
Copy link

I'm curious: If the animated started black, would it pick those?

There's a filter in regular ffmpeg: https://scribe.rip/@georgechmr/skipping-black-frame-when-generating-video-thumbnail-with-ffmpeg-9e26bf2f67e3

@tsmethurst
Copy link
Contributor Author

We could use something like that black filter in future maybe, but I don't think it's urgent right now. We also have to consider processing + memory costs when doing that kind of analysis, so something to benchmark a little bit (even anecdotally).

@tsmethurst tsmethurst merged commit 602c858 into main Oct 18, 2024
3 checks passed
@tsmethurst tsmethurst deleted the thumbnail_first_frame branch October 18, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] GIFs with reduced motion use the second frame, not the first
2 participants