Page 1 of 1

Rotation metadata

Posted: Thu Apr 22, 2021 1:54 am
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:

Re: Rotation metadata

Posted: Thu Apr 22, 2021 6:26 am
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.

Re: Rotation metadata

Posted: Thu Apr 22, 2021 12:11 pm
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?

Re: Rotation metadata

Posted: Thu Apr 22, 2021 2:34 pm
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.

Re: Rotation metadata

Posted: Thu Apr 22, 2021 6:32 pm
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

Re: Rotation metadata

Posted: Thu Apr 22, 2021 11:55 pm
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.

Re: Rotation metadata

Posted: Mon May 03, 2021 10:50 am
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!

Re: Rotation metadata

Posted: Mon May 03, 2021 1:44 pm
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.