-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Added ability to correct upload video with a rotation record in the metadata #2218
Conversation
If a video was loaded with a rotation record in the metadata and the 'Use cache' checkbox was enabled, incorrect sizes will be saved. |
@Marishka17 , what is the status of the PR? |
I left out one moment, that we don't have installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
frame = av.VideoFrame().from_ndarray( | ||
rotate_image( | ||
frame.to_ndarray(format='bgr24'), | ||
360 - int(container.streams.video[0].metadata.get('rotate')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of questions here:
- what the method returns: video_stream.metadata.get('rotate')?
- what is the difference between previous expression and container.streams.video[0].metadata.get('rotate')
- can container.streams.video[0].metadata.get('rotate') be always converted to int?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what the method returns: video_stream.metadata.get('rotate')?
string of rotation angle
what is the difference between previous expression and container.streams.video[0].metadata.get('rotate')
this is analogue
can container.streams.video[0].metadata.get('rotate') be always converted to int?
I checked for some values like 60, 90, 180, 270.. and in such cases - yes
@@ -177,6 +195,14 @@ def frame_sizes(self): | |||
container.seek(offset=next(iter(self.key_frames.values())), stream=video_stream) | |||
for packet in container.demux(video_stream): | |||
for frame in packet.decode(): | |||
if video_stream.metadata.get('rotate'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code duplication?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No
@@ -74,3 +75,16 @@ def av_scan_paths(*paths): | |||
res = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |||
if res.returncode: | |||
raise ValidationError(res.stdout) | |||
|
|||
def rotate_image(image, angle): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we support rotation which isn't multiply pi/2 by an integer? Is it a real case to rotate a frame by 30 degrees? Is it possible at all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Artificially (write the desired value in the metadata) you can create such a video.
Motivation and context
Ability to correct upload video with a rotation record in the metadata
How has this been tested?
Manual, tests
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.