Fix video mirroring issue#2475
Merged
Merged
Conversation
Contributor
|
All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-2475-all-demos |
freddyaboulton
commented
Oct 17, 2022
Collaborator
Author
There was a problem hiding this comment.
Consolidating the two FFmpeg calls into one.
1aa3ba6 to
2013aa9
Compare
Member
|
Code looks good but I could never reproduce this, so will leave for someone else to test. It works fine for me, but it always did. |
abidlabs
reviewed
Oct 18, 2022
| uploaded_format = file_name.suffix.replace(".", "") | ||
|
|
||
| modify_format = self.format is not None and uploaded_format != self.format | ||
| flip = self.source == "webcam" and self.mirror_webcam is True |
Member
There was a problem hiding this comment.
Nit:
Suggested change
| flip = self.source == "webcam" and self.mirror_webcam is True | |
| flip = self.source == "webcam" and self.mirror_webcam |
abidlabs
reviewed
Oct 18, 2022
| flip_suffix = "_flip" if flip else "" | ||
| output_file_name = str( | ||
| file_name.with_name( | ||
| f"{file_name.name.replace(file_name.suffix, '')}{flip_suffix}{format}" |
Member
There was a problem hiding this comment.
Would this work?
Suggested change
| f"{file_name.name.replace(file_name.suffix, '')}{flip_suffix}{format}" | |
| f"{file_name.stem}{flip_suffix}{format}" |
Member
|
Looks awesome @freddyaboulton! |
abidlabs
approved these changes
Oct 18, 2022
Collaborator
Author
|
Thanks for the review all! |
This file contains hidden or 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
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.
Description
Fixes #1804
There are two problems that I found:
mirror_webcamis always set to True in the config. Regardless of whether the source is a webcam. This is the problem causing Video mirroring #1804.formatis specified (not None), the video was not flipped in the backend. There isn't an issue about this filed I think.Issue 1 Test code
Issue 2 Test Code
Checklist:
A note about the CHANGELOG
Hello 👋 and thank you for contributing to Gradio!
All pull requests must update the change log located in CHANGELOG.md, unless the pull request is labeled with the "no-changelog-update" label.
Please add a brief summary of the change to the Upcoming Release > Full Changelog section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by
[@myusername](link-to-your-github-profile)in[PR 11111](https://github.com/gradio-app/gradio/pull/11111)".If you would like to elaborate on your change further, feel free to include a longer explanation in the other sections.
If you would like an image/gif/video showcasing your feature, it may be best to edit the CHANGELOG file using the
GitHub web UI since that lets you upload files directly via drag-and-drop.