RenderHeads / UnityPlugin-AVProVideo

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

Playing large MP4 files fails on iOS #1780

Closed takayasan closed 7 months ago

takayasan commented 8 months ago

Please DO NOT LINK / ATTACH YOUR PROJECT FILES HERE

Describe the issue When you try to play an MP4 file on the Internet on your iPhone, the loading time increases in proportion to the data size of the target file. Also, if the loading time exceeds approximately 120 seconds, an error of ErrorCode.LoadFailed will be output. Therefore, MP4 files of approximately 1GB cannot be played.

The MP4 file that failed to load can be played in Safari, so it seems that there is no error in the URL or codec. Also, on Windows and Android, MP4 files with the same URL can be played normally.

Is there a way to resolve this issue and read MP4 files larger than 1GB and play videos on iOS?

Your Setup (please complete the following information):

Logs Xcode is outputting the following log. [AVProVideo] Opening https://aaaaa.bbbbb/ccccc/ddddd.mp4 (offset 0) with API [AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources.

Chris-RH commented 8 months ago

Hi,

The issue is most likely to be caused by The video file not having the moov atom at the start (-movflags faststart) The server not reporting the filesize correctly

Are you able to provide the URL that you are testing with please, either here or unitysupport@renderheads.com

takayasan commented 7 months ago

Thank you for your reply. The URL I used for testing is not publicly available, so I sent it to "unitysupport@renderheads.com".

The problem seems to be on the MP4 side, is there anything else that needs to be addressed on the Unity or AVProVideo side?

Chris-RH commented 7 months ago

Hi,

You just need to re-encode it so that the moov atom is at the start:

ffmpeg -i [input.mp4] -c:v copy -movflags faststart [output.mp4]

takayasan commented 7 months ago

I was able to solve the problem by putting moov atom at the beginning. Thank you very much.