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

Videos recorded in portrait gets snapshots distorted for rotation metadata as '-90' #509

Closed
Hagfjall opened this issue Mar 30, 2024 · 0 comments · Fixed by #510
Closed

Comments

@Hagfjall
Copy link
Contributor

Movies I record on Samsung Galaxy S23 in portrait mode have this metadata (only showing related data):

$ ffprobe -print_format json -loglevel error  -show_format -sexagesimal -show_streams ./20240330_072509.mp4 | jq '.streams[] | {coded_width, coded_height, side_data_list}'
{
  "coded_width": 1280,
  "coded_height": 720,
  "side_data_list": [
    {
      "side_data_type": "Display Matrix",
      "displaymatrix": "\n00000000:            0       65536           0\n00000001:       -65536           0           0\n00000002:            0           0  1073741824\n",
      "rotation": -90
    }
  ]
}

Note the rotation is -90.

When I run

public static async Task<bool> SnapshotAsync(string input, string output, Size? size = null, TimeSpan? captureTime = null, int? streamIndex = null, int inputFileIndex = 0)
with only width as Size (to keep aspect ratio) the result gets distorted.
Reason is most likely due only checking the positive numbers of rotation here:
if (source.PrimaryVideoStream.Rotation == 90 || source.PrimaryVideoStream.Rotation == 180)

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

Successfully merging a pull request may close this issue.

1 participant