wang-bin / fvp

Flutter video player plugin for all desktop+mobile platforms. download prebuilt examples from github actions. https://pub.dev/packages/fvp
BSD 3-Clause "New" or "Revised" License
126 stars 20 forks source link

[!] No podspec found for `fvp` in `.symlinks/plugins/fvp/ios` #5

Closed quochuynh67 closed 12 months ago

quochuynh67 commented 1 year ago

Hi I am facing with this problem. Could you help me to resolve it?

My Flutter version: Flutter 3.10.0 • channel stable • https://github.com/flutter/flutter.git Framework • revision 84a1e904f4 (7 weeks ago) • 2023-05-09 07:41:44 -0700 Engine • revision d44b5a94c9 Tools • Dart 3.0.0 • DevTools 2.23.1

[!] No podspec found for fvp in .symlinks/plugins/fvp/ios

wang-bin commented 1 year ago

https://github.com/wang-bin/fvp/blob/v0.0.4/pubspec.yaml#L50

I guess this line breaks the build. I'm using 3.10.5, removing this line result in the same error. You can try to clone this repo, make a symbolic link to darwin

cd fvp
ln -sf darwin ios
ln -sf darwin macos

If this can fix the issue, i will publish a new version with this fix.

https://docs.flutter.dev/packages-and-plugins/developing-packages#shared-ios-and-macos-implementations

sharedDarwinSource should work for flutter >= 3.7.0

quochuynh67 commented 1 year ago

@wang-bin Thank you for your reply.

could you help me to resolve it?

quochuynh67 commented 1 year ago

I am facing with a problem, I want to import many 4K quality video. I only initialize 2 VideoPlayerController at the same time. But the crash happen because the memory usage exceed 2048MB. I know we can reduce resolution/bitrate but we need to pre-processing. It takes long time.

Is your package can improve it? or could you suggest me some technical to handle it?

Thank you so much hope you reply and discuss with me about this problem!!

wang-bin commented 1 year ago

@wang-bin Thank you for your reply.

could you help me to resolve it?

follow the steps i mentioned. or upgrade flutter to 3.10.5. github actions can build without error

wang-bin commented 1 year ago

I am facing with a problem, I want to import many 4K quality video. I only initialize 2 VideoPlayerController at the same time. But the crash happen because the memory usage exceed 2048MB. I know we can reduce resolution/bitrate but we need to pre-processing. It takes long time.

Is your package can improve it? or could you suggest me some technical to handle it?

Thank you so much hope you reply and discuss with me about this problem!!

macos is ok. don't know about ios

wang-bin commented 1 year ago

i published a new version. try again

quochuynh67 commented 1 year ago

Wow, thank you so much bro

On Fri, 30 Jun 2023 at 16:33 WangBin @.***> wrote:

i published a new version. try again

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614396416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QDCYECZFR2F6UPB4VDXN2MP3ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

quochuynh67 commented 1 year ago

Do you have any social networks where we can chat together? I really like your knowledge when I read your github repositories

On Fri, Jun 30, 2023 at 5:27 PM Huỳnh Quốc @.***> wrote:

Wow, thank you so much bro

On Fri, 30 Jun 2023 at 16:33 WangBin @.***> wrote:

i published a new version. try again

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614396416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QDCYECZFR2F6UPB4VDXN2MP3ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 1 year ago

Do you have any social networks where we can chat together? I really like your knowledge when I read your github repositories

On Fri, Jun 30, 2023 at 5:27 PM Huỳnh Quốc @.***> wrote:

Wow, thank you so much bro

On Fri, 30 Jun 2023 at 16:33 WangBin @.***> wrote:

i published a new version. try again

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614396416, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QDCYECZFR2F6UPB4VDXN2MP3ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

email me, then i will send you discord account

quochuynh67 commented 1 year ago

My discord email: @.***

thanks

On Fri, Jun 30, 2023 at 6:26 PM WangBin @.***> wrote:

Do you have any social networks where we can chat together? I really like your knowledge when I read your github repositories

On Fri, Jun 30, 2023 at 5:27 PM Huỳnh Quốc @.***> wrote:

Wow, thank you so much bro

On Fri, 30 Jun 2023 at 16:33 WangBin @.***> wrote:

i published a new version. try again

— Reply to this email directly, view it on GitHub

5 (comment)

https://github.com/wang-bin/fvp/issues/5#issuecomment-1614396416, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AJE24QDCYECZFR2F6UPB4VDXN2MP3ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

email me, then i will send you discord account

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614518783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QAKV527XVSKV6DB6NLXN2ZXZANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 1 year ago

your email is hidden

quochuynh67 commented 1 year ago

My discord information [image: image.png]

On Fri, Jun 30, 2023 at 6:57 PM WangBin @.***> wrote:

your email is hidden

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614548668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QAPHPSO2X32LK2FFLLXN25I7ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

quochuynh67 commented 1 year ago

Unfortunately, I still facing with crashed issues on iOS, it looks I can not allow the user input over 8~10 videos with 4k Quality

