MP4 Video wrong orientation if made in portrait

Please report only one bug per message!

Moderators: white, sheep, Hacker, Stefan2

User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41387
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *ghisler(Author) »

I'm not getting any video preview in Explorer for the sample videos some of you sent me, and also not for one I made myself on the phone.
Instead I see a still image (in portrait mode!), and when I click on it, it opens in MPC-HC.
Author of Total Commander
http://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4374
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: MP4 Video wrong orientation if made in portrait

Post by *Horst.Epp »

ghisler(Author) wrote: 2021-05-25, 16:14 UTC I'm not getting any video preview in Explorer for the sample videos some of you sent me, and also not for one I made myself on the phone.
Instead I see a still image (in portrait mode!), and when I click on it, it opens in MPC-HC.
I have installed the K-Lite_Codec_Pack_1620_Basic.
With this Explorer preview (8) in TC displays correct in portrait.
It has the options to Play it or open in Windows Media Player which also plays it correct in portrait.
I now switched the TC Player settings to "Use system default filters"
This way other file managers (XYplorer), Windows Explorer preview and Everything preview are correct.
I don't need additional Codecs in TC.
Windows 10 Home x64 Version 21H2 (OS Build 19044.1110)
TC 10.00 x64 / x86
Everything 1.5.0.1269a (x64)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41387
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *ghisler(Author) »

I now switched the TC Player settings to "Use system default filters"
I don't get any mp4 playback this way - what codecs does TC show in the right click menu then?
And does it show the video in portrait mode?
Author of Total Commander
http://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4374
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: MP4 Video wrong orientation if made in portrait

Post by *Horst.Epp »

ghisler(Author) wrote: 2021-05-25, 16:59 UTC
I now switched the TC Player settings to "Use system default filters"
I don't get any mp4 playback this way - what codecs does TC show in the right click menu then?
And does it show the video in portrait mode?
Yes, it shows the video in portrait mode.
What right click menu you mean ?
There is none in the Explorer preview.
Windows 10 Home x64 Version 21H2 (OS Build 19044.1110)
TC 10.00 x64 / x86
Everything 1.5.0.1269a (x64)
User avatar
petermad
Power Member
Power Member
Posts: 10670
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *petermad »

2ghisler(Author)
As I wrote, it depends on the output filter used.
My MPC-HC Settings: Options -> Playback -> Output -> Directshow Video is set to "Enhanced Video Renderer (custom presenter)".
This is how it came out of the box - and it playes the portraitmovie.mp4 correctly rotated



2Horst.Epp
I can just switch to Explorer preview for such videos.
Explorer preview does not show mp4 files for me under Windows 10 (it does under Windows 7 - but here is does not rotate the portrait movies) - So Explorer preview is not a miracle cure - I guess it also depends on which filters are installed/registered system wide.
License #524 (1994)
Danish Total Commander Translator
TC 10.00 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (21H1) 64bit, 'Everything' 1.4.1.1009 (x64)
TC 3.23 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4374
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: MP4 Video wrong orientation if made in portrait

Post by *Horst.Epp »

petermad wrote: 2021-05-25, 17:57 UTC 2ghisler(Author)
As I wrote, it depends on the output filter used.
My MPC-HC Settings: Options -> Playback -> Output -> Directshow Video is set to "Enhanced Video Renderer (custom presenter)".
This is how it came out of the box - and it playes the portraitmovie.mp4 correctly rotated



2Horst.Epp
I can just switch to Explorer preview for such videos.
Explorer preview does not show mp4 files for me under Windows 10 (it does under Windows 7 - but here is does not rotate the portrait movies) - So Explorer preview is not a miracle cure - I guess it also depends on which filters are installed/registered system wide.
The only filters I have installed are the K-Lite package,
now in the standard version which also contains MPC-HC.
Explorer preview for mp4 shows the video in the correct orentation and allows to play or open in Windows media player.
Windows 10 Home x64 Version 21H2 (OS Build 19044.1110)
TC 10.00 x64 / x86
Everything 1.5.0.1269a (x64)
User avatar
petermad
Power Member
Power Member
Posts: 10670
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *petermad »

2Horst.Epp
Explorer preview for mp4 shows the video in the correct orentation and allows to play or open in Windows media player.
For some reason I only get a still picture of the video when I use Explorer preview in Windows 10 - and I do have the Windows Media Player installed in Windows 10, so it is peculiar that it is not used, as it is in my Windows 7, and Windows 8.1

And why does Windows Media Player not turn the portrait movie correct under my Windows XP and 7, but do under my Windows 8.1 and 10.

Windows media player are all version 12 unde Win 7, 8.1 adn 10, although different subversions.
License #524 (1994)
Danish Total Commander Translator
TC 10.00 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (21H1) 64bit, 'Everything' 1.4.1.1009 (x64)
TC 3.23 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
petermad
Power Member
Power Member
Posts: 10670
Joined: 2003-02-05, 20:24 UTC
Location: Valsted, Denmark
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *petermad »

For some reason I only get a still picture of the video when I use Explorer preview in Windows 10
I found the reason - video files were associated with Windows' (stupid) "Movie & TV" app in stead of "Windows Media player" - after changing that I can now also play videos in Explorer preview :-)
License #524 (1994)
Danish Total Commander Translator
TC 10.00 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (21H1) 64bit, 'Everything' 1.4.1.1009 (x64)
TC 3.23 on Android 6 & 11
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41387
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *ghisler(Author) »

