RenderHeads / UnityPlugin-AVProVideo

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

AVPro Video's Support of Playing encrypted mp4 or Play Video From Memory #1918

Open eiyamomo opened 4 days ago

eiyamomo commented 4 days ago

Before I asked this question, I have tried to search online or going through existing issues. Yet I can't find any solution for this.

I am creating a FMV-like game using Unity which includes a lot of videoclips (which currently in mp4).

I would like to encrypt the video files so the player would play the game (rather than find and play those videoclips locally)

It seems that AvPro Video's media player only support playing Video from File Path. I was hoping I could just load the encrypted video, decrypt it, then feed it to AvPro Video's mediaplayer. But I couldn't find out how.

the cycle of "load encrypted video -> decrypt -> write into local -> delete after finished playing" doesn't seem to be feasible as it might introduce uncertainties in terms of delays/performance hit/etc.

a lot of question I have found even traced back to 2020-2021, which really concerns me.

As today of June 2024, just wondering if there is any way (or alternative way) that is currently supported by AvPro Video to achieve being able to play encrypted videoclips?

Any help would be appreciated.

Thanks in advance.

Chris-RH commented 3 days ago

Which platform are you looking at using?

eiyamomo commented 3 days ago

Windows platform for steam(for now at least).

eiyamomo commented 1 day ago

I was finally able to get OpenMediaFromBuffer working

By load the encrypted mp4, decrypt it into a byte[]

then set the videoAPI to be directshow

mediaPlayer.PlatformOptionsWindows.videoApi = Windows.VideoApi.DirectShow;

However the videoclip's aspect ratio / resolution got changed.

It was originally 2560x1440, but it got changed to 720x480.

[AVProVideo] Using playback path: DirectShow (720x480@60.00) UnityEngine.Debug:Log (object) RenderHeads.Media.AVProVideo.Helper:LogInfo (string,UnityEngine.Object) (at Assets/AVProVideo/Runtime/Scripts/Internal/Helper.cs:183) RenderHeads.Media.AVProVideo.WindowsMediaPlayer:Update () (at Assets/AVProVideo/Runtime/Scripts/Internal/Players/WindowsMediaPlayer.cs:818) RenderHeads.Media.AVProVideo.MediaPlayer:Update () (at Assets/AVProVideo/Runtime/Scripts/Components/MediaPlayer.cs:823)

is there way to keep it at 2560x1440?

tried to search the api documentation, but didn't find anything

Edit#1: I am using AVPro Video - Ultra Edition - 2.9.3

Edit#2: It works for mp4 up to 1920x1080p, but not for 1440p or 4k This is not only happening to OpenMediaFromBuffer but in general to AvPro Video when the videoAPI is set to DirectShow.