On Mon, Jul 3, 2023 at 10:40 AM Huỳnh Quốc @.***> wrote:

My discord information [image: image.png]

On Fri, Jun 30, 2023 at 6:57 PM WangBin @.***> wrote:

your email is hidden

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1614548668, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QAPHPSO2X32LK2FFLLXN25I7ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 1 year ago

play 8~10 4k videos at the same time? Maybe it's a system limitation. Can you provide stack trace?

quochuynh67 commented 1 year ago

On Mon, 3 Jul 2023 at 12:18 WangBin @.***> wrote:

play 8~10 4k videos at the same time? Maybe it's a system limitation. Can you provide stack trace?

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1617364459, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QGQMWQA56KJTQM7453XOJI3DANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

No, the logic only 1 at the same time. But when I add the video I need to create the VideoPlayerController for 8~10 (without playing) It look it takes many memory for high quality video

wang-bin commented 1 year ago

VideoPlayerController.initialize() will start to decode the first frame, so start to consume cpu, gpu and memory

quochuynh67 commented 1 year ago

On Mon, 3 Jul 2023 at 13:37 WangBin @.***> wrote:

VideoPlayerController.initialize() will start to decode the first frame, so start to consume cpu, gpu and memory

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1617449830, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QAE2HI3ALY33GOSHQ3XOJSC7ANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

Do you have any ideas for this?

My ideas and trying such as:

I don't know and I want to learn why the CapCut, .... any video editing application. They can hold many 4K video at the same time

wang-bin commented 1 year ago

Can CapCut play multiple 4k videos at the same time? I guess they only create a thumbnail for each video

quochuynh67 commented 1 year ago

even they can edit it, bro

Because user can play to preview they editing (sticker, filter applied)

Message ID: @.***>

quochuynh67 commented 1 year ago

I think it would be nice if you handle it

I find many plugins in pub.dev. there is no plugin do that

On Mon, Jul 3, 2023 at 2:21 PM Huỳnh Quốc @.***> wrote:

even they can edit it, bro

Because user can play to preview they editing (sticker, filter applied)

Message ID: @.***>

wang-bin commented 1 year ago

even they can edit it, bro Because user can play to preview they editing (sticker, filter applied) Message ID: @.***>

Yes, but at most 2 player instances is enough for those video editors, 1 for current video, another for preloading the next video, so they don't have the problem. There is another option for you: show the thumbnail, initialize player when user requests to play, dispose when playback is not needed.

quochuynh67 commented 1 year ago

yes, my logic is that. only 2 instances at the same time, But the cost for 4K video too much, it takes memory usage

On Mon, Jul 3, 2023 at 2:48 PM WangBin @.***> wrote:

even they can edit it, bro Because user can play to preview they editing (sticker, filter applied) … <#m4678387315127828119> Message ID: @.***>

Yes, but at most 2 player instances is enough for those video editors, 1 for current video, another for preloading the next video, so they don't have the problem. There is another option for you: show the thumbnail, initialize player when user requests to play, dispose when playback is not needed.

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1617556475, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QCLGLZRPGXDEBMONTLXOJ2MTANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 12 months ago

yes, my logic is that. only 2 instances at the same time, But the cost for 4K video too much, it takes memory usage On Mon, Jul 3, 2023 at 2:48 PM WangBin @.> wrote: even they can edit it, bro Because user can play to preview they editing (sticker, filter applied) … <#m4678387315127828119> Message ID: @.> Yes, but at most 2 player instances is enough for those video editors, 1 for current video, another for preloading the next video, so they don't have the problem. There is another option for you: show the thumbnail, initialize player when user requests to play, dispose when playback is not needed. — Reply to this email directly, view it on GitHub <#5 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QCLGLZRPGXDEBMONTLXOJ2MTANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

How much? I run my example on macOS with 2 4k hdr hevc videos, less than 200MB for current process, and about 700M for system decoder service.

quochuynh67 commented 12 months ago

I tested with the 4K video on pexels (each video is over 10seconds). and 2 VideoPlayerController instances are 700Mb ~ 800MB (iPhone 12 mini). This device has not crashed but others may have crashed because it is only 2048 MB limit. In Flutter, the first app run only ~200mb.

On Mon, Jul 3, 2023 at 3:05 PM WangBin @.***> wrote:

yes, my logic is that. only 2 instances at the same time, But the cost for 4K video too much, it takes memory usage … <#m2316560509911909060> On Mon, Jul 3, 2023 at 2:48 PM WangBin @.> wrote: even they can edit it, bro Because user can play to preview they editing (sticker, filter applied) … <#m4678387315127828119> Message ID: @.> Yes, but at most 2 player instances is enough for those video editors, 1 for current video, another for preloading the next video, so they don't have the problem. There is another option for you: show the thumbnail, initialize player when user requests to play, dispose when playback is not needed. — Reply to this email directly, view it on GitHub <#5 (comment) https://github.com/wang-bin/fvp/issues/5#issuecomment-1617556475>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QCLGLZRPGXDEBMONTLXOJ2MTANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @ .***>

