RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
235 stars 28 forks source link

[Windows] Videos fail to play on some systems with Media Foundation #1172

Closed v2k closed 2 years ago

v2k commented 2 years ago

Newer twitter videos are failing to load with AVPro video; older twitter videos still work. This is hardware dependent. Videos also work with DirectShow, but fail with Media Foundation.

  1. Load video in Editor and try to play
  2. fails with generic error (seems to be Win10 LTSB)

Videos Fail Video: https://twitter.com/warriors/status/1520850034408845312 Working Video: https://video.twimg.com/amplify_video/1085575593402474497/vid/720x720/N3oylQJ0xoUTWCgc.mp4?tag=9

sent to unitysupport@renderheads.com => DxDiag example of a failing system included

Chris-RH commented 2 years ago

Hi @v2k, Thank you for your message. It is very common for video services to hide their URLs, and more than likely it is against their terms of service to stream their videos or use third party software to find the URLs. Therefore we are unable to find the URLs using our products.

v2k commented 2 years ago

Sorry, wrong link; here's an example:

https://video.twimg.com/amplify_video/1378039169545510913/vid/640x360/Yj3Krs69qenpb9kV.mp4?tag=14

Chris-RH commented 2 years ago

Both of those videos played fine for me. Using Unity 2020.3.29 and AVPro Video 2.5.0, using Win 10 Home. Have you tried playing them in external players such as WMP or VLC?

v2k commented 2 years ago

The videos work on most systems. Did you test on a Win10 LTSB system? Do you have a system similar to the dxdiag I sent you to test on?

The videos play fine in the web browser or any other application. It's just AVPro that's failing.

Chris-RH commented 2 years ago

Hi @v2k, Unfortunately we don't have a Win10 Ent system to test on. Could you try installing this and seeing if it helps please? https://www.microsoft.com/en-us/download/details.aspx?id=53356

drinsley commented 2 years ago

We can't install it, image

Chris-RH commented 2 years ago

ok, we'll have another think about it

Chris-RH commented 2 years ago

Hi, we've had another chat about your issue this morning.

Please can you try using Topoedit on your media file. Topoedit.zip You go here and select the media file that you want to play image And it should load the media and create a topology. image2 Click the play button and it should play the media in a window. This uses Media Foundation, so it should allow us to see if it is a MF issue or and AVProVideo issue. Thank you for your help.

v2k commented 2 years ago

That yields a Media Foundation Error:

MicrosoftTeams-image

v2k commented 2 years ago

Couldn't see to find any further information in the Event Viewer.

Chris-RH commented 2 years ago

Thanks, that's very helpful

AndrewRH commented 2 years ago

@v2k we're still investigating this....

image

1) In the MediaPlayer component, if you disable the Hardware Decoding option, does that help?

2) Also - in the above test with TopoEdit, which videos did you test with? Could you also test with our BigBuckBunny sample video?

3) Am I understanding this correctly that your issue is that most videos do play (including our sample videos) on all of your systems, but the new twitter video linked above is an example of one that doesn't play, but only on one specific system with Windows 10 Enterprise 2016 LTSB?

Thanks,

drinsley commented 2 years ago

In the MediaPlayer component, if you disable the Hardware Decoding option, does that help? No, it still does not play if I disable that Hardware Decoding option

Also - in the above test with TopoEdit, which videos did you test with? Could you also test with our BigBuckBunny sample video? The BigBuckBunny sample plays fine

Am I understanding this correctly that your issue is that most videos do play (including our sample videos) on all of your systems, but the new twitter video linked above is an example of one that doesn't play, but only on one specific system with Windows 10 Enterprise 2016 LTSB? Yes that is correct. We have multiple systems that still use 2016 LTSB and it doesn't work on any of them.

drinsley commented 2 years ago

Not sure if this helps but I found that this video: https://video.twimg.com/amplify_video/1378039169545510913/vid/640x360/Yj3Krs69qenpb9kV.mp4?tag=14

On the Windows 2016 LTSB system: Does not open with Windows Media Player 32-bit It only opens with Windows Media Player 64-bit

Chris-RH commented 2 years ago

Thank you, this is all very helpful. We'll delve into this further.

v2k commented 2 years ago

Good use of today's wordle!

Chris-RH commented 2 years ago

This is a tricky one, because looking at the files in MediaInfo, they are very similar. Also, the fact that it works in 64-bit WMP, but not 32-bit WMP indicates a possible codec issue?

