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

Generate cover image #376

Merged
merged 7 commits into from
Mar 11, 2020
Merged

Conversation

WithoutPants
Copy link
Collaborator

@WithoutPants WithoutPants commented Feb 20, 2020

Resolves #9

Note: this change also moves the scan/generate/import/export operations from query to mutation, since these are mutating operations. This will impact external scripts using these operations.

Adds a new tab to the scene page - Operations. Within this tab, there are two buttons. One generates the cover image for the scene based on the current position of the scene player, the other generates the cover image using the default settings.

Note that a page refresh may be required to see the updated images after generation, due to caching.

@WithoutPants WithoutPants added the feature Pull requests that add a new feature label Feb 20, 2020
@bnkai
Copy link
Collaborator

bnkai commented Feb 20, 2020

Is this WIP?

First by changing the operations to mutation i get this Invariant Violation: Invariant Violation: 10 (see https://github.com/apollographql/invariant-packages) when i try to run any changed operation from the settings panel ( scan , autotag , generate)

Also you are using ( in generateImageAt) the generator from the previews task that was supposed to generate the previews and the webp for the wall view not the screenshots. This leads to this error when trying to "create a thumbnail"
ERRO[0084] ffmpeg error when running command </usr/bin/ffmpeg -v error -ss 272.40798 -y -i /edited/path/to/filename.webm -vframes 1 -q:v 1 -vf scale=640:-1 -f image2 /edited/mystash/meta/tmp/b33cb3c05a5ba5b017573a43fdb1e74e.webp>: [image2 @ 0x55c5e91be700] Could not get frame filename number 2 from pattern '/edited/mystash/meta/tmp/b33cb3c05a5ba5b017573a43fdb1e74e.webp'. Use '-frames:v 1' for a single image, or '-update' option, or use a pattern such as %03d within the filename.

which is because you are using image generate options (-f image2) that are not compatible with webp (g.ImageFilename).
The paths also are not the correct ones for the screenshot and the thumbnail generation is missing also...

The screenshots code should work like task_scan.go->makeScreenshots
take the outputpath of the screenshot image (normalPath in the makeScreenshots code ), thumbnail (thumbPath) and put it to the options.outputPath before calling the encoder. This changes the output file to jpg instead of the webp now and also works directly at the screenshots directory (we don't need / use an intermediate tmp dir for the screenshot,thumbnail generation)

Copy link
Collaborator

@bnkai bnkai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The screenshot / thumbnails generation seems to work fine.
A point to consider though. If the user wants to have a custom screenshot shouldn't this screenshot also update the cover in the DB ? Otherwise it will not be exportable. This also affects the consinstency of the cover image function.
If you make a new screenshot while there is a cover in the DB then the screenshot gets generated fine and all the images you see in the UI including the cover one are from that screenshot. The cover image is still in the DB but nowhere to be seen.
IMHO when the screenshot changes then the cover ( if it exists in the DB ) should be in sync with it.

@WithoutPants
Copy link
Collaborator Author

Yeah, you're right. The earlier version did that, but forgot to port that in during the rework.

@bnkai bnkai mentioned this pull request Mar 6, 2020
@WithoutPants
Copy link
Collaborator Author

Added setting image in the database and ported to 2.5 UI. Ready to review.

@WithoutPants WithoutPants requested a review from bnkai March 11, 2020 01:11
Copy link
Collaborator

@bnkai bnkai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests ok for me (default,custom,thumbnails,db) , both v2 and v2.5

@WithoutPants WithoutPants merged commit 3de6955 into stashapp:develop Mar 11, 2020
Tweeticoats pushed a commit to Tweeticoats/stash that referenced this pull request Feb 1, 2021
* Make mutating metadata ops mutation
* Implement scene generate screenshot
* Remove fetch policy on metadata mutations
* Port UI changes to v2.5
* Set generated image in database
@WithoutPants WithoutPants deleted the generate_cover branch February 4, 2021 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Pull requests that add a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated image / video regeneration
2 participants