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

Please add option to ignore rotation info in metadata #1914

Open
4 tasks done
pentool opened this issue Mar 3, 2024 · 4 comments
Open
4 tasks done

Please add option to ignore rotation info in metadata #1914

pentool opened this issue Mar 3, 2024 · 4 comments

Comments

@pentool
Copy link

pentool commented Mar 3, 2024

The fewer issues I have to read, the more new features I will have time to implement, so I ask that you please try these things first

Description

Some of the footage in my action cam was created while the camera was up side down. When you rotate the camera 180 degrees you can select this orientation to be the "correct" orientation so you will see the footage correctly (right side up) both in the camera's display and in any video player.

Such footage has a rotation info in the metadata with the value of -180, eg:

side_data_list: [ { side_data_type: 'Display Matrix', displaymatrix: '\n00000000: -65536 0 0\n00000001: 0 -65536 0\n00000002: 125829120 70778880 1073741824\n', rotation: -180, }, ],

So I have two footage. One is shot normally (Footage A), and the other was shot with the camera inverted (Footage B) but marked in the camera as "correct orientation". When you view the footage which was shot with the camera up side dow in a video player, it plays back the footage correctly (right side up). So it is not inverted. When you view the footage in LosslessCut, it also plays back correctly (right side up). So far so good.

However, when you merge Footage A (shot with the camera right side up) and Footage B (shot with the the camera up side down), the merged footage will play back Footage A part right side up, and Footage B part up side down.

Since all individual footage plays back right side up, it is difficult to tell which footage was actually shot with the camera being up side down, unless you check the metadata of every footage and see if the rotation value of -180 is present.

If there were a setting to ignore rotation metadata when merging mixed footage, that would help a lot and everything would be quick and easy. If you only have about 5 or so videos it's ok, but when there are more then 100, that's gonna be a chore and a headache to fix.

Thank you.

@mifi
Copy link
Owner

mifi commented Mar 4, 2024

Not sure what you want to do here. You want to merge up-side-down footage with non-upside-down footage? that is not possible to do correctly because it's not possible for the rotation metadata to change over the course of a single video. Or do you want to take a folder of 100 videos and just remove all the rotation metadata from all the videos to make them show in their original raw recorded orientation? if so, I think it can be easily achieved with a bash command:

for file in *.mp4; do ffmpeg -i "$file" -c copy -metadata:s:v:0 rotate=0 "$file"-out.mp4; done

@pentool
Copy link
Author

pentool commented Mar 6, 2024

Thank you, I will look into trying this method. For now I just ended up chaining the segments together in DaVinci.

@pentool
Copy link
Author

pentool commented Mar 7, 2024

I have concluded that sadly, it is not possible to invert a video just by setting the 'rotation' flag to zero and concatenate/merge it with a video that was filmed right side up (aka normal). It seems that flag only exist to indicate to players or devices that support that flag how to play back the video. So televisions or players (eg VLC, QuickTime Player, etc) can play back the up side down video correctly.

I have tried setting the 'rotation' flag to zero in the metadata. I have tried rotating the video in LosslessCut and export it. Regardless how I slice it, when I merge a regular video (where the camera was right side up) with a video where the camera was up side down, when you merge/concatenate them they will end up just like that. One being right side up and the other is being up side down.

It seems the only way out of this is recompressing the up side down video either in an app like HandBrake or concatenate the two videos in an editing software.

@mifi
Copy link
Owner

mifi commented Mar 9, 2024

That is correct. I believe the FAQ mentions this problem.

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

No branches or pull requests

2 participants