RenderHeads / UnityPlugin-AVProVideo

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

Cannot play High Resolution 7k+ 360 video on Oculus Quest 2 #596

Closed ngquidon closed 3 years ago

ngquidon commented 3 years ago

Hello, I am having trouble playing high resolution videos with AVPro on an Oculus Quest 2. I tried to play a 7168x3584 60fps video but all I get is a black screen on both exoPlayer and MediaPlayer, using the sample 360 scene. Also, i tried to play to downscale the video to 5k and it only plays on MediaPlayer, but it looks like the framerate isn't stable. Do you have any advice or solution to this issue ? I am also wondering if the problem can come from the ffmpeg command line I am using. Thank you

Your Setup (please complete the following information):

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

Screenshots If applicable, add screenshots to help explain your problem.

Videos If applicable, add a copy of your video or the URL

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Instead email the link to us unitysupport@renderheads.com

Ste-RH commented 3 years ago

The quest2 should be able to handle that resolution/framerate/codec - as outlined here. Your bitrate is very high though. Have you tried something a lot lower (10MBit maybe) ?

Could you send over a full logcat dump so I can take a look?

ngquidon commented 3 years ago

Sure, I just tested a 7k but with a 10Mb bitrate, as a result, MediaPlayer API can play it, but not the ExoPlayer API. Here are the logs. A FileNotFoundException is thrown with exoPlayer with the same file path as MediaPlayer, so its kinda odd. I am using an absolute path to locate the file because, the video will be huge in size so I have to manually push it to the device. logs_10mb_exoplayer.txt

Ste-RH commented 3 years ago

Could you try adding the following to the 'application' section of your your manifest?

android:requestLegacyExternalStorage="true"

Ste-RH commented 3 years ago

Also ensure you have external write permissions in your 'Player Settings'

image

ngquidon commented 3 years ago

I did everything you said, added the line on the manifest, although this made me set the target API to level 29, because of the linking error it created, but still no playing on exoplayer. Here are the logs from this test. logs_25mb_exoplayer.txt

ngquidon commented 3 years ago

Additionally, do you have any advice regarding the ffmpeg command line for the video ? I am currently using something like this: .\ffmpeg.exe -start_number 0 -framerate 60 -i -vf scale=8192:4096 -c:v libx265 -framerate 60 -pix_fmt yuv420p -b 75M -maxrate 75M -bufsize 200M -r 60 -movflags faststart

Ste-RH commented 3 years ago

I will hopefully be getting my hands on a Quest 2 tomorrow so I can look into this problem. Would you be able to send me over video that does not work for you? You can send it to unitysupport@renderheads.com if you want to keep it private. I want to make sure I am using the same source material so there are as few differences as possible when trying to reproduce.

On that note, have you tried reproducing the issue in one of our demo scenes? Just to rule out any custom project code.

Your ffmpeg command...

What was the approx file size of your 10MBit test video?

ngquidon commented 3 years ago

Sorry for the dirty command line, I should have read my input before posting it. But it was just to give you a quick look at the parameters. I have to encode the video from an image sequence, so that's why I put the start_number parameter in order to check the quality on certain part of the video. I know that the bitrate is huge but i tried to encode at 10Mbit and there is a huge loss in quality, and I cant really deliver that. The size of the final video doesn't really matter as it will be read locally from the Quest 2 sdcard storage. I will send you samples of the video at 10mb and 100mb.

The size of the 10Mb video is around 18Mo. Thank you for your time.

Ste-RH commented 3 years ago

Bitrate will matter in terms of memory usage...ExoPlayer and buffering are a concern as you use higher bitrates. Thanks for sending the videos over. Just got them.

Are you using OES mode?

ngquidon commented 3 years ago

Absolutely, I am running my tests on the 360 video player sample scene. EOS mode is used with the corresponding shader on the sphere.

Ste-RH commented 3 years ago

The problem is that you have file:// at the start of your path. We strip this internally, but we only strip 'file:/' ...and so your path was becoming //sdcard/Download/test_video_8K_100M.mp4 (or equivalent).

If you put your path in as '/sdcard/Download/test_video_8K_100M.mp4' (for example), this should fix your problem.

I will look at a better method of stripping the file:/ or file:// accordingly so it is valid still. But for now, you can just remove it and have your path as above.

Let me know either way please :)

Ste-RH commented 3 years ago

Fix coming in v2.0.3

AndrewRH commented 3 years ago

@ngquidon do let us know if 2.0.3 (released now) solves this issue. Thanks,

ngquidon commented 3 years ago

Hi, my first test just failed with 2.0.3 on a fresh project. I just get a black screen regarless of the API used. logs2.0.3.txt

ngquidon commented 3 years ago

After further testing it seems like 6K videos can be displayed but not 8K.

Ste-RH commented 3 years ago

Have you tested with the two videos you sent over our way? These both worked in our demo scenes (MediaPlayer and 360) from the SD card (in the downloads folder with path: file:///sdcard/Download/test_video_8K_100M.mp4).

Ste-RH commented 3 years ago

Your log says you are using the MediaPlayer API:

[AVProVideo] Opening file://sdcard/Android/obb/com.test.videos/test_16K_to_8K_100M_nvenc_45.mp4 (offset 0) with API MediaPlayer

...and also an nvenc encoding? That should work, but don't recall testing an nvenc encoded video before.

Can you test using ExoPlayer and one/both of the test videos you sent us?

ngquidon commented 3 years ago

I just tried this with exoPlayer, still getting black screen: 2021-02-02 12_53_47-AVPro3 - Demo_360Stereo - Android - Unity 2019 3 4f1 _DX11_

logs2.0.3_exoplayer.txt

Ste-RH commented 3 years ago

Oki, tested the trial version of v2.0.3 here and, out the box, I indeed get no video playback.

These are the things I set to make playback work:

image

image

image

If any of the above are not set correctly, then you will not get playback.

Do let us know how you get on.

ngquidon commented 3 years ago

The 3 slashes made it work :)

Ste-RH commented 3 years ago

Excellent. Good luck with your project :)

ngquidon commented 3 years ago

Thanks, Additionally, I can confirm that 8k video with a large bitrate (100Mb) are working on the oculus Quest 2, if the question is asked. Thank you for your time :)

Ste-RH commented 3 years ago

Thanks for reporting. Sorry, should have asked if you were happy for me to close the issue rather than assuming and blindly clicking the button!

ngquidon commented 3 years ago

No problem, have a nice day.