Do videos have metadata for orientation?

Chat about just about anything else
Post Reply
User avatar
jimallyn
Level 18
Level 18
Posts: 8002
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Do videos have metadata for orientation?

Post by jimallyn » Thu May 10, 2018 8:13 pm

Is there something in videos that says which way is up? I recently videoed part of an event I attended, using my Samsung Galaxy S5 Android phone. I recorded in mp4 format. When I got home, I transferred the video to my computer and viewed it; everything looked fine. I posted it on Facebook, and it was upside down. So I deleted it from Facebook and played it on the phone. Sure enough, it was upside down. (Must not have noticed how I was holding the phone when I took it.) So, question number one: why did it play right side up on my Mint 17.3 box?

Next, I used Transmageddon to flip the upside down video right side up. I then posted that flipped version of the video on Facebook. And it displays upside down on Facebook, too! So, this brings us to question number two: is there some metadata or something in an mp4 file that controls the orientation the video plays in? Why would both the original version, which I apparently recorded with the phone upside down, and the Transmageddon inverted version BOTH play upside down on Facebook? And if there is something in metadata, how would I change it?
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

User avatar
trytip
Level 6
Level 6
Posts: 1418
Joined: Tue Jul 05, 2016 1:20 pm

Re: Do videos have metadata for orientation?

Post by trytip » Thu May 10, 2018 8:39 pm

i believe you needed to delete your facebook cookies or the file uploaded was on delay even if you deleted it, i'm sure it was stored in cache. (when you delete something in facebook comments, pictures, notes etc it's not gone but greyed out where only mods can see it)
https://addpipe.com/blog/mp4-rotation-m ... deo-files/

changing metadata can be done when you use "copy" instead of re-encoding

Code: Select all

ffmpeg -i input.mp4 -metadata:s:v rotate=180 -vcodec copy -acodec copy output.mp4
https://stackoverflow.com/questions/102 ... ion-in-mp4
Image

User avatar
GS3
Level 4
Level 4
Posts: 262
Joined: Fri Jan 06, 2017 7:51 am

Re: Do videos have metadata for orientation?

Post by GS3 » Fri May 11, 2018 2:49 am

This problem is similar to JPEG file rotation in that some programs will support the rotation flag and some will not. In JPEG I find it is sometimes better to do a real rotation and obviate any rotation flag problems.

Regarding MP4 video, the last two posts at https://superuser.com/questions/1307158/ seem to be the answer the OP is looking for.
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

User avatar
jimallyn
Level 18
Level 18
Posts: 8002
Joined: Thu Jun 05, 2014 7:34 pm
Location: Wenatchee, WA USA

Re: Do videos have metadata for orientation?

Post by jimallyn » Fri May 11, 2018 4:21 am

Thanks to both of you. I won't be able to try it for a day or so, but it sounds like I will be able to do it. In the future, I'll be more careful to hold the phone correctly when shooting pictures or videos.
Image

“If the government were coming for your TVs and cars, then you'd be upset. But, as it is, they're only coming for your sons.” - Daniel Berrigan

User avatar
GS3
Level 4
Level 4
Posts: 262
Joined: Fri Jan 06, 2017 7:51 am

Re: Do videos have metadata for orientation?

Post by GS3 » Fri May 11, 2018 4:32 am

jimallyn wrote:
Fri May 11, 2018 4:21 am
In the future, I'll be more careful to hold the phone correctly when shooting pictures or videos.
Learning to hold the phone correctly is very important. My wife just dropped her Samsung and cracked the screen. :)

I remember when she had an iPhone I had to deal with the video rotation issue but I do not remember having to do it lately with the Samsung. Still, we often process videos in order to reduce size, crop, etc. I hate it when someone sends me a 10 second, 15 MB video.

And people who shoot vertically in 16:9. There ought to be a law about that! :)
HP Compaq Elite 8300 CMT - Linux Mint 18.2 Sonya - Kernel 4.4.0-116-generic X64 - Cinnamon 3.4.4 - Nemo

Post Reply

Return to “Open chat”