Could you get the Administrator to try the following please:

  1. Reinstall media packs and codecs - 32-bit WMP needs 32-bit codecs and 64-bit WMP needs 64-bit codecs
  2. Install latest GPU drivers

Could you also clarify that you are using 64-bit unity and making 64-bit builds of your app please?

drinsley commented 2 years ago

I installed the K-Lite codec pack, and the video can now play in WMP 32 bit. But the original problem still persists with media foundation not being able to play the twitter link.

We're using the onboard Intel HD Graphics 630 and it's up to date.

Yes we're using the 64-bit builds of our app. We can also reproduce it in the editor.

Chris-RH commented 2 years ago

Have you retried the file in topoedit? Do you get different results trying to play it in Unity from your PC rather than from URL?

drinsley commented 2 years ago

Same error with Topoedit, HRESULT is c00d002f

It plays fine in Unity with Media Foundation, but the URL does not play

drinsley commented 2 years ago

It also appears to be any of the new video tweets do not work. Broken: https://twitter.com/warriors/status/1520850034408845312 Works: https://twitter.com/PGATOUR/status/1085695949656141825

Chris-RH commented 2 years ago

Hi, could you try these file and see if you get any different results please? Are you able to put them somewhere to try stream them rather than play from PC as well?

File without audio: https://user-images.githubusercontent.com/102963025/169498742-5493449f-04ff-4662-b7c9-3662fea4f048.mp4

File with audio converted to 48KHz https://user-images.githubusercontent.com/102963025/169498715-aff6eaeb-3553-4ad7-9ba6-93fcd1e5dca4.mp4

Could you also please try deleting everything in: C:\Users\YOURUSERNAME\AppData\Local\Microsoft\Windows\INetCache as that is where Media Foundation caches files to.

drinsley commented 2 years ago

I can stream those links that you sent, they play fine.

But if I make them into tweets and try and play those links they don't work with Media Foundation.

I deleted what I could from that folder, but issue still happens.

Chris-RH commented 2 years ago

Could you send me the file after its been put on twitter? I suspect that they might be re-encoding it on their end.

drinsley commented 2 years ago

You can right click on these links to download the videos, I posted them on twitter then got the url through our software.

Audio Converted: https://video.twimg.com/ext_tw_video/1529949277719433216/pu/vid/640x360/fqAreUhn9e7RjQax.mp4?tag=12 Without Audio: https://video.twimg.com/ext_tw_video/1529949133229785088/pu/vid/640x360/2AnVHZqxkB2AXF4e.mp4?tag=12

Chris-RH commented 2 years ago

Those work fine for me. I'm wondering if you are still lacking a codec somewhere.
Has your administrator installed the Windows Media Pack https://support.microsoft.com/en-us/topic/media-feature-pack-list-for-windows-n-editions-c1c6fffa-d052-8338-7a79-a4bb980a700a ?

drinsley commented 2 years ago

Yes it's installed, it works on my windows 10 system as well but it doesn't work on the Windows 10 Ent 2016 LTSB systems

Chris-RH commented 2 years ago

And these ones that you have tweeted again, do they work in topoedit?

Chris-RH commented 2 years ago

The only option we can think of at this point is allowing our Windows developer remote access to the PC so that he can try and figure it out directly.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

drinsley commented 2 years ago

I'll get a system ready for you to connect to next week

drinsley commented 2 years ago

Do you have a email I can send the teamviewer information to?

Chris-RH commented 2 years ago

Sure. Please email the details to unitysupport@renderheads.com with 1172 in the subject line. and the windows dev will get in touch. Thanks :)

AndrewRH commented 2 years ago

@drinsley thanks for allowing the remote session.

I was able to test a number of theories and modify the video files to work out what was causing them not to play.

It seems to be a single byte. The "CTTS" atom of the MP4 file has a version byte. In your file that doesn't play, this version was set to 1. Changing it to 0 allows the video to play.

I can only assume that there was an old version of Microsofts MP4 parser that didn't allow this version number and so assumed the file was badly formed and didn't load it. I checked the documentation online and it seems that version 1 was added later to allow for negative CTTS offset values, but in several places I found it's not documented.

I assume that this was fixed in some Windows update, but because this is an LTSB 2016 version of Windows that update might not be available....

I'm afraid I don't think there is anything we can do in our plugin to fix this (unless you use DirectShow which uses different code to load the videos). Even in Windows Explorer it can't give the videos a thumbnail image and also Windows Media Player can't open the file - showing that it's an issue with the MP4 parser built into Windows on that machine.

drinsley commented 2 years ago

Ok thanks for looking into it. I guess we have to update those systems.