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

fix: Snapshots from rotated videos should have correct width/height #510

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

Hagfjall
Copy link

@Hagfjall Hagfjall commented Mar 30, 2024

Some video-files have their metadata as -90 instead of 90. This PR handles correct aspect-ratio and rotation when taking snapshots.

Example:

$ 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.

The sample video provided in the PR is my own recording. A bit too big maybe? I couldn't find any command to set the metadata to -90 on existing video. Would be happy to get it working on already existing test-data to reduce size.

Fixes #509

Some video-files have their metadata as -90 instead of 90. This PR handles correct aspect-ratio and rotation when taking snapshots.

The sample video provided in the PR is my own recording. A bit too big maybe? I couldn't find any command to set the metadata to `-90` on existing video. Would be happy to get it working on already existing test-data to reduce size.

Fixes rosenbjerg#509
@codecov-commenter
Copy link

codecov-commenter commented Mar 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 71.24%. Comparing base (f8407bc) to head (fe4b79e).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #510      +/-   ##
==========================================
- Coverage   74.31%   71.24%   -3.08%     
==========================================
  Files         113      115       +2     
  Lines        2854     2914      +60     
  Branches        0      281     +281     
==========================================
- Hits         2121     2076      -45     
  Misses        733      733              
- Partials        0      105     +105     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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 this pull request may close these issues.

Videos recorded in portrait gets snapshots distorted for rotation metadata as '-90'
2 participants