How much? I run my example on macOS with 2 4k hdr hevc videos, less than 200MB for current process, and about 700M for system decoder service.

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1617580997, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QFXKSWV7QXNXBOIYODXOJ4LJANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 12 months ago

the master branch supports a fixed texture size, result in lower memory cost but also lower display quality

MdkVideoPlayer.registerWith({'maxWidth': 1280, 'maxHeight': 720});

But you have to know system and hardware has a limit of the max number of 4k videos.

quochuynh67 commented 12 months ago

I want to say many thanks to you for your support.

I think I need more research about it

On Mon, Jul 3, 2023 at 10:28 PM WangBin @.***> wrote:

the master branch supports a fixed texture size, result in lower memory cost but also lower display quality

MdkVideoPlayer.registerWith({'maxWidth': 1280, 'maxHeight': 720});

But you have to know system and hardware has a limit of the max number of 4k videos.

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1618658143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QAN4SLNJPE2RURFSNDXOLQIPANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

quochuynh67 commented 12 months ago

the master branch supports a fixed texture size, result in lower memory cost but also lower display quality

MdkVideoPlayer.registerWith({'maxWidth': 1280, 'maxHeight': 720});

But you have to know system and hardware has a limit of the max number of 4k videos.

I think we reduce texture is not the good way, because Texture rendering use GPU not CPU so it does not take many memory. Do you think about it?

quochuynh67 commented 12 months ago

It is so terrible :), I try to use 100x100 but the memory still pump very high. You can watch the video demo in the drive link below

Map<String, dynamic> test = {'maxWidth': 100, 'maxHeight': 100};
MdkVideoPlayer.registerWith(options: test);

https://drive.google.com/file/d/1lNCbYKg03qPpEzr0mU1RuSxPcaOAPaiR/view?usp=sharing

wang-bin commented 12 months ago

the master branch supports a fixed texture size, result in lower memory cost but also lower display quality

MdkVideoPlayer.registerWith({'maxWidth': 1280, 'maxHeight': 720});

But you have to know system and hardware has a limit of the max number of 4k videos.

I think we reduce texture is not the good way, because Texture rendering use GPU not CPU so it does not take many memory. Do you think about it?

memory is shared on mobile

wang-bin commented 12 months ago

I tested macos example, the memory increases lot in xcode, but without xcode, the memory is low, about 150MB if texture is 4k. What about using official avfoundation plugin?

wang-bin commented 12 months ago

You can enable log for the plugin and show me the full log

Logger.root.level = Level.ALL;
Logger.root.onRecrd.listen((record){ print the log});
wang-bin commented 12 months ago

when seeking the video, decoding speed is faster, so memory increases a lot. it's better to seek when stop dragging the slider

quochuynh67 commented 12 months ago

Thank you for your tip (it's better to seek when stop dragging the slider)

actually, I see you mention the decoding, what it means, and what it does. Sorry maybe My knowledge about video processing is not good

On Tue, Jul 4, 2023 at 11:17 AM WangBin @.***> wrote:

when seeking the video, decoding speed is faster, so memory increases a lot. it's better to seek when stop dragging the slider

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1619452924, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QDYD2VKTTW3KCA7JETXOOKOXANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 12 months ago

video is compressed, we need a decoder to extract uncompressed yuv or rgb images

quochuynh67 commented 12 months ago

I think we can close this issue now.

Just a last thing I want learn from you that You said VideoPlayerController.initialize is decoding the first frame => how you know that could you share me the knowledge or document, and how you know when seekTo called, it is the fast decoding

On Tue, Jul 4, 2023 at 12:18 PM WangBin @.***> wrote:

video is compressed, we need a decoder to extract uncompressed yuv or rgb images

— Reply to this email directly, view it on GitHub https://github.com/wang-bin/fvp/issues/5#issuecomment-1619507711, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJE24QB5BB4Q6GR6X5HCGZTXOORSXANCNFSM6AAAAAAZYKJTSM . You are receiving this because you authored the thread.Message ID: @.***>

wang-bin commented 12 months ago

I think we can close this issue now. Just a last thing I want learn from you that You said VideoPlayerController.initialize is decoding the first frame

The comment in official example: https://github.com/flutter/packages/blob/video_player-v2.7.0/packages/video_player/video_player/example/lib/basic.dart#L33

if initialize() finished, you can see the image, so the first frame must be decoded

how you know that could you share me the knowledge or document, and how you know when seekTo called, it is the fast decoding

seekTo will clear current frames, and start to decode from another position. if the target position is not a key frame, and you want to seekTo an accurate position, have to decode from the nearest key frame before target position and until the target position is decoded. To speed up seekTo, the decoding must be as fast as possible.

wang-bin commented 12 months ago

can you compare memory load with the official implementation(without fvp)?

wang-bin commented 12 months ago

I find many plugins in pub.dev. there is no plugin do that

I also searched pub.dev. There are many video player packages, but most of them are wrappers on official video player with custom ui, some are new player classes and you have to rewrite your code to use their apis. none of them provide a plugin for official player to support all other platforms.