Rotation metadata

Questions and answers on how to get the most out of FFAStrans
Post Reply
GammaScorpii
Posts: 13
Joined: Fri Mar 01, 2019 12:11 pm

Rotation metadata

Post by GammaScorpii »

Some files from my Sony A7s III have rotation metadata when shot upside down or sideways - similar to a lot of phone footage I imagine. I use ffastrans to make proxies for work, but ffastrans is not applying this rotation when exported.

The problem is Premiere applies this on import, with no way of turning it off, and this leads to proxies not matching the raw footage...

However with testing I realise that natively ffmpeg applies this rotation when exporting to a format that doesn't support the flag (unless the flag is set to 90° instead of 180° in which case I get an error which is annoying).

FFastrans on the other hand completely ignores this it seems? Is there a way to apply the rotation to the export? I realise there is a flip effect (which only flips horizontally or vertically) and %i_rotation% variable but what should it be looking for? This is what mediainfo says in the original file:

Rotation : 90°


Checking the logs of my conditional nodes I'm confused why it's saying the rotation is 0:

Code: Select all

1st evaluation of \"%i_rotation% = 90\" is \"0 = 90\""}},
But earlier I see references to rotation:

Code: Select all

"Rotation":"90.000","Rotation_String":"90°"

Code: Select all

"Megapixels":8.3,"AvgBitrate":"212 Mbps","Rotation":90}]},

Code: Select all

displaymatrix: rotation of -90.00 degrees\r\n    Stream #0:1(und): Audio:
emcodem
Posts: 1771
Joined: Wed Sep 19, 2018 8:11 am

Re: Rotation metadata

Post by emcodem »

Hey GammaScorpii, good to read from you again!

It would be good to see your workflow, i suspect some stuff you are using resets the rotation flag, but which one could it be? :D
If you dont want to share your wf, what you could try is to store the original i_rotation in a user variable using populate vars node. Later in the wf, you can use your user_var instead of the current one.
emcodem, wrapping since 2009 you got the rhyme?
GammaScorpii
Posts: 13
Joined: Fri Mar 01, 2019 12:11 pm

Re: Rotation metadata

Post by GammaScorpii »

I've attached the workflow which has the rotation part bypassed for now. The image shows which line the rotated footage will go down.

I thought that may be the case which is why I tried moving it before all the other nodes, unless its the A/V Decoder which is removing the rotation?
Attachments
Capture.JPG
Capture.JPG (232.22 KiB) Viewed 5588 times
Auto_Proxy.json
(49.87 KiB) Downloaded 329 times
emcodem
Posts: 1771
Joined: Wed Sep 19, 2018 8:11 am

Re: Rotation metadata

Post by emcodem »

Yeah looks like the A/V decoder resets the flag. Interesting situation that @admin might want to look at.

I guess meanwhile you need to store the original rotation flag in a user variable.
emcodem, wrapping since 2009 you got the rhyme?
admin
Site Admin
Posts: 1685
Joined: Sat Feb 08, 2014 10:39 pm

Re: Rotation metadata

Post by admin »

Hi GammaScorpii,

The only case where FFAStrans cares about rotation is when converting without using the "A/V Decoder"-decoder which correctly resets this setting. This we need to address. But when converting, if the/a rotation flag is found, FFAStrans will try to convert the image the "right way". So if you have rotated 90° you should have a corrected encoding and the rotation flag is naturally not set.
So, what's lacking in FFAStrans is the option to convert without applying the rotation correction on encoding but simply forward the rotation flag. This should be addressed also.... in one way or another. So thanks for notifying about this.

Also, it would be nice if you could send me the complete log for one of the jobs where rotation was not detected by FFAStrans. Maybe Sony has put the rotation flag somewhere else where FFAStrans does not look :roll:

-steinar
GammaScorpii
Posts: 13
Joined: Fri Mar 01, 2019 12:11 pm

Re: Rotation metadata

Post by GammaScorpii »

So could it just be placed before the A/V Decoder? I assume I need to use the A/V Decoder to do all the other stuff right?

I've attached the log below

Either way it should work if the output does not have the rotation flag, but was rotated, or was not rotated and the rotation flag was passed on. I think both would work for my case.
Attachments
20210423-0920-5727-4eda-d6e054c2fb56.zip
(13.36 KiB) Downloaded 301 times
GammaScorpii
Posts: 13
Joined: Fri Mar 01, 2019 12:11 pm

Re: Rotation metadata

Post by GammaScorpii »

I guess meanwhile you need to store the original rotation flag in a user variable.
Could you explain how one does this?

Or is there something else I can do to temporarily fix this problem?

Thanks!
emcodem
Posts: 1771
Joined: Wed Sep 19, 2018 8:11 am

Re: Rotation metadata

Post by emcodem »

Hi,

sure, so before the A/V decoder, you insert a populate variables node. Create one user variable named s_original_rotate.
In the populate node, on the left, select the s_original_rotate var and on the right do input %i_rotation%.

This way, the variable s_original_rotate will always contain the value that i_rotation was before the A/V decoder.
emcodem, wrapping since 2009 you got the rhyme?
Post Reply