RenderHeads / UnityPlugin-AVProVideo

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

Player cause IOS app to run out of memory playing 30 second video if YpCbCr420 not checked #433

Closed nsmith1024 closed 3 years ago

nsmith1024 commented 4 years ago

Describe the bug A clear and concise description of what the bug is.

Play a 30 second video when YpCbCr420 isnt checked cause IOS app to run out of memory and crash.

YpCbCr420 not checked makes Video have red tint

Your Setup (please complete the following information):

To Reproduce

  1. Play a 30 second video when YpCbCr420 isnt checked

Logs If applicable, add error logs to help explain your problem.

IOS App receive memory warning several times, then crashed

AndrewRH commented 4 years ago

Hi,

Which component are you using to display the video? The YpCbCr option requires using our components which automatically handle conversion in the shader. If you need to display the video in the UI use the DisplayUGUI component.

What are the specs of the video you're playing?

Thanks,

nsmith1024 commented 4 years ago

Hello,

I dont know the specs of the video thats being played. I recorded a 60 second video using another video recording component i bought from Unity play store. That component (NAT-CORDER + NAT-MiC) records the video and audio and stores it as a mp4 file internally on the phone file system. I was playing it back using your player when it started giving memory warnings at around 30 seconds then crashed.

If i record a 15-30 second video and play that back it doesnt crash.

I had YpCbCr420 UNCHECKED in your player. I was using the media player script that i attached to a game object.

This happens on IOS iPhone-7 version 13.6

I have the exact same app compiled for android, same code, same everything, and it doesnt crash when i do the same operations (record video and play it back).

Im using your beta release player and "Apply To material" script

MorrisRH commented 4 years ago

A quick test using our own capture solution (AVPro Movie Capture) and the latest beta (2.0.0-beta3) with Unity 2020.1.1f1 shows no leaks. The capture was at full resolution (2224x1668) 60Hz on an iPad Pro.

I can think of no reason why a longer duration movie would use any more memory though. If you're able to get the movie from the device it would be helpful in diagnosing any potential issue (you can do this by adding the key "UIFileSharingEnabled" with a value of "YES" to the project's Info.plist, you will then be able to access the files via iTunes).

It does sound like your application is memory constrained though, so switching to YCbCr textures will definitely help. When using "Apply To Material" make sure that the material you're using either makes use of one of our shaders (Assets/AVProVideo/Runtime/Shaders/AVProVideo-Lit-Diffuse.shader for example) or add support for YCbCr to your own shaders by including "AVProVideo.cginc" and calling SampleYpCbCr which will return a RGBA colour (Assets/AVProVideo/Runtime/Shaders/AVProVideo-Lit-Diffuse.shader is a good example for how to do this).

nsmith1024 commented 4 years ago

If I check YpCbCr420 there is a red tint in the video, do you know how i can get rid of the red tint but keep that checked? This tint doesnt appear when i compile the same code and play the same video on Android.

AndrewRH commented 4 years ago

The red tint is visible because you're not using one of our shaders to display the video.

Which component (ApplyToMesh, ApplyToMaterial, DisplayUGUI etc) are you using to display the video?

If you are using your own shader/material on these then this is why you're seeing red tint.

You either need to use one of the AVPro Video shaders, or add support for YCbCr into your custom shader.

If you can give us more details on what your setup is then we can answer further.

Thanks,

nsmith1024 commented 4 years ago

I was using your shader and Apply to material. There is another package (NAT-recordeR) that was capturing the screen and audio while the video is being played, it captured as another mp4 file. After a short while app runs out of memory on iPhone 7. The same app works fine on android. IOS is always a problem for everything it seems.

stale[bot] commented 3 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.

stale[bot] commented 3 years ago

This issue has been automatically closed because it has not had recent activity. If you wish to continue this issue, then please create a new issue as we do not monitor closed issues.

nsmith1024 commented 3 years ago

You guys have a product to capture the mobile screen (IOS and Android) with sound into a MP4 file?