Skip to content

Commit

Permalink
Allow negative MP4 rotations
Browse files Browse the repository at this point in the history
  • Loading branch information
drewnoakes committed Apr 16, 2021
1 parent 8430a31 commit bd41996
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ static void SetRotation(QuickTimeTrackHeaderDirectory directory)
var x = matrix[1] + matrix[4];
var y = matrix[0] + matrix[3];
var theta = Math.Atan2(x, y);
var degree = ((180 / Math.PI) * theta) - 45;
if (degree < 0)
degree += 360;
var degree = RadiansToDegrees(theta) - 45;

directory.Set(QuickTimeTrackHeaderDirectory.TagRotation, degree);

static double RadiansToDegrees(double radians) => (180 / Math.PI) * radians;
}
}

Expand Down

0 comments on commit bd41996

Please sign in to comment.