My MPC-HC Settings: Options -> Playback -> Output -> Directshow Video is set to "Enhanced Video Renderer (custom presenter)".
This "custom presenter" seems to do the rotation. It allocates its own Direct3d surface and rotates it. In principle, what it does is create a rectangle, put the video image as a texture on it, and let the GPU rotate and display it. The same seems to be possible with the "Video Mixing Renderer 9", there is even a sample in the DirectShow SDK where the video is played on a rotating surface. I will try to adapt this to draw the video rotated. It's very complex, so don't expect it for TC 10 final yet.
Author of Total Commander
http://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1215
Joined: 2011-03-11, 10:11 UTC

Re: MP4 Video wrong orientation if made in portrait

Post by *Usher »

ghisler(Author) wrote: 2021-05-26, 09:59 UTC
My MPC-HC Settings: Options -> Playback -> Output -> Directshow Video is set to "Enhanced Video Renderer (custom presenter)".
The same seems to be possible with the "Video Mixing Renderer 9"
For me it works in MPC-HC 1.7.13 and in MPC-BE 1.4.6 (build 1590) with "Video Mixing Renderer 9 (renderless)".
Regards from Poland
Andrzej P. Wozniak
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4374
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: MP4 Video wrong orientation if made in portrait

Post by *Horst.Epp »

Usher wrote: 2021-05-26, 11:59 UTC
ghisler(Author) wrote: 2021-05-26, 09:59 UTC
My MPC-HC Settings: Options -> Playback -> Output -> Directshow Video is set to "Enhanced Video Renderer (custom presenter)".
The same seems to be possible with the "Video Mixing Renderer 9"
For me it works in MPC-HC 1.7.13 and in MPC-BE 1.4.6 (build 1590) with "Video Mixing Renderer 9 (renderless)".
The MPC-HC version of the K-Lite_Codec_Pack_1620_Standard is as follows:

Build information:
Version: 1.9.11.49 (12dafcbc2)
Compiler: MSVC v19.26.28806
Build date: May 20 2021

LAV Filters:
LAV Splitter: 0.75.0.2
LAV Video: 0.75.0.2
LAV Audio: 0.75.0.2
FFmpeg compiler: MinGW-w64 GCC 9.3.0

Directshow Video is set to "MPC Video Renderer"
Windows 10 Home x64 Version 21H2 (OS Build 19044.1110)
TC 10.00 x64 / x86
Everything 1.5.0.1269a (x64)
User avatar
Usher
Power Member
Power Member
Posts: 1215
Joined: 2011-03-11, 10:11 UTC

Re: MP4 Video wrong orientation if made in portrait

Post by *Usher »

2Horst.Epp
1. Using the newest MPC-HC version isn't helpful when @ghisler uses a very old one for tests. That's why I did tests with 32-bit versions in Windows XP. Any newer versions may be properly configured as well.
2. MPC-HC in that codec pack seems to use some custom config (or has got some more features integrated). I have installed MPC-HC downloaded directly from the developers' page, then somehow manually configured. In my case MPC filters are listed as external filters which have to be manually added. Possibly that's why I can't see "MPC Video Renderer".

@all
3. I have chosen renderer which supports all listed features and can be used also for RealMedia and QuickTime. It's only "Video Mixing Renderer 9 (renderless)" available in my OS and for my hardware. "Enhanced Video Renderer (custom presenter)" used by @petermad supports rotation, but doesn't support DXVA for me.
4. On my list of renderers, "Sync Renderer" and "madVR" also support rotation and DXVA - Sync Renderer is probably EVR (CP) fork, works OK for me, madVR isn't available in my case.
Regards from Poland
Andrzej P. Wozniak
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41387
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *ghisler(Author) »

1. I tried both with the very old one and the latest one from the link above. The results are almost the same, it depends on the output filter whether the video is shown in portrait or landscape mode.
2. Yes, MPC video renderer is something internal, as well as "Video Mixing Renderer 9 (renderless)". The only external renderer capable of video rotation is MadVR.
Author of Total Commander
http://www.ghisler.com
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 41387
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: MP4 Video wrong orientation if made in portrait

Post by *ghisler(Author) »

I'm currently working on this problem, and it's more difficult than I thought. Before I integrate it into Lister, it would be great if some of you could test whether the following sample app shows your video correctly (upgright and without extra borders):
https://www.totalcommander.ch/win/tools/rotationtest.zip

I have modified the Microsoft vmr9allocator sample from the Windows SDK for my purposes. The sample shows a video on a rotating surface. I changed it show it on a fixed surface, but with the camera rotated by 90° to the left or right, or 180° for upside down videos.

The video will pause for a short moment after resizing the player window to adjust the video surface to the new size. During the resizing, the video will just be stretched to the new size.
Author of Total Commander
http://www.ghisler.com
User avatar
Horst.Epp
Power Member
Power Member
Posts: 4374
Joined: 2003-02-06, 17:36 UTC
Location: Germany

Re: MP4 Video wrong orientation if made in portrait

Post by *Horst.Epp »

ghisler(Author) wrote: 2021-06-18, 16:57 UTC I'm currently working on this problem, and it's more difficult than I thought. Before I integrate it into Lister, it would be great if some of you could test whether the following sample app shows your video correctly (upgright and without extra borders):
https://www.totalcommander.ch/win/tools/rotationtest.zip

I have modified the Microsoft vmr9allocator sample from the Windows SDK for my purposes. The sample shows a video on a rotating surface. I changed it show it on a fixed surface, but with the camera rotated by 90° to the left or right, or 180° for upside down videos.

The video will pause for a short moment after resizing the player window to adjust the video surface to the new size. During the resizing, the video will just be stretched to the new size.
Both versions show my test video with correct orientation and borderless. :D
Windows 10 Home x64 Version 21H2 (OS Build 19044.1110)
TC 10.00 x64 / x86
Everything 1.5.0.1269a (x64)
Post Reply