VideoViewer: rotated (portrait phone) videos shown sideways when system decimal separator is a comma
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
The rotation value is parsed with the current culture in QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs and again in QuickLook.Plugin.VideoViewer/Plugin.cs for window sizing; start with those two double.TryParse calls on the MediaInfo "Rotation" field. Done when both parse with CultureInfo.InvariantCulture and NumberStyles.Float, and a ru-RU locale shows a portrait video upright. Check whether the existing rotation /= 1e3 workaround still holds.
Written by the indexing model from the issue text.
Description
Describe the bug Portrait videos recorded on iPhone (stored as 1920x1080 with a rotation flag) are previewed sideways. This is likely the root cause of #762, which was closed without being reproduced.
Cause MediaInfo returns the rotation as "90.000". The VideoViewer parses it with the current culture:
QuickLook.Plugin.VideoViewer/ViewerPanel.xaml.cs — double.TryParse(info?.Get(StreamKind.Video, 0, "Rotation"), out var rotation);
QuickLook.Plugin.VideoViewer/Plugin.cs — same call for the window size
When the decimal separator is a comma (ru-RU, uk-UA, many other locales), "90.000" fails to parse, so rotation stays 0 and no rotation is applied. With a dot as the group separator (de-DE etc.), it parses as 90000. The existing if (rotation > 360) rotation /= 1e3; workaround covers that case, but not the comma-separator case.
Proposed fix Parse the value with the invariant culture in both places:
double.TryParse(info?.Get(StreamKind.Video, 0, "Rotation"),
NumberStyles.Float, CultureInfo.InvariantCulture, out var rotation);
After this change, the /= 1e3 workaround is probably no longer needed.
To Reproduce
Windows region format ru-RU (decimal separator ,).
Take a portrait iPhone video (HEVC .MOV, rotation=-90 in ffprobe, MediaInfo Rotation = 90.000).
Preview it in QuickLook. It is shown sideways.
Change the decimal separator to . and restart QuickLook. It is shown correctly.
Environment
Windows 11 Home 24H2 (10.0.26100)
QuickLook 4.5.0.0 (Microsoft Store)
- Dominant language
- C#
- Stars
- 25.2k
- Forks
- 1.3k
- Avg merge
- 10d 4h
- Merged PRs (30d)
- 2
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from QL-Win/QuickLook
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
Difficulty 3/5 1-2 days Newbie friendliness 56/100
-
good for a plugin upstream
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
All issues in QL-Win/QuickLook
Similar issues
-
Bug: Hidden loading rings keep the compositor running, so Files uses 7-94% of a CPU core while idleOpen
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
files-community/Files#19026 · 1 comment ·
Maintainers usually reply within 1 day
-
Physgun SFX SpamOpen
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
SubtitleEdit/subtitleedit#15946 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
BHoM/Civil3D_Toolkit#118 ·
-
Reason-phrase table has misspelled entries (`Unathorized`, `Switching Protcols`, `Multiple Choises`)Openbug severity:low
Difficulty 2/5 1-3 hours Newbie friendliness 65/100