-
-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use media_kit
to play videos
#678
Comments
It works fine!
I appreciate that you reduced the library size by tightening the codec selection. However, I can no longer play some of my video/audio streams (e.g. avi, ac3). Is it possible for consuming apps to customize which codecs are bundled? Should I rebuild mpv, and then fork media_kit to point to that custom build?
|
Replacing I'll have a look at the rest. I possibly messed up the |
I did enable AVI. Something seems missing. EDIT: An AVI sample I grabbed does play. |
My bad, I was imprecise: the AVI container I tried contained an Edit: from libmpv logs:
For me |
You can create your own builds for libmpv + FFmpeg + media_kit by:
|
I picked the FFmpeg configuration from fijkplayer; kind of surprising things are different. Still, you have the freedom. |
I customized the FFmpeg config for Aves, so it's not the same as the basic fijkplayer. |
Interesting. For the note, you won't need image encoders for screenshot; we are encoding pixel-buffer with package:image. |
I noticed that the screenshot function is a tad slow. Not a big deal, but maybe it's because you use |
It runs on The performance isn't really crucial for screenshots (not at all). When we want hardware-level performance at the time of rendering, we don't even use pixel buffers. |
I was not talking about native in the sense of FFI, but rather to use Android JPEG encoder instead of the slow |
The performance gain from using the Android JPEG encoder may be lesser than sending pixel-buffer across platform-channels/FFI & then receiving back encoded image buffer.
|
do you have a sample mkv that is unplayable that you would be willing to share? I have not been able to replicate the issue. |
Hi! Apologies for the day; catching up again.
I think it's all green now. This update will make a lot of things better (especially for Android). As for decoders/demuxers: I noticed I had some of these videos. I don't think anything else is left... I also added Microsoft's msmpeg* & wmv*. Chromium's Audio/Video page also has theora specified (even though our selection is far bigger); which I missed. Still... I have attached full variants to the release above; in-case you want them instead. |
I monitored the I can make it use a native C/C++ JPEG/PNG encoder based on stb_image if you wish. pixel-buffer = 57ms
pixel-buffer = 21ms
pixel-buffer = 35ms
pixel-buffer = 36ms
pixel-buffer = 34ms
pixel-buffer = 33ms
pixel-buffer = 30ms
pixel-buffer = 39ms
pixel-buffer = 30ms
pixel-buffer = 41ms
JPEG = 525ms
JPEG = 489ms
JPEG = 442ms
JPEG = 481ms
JPEG = 385ms
JPEG = 369ms
JPEG = 381ms
JPEG = 425ms
JPEG = 451ms
JPEG = 403ms
PNG = 2679ms
PNG = 3392ms
PNG = 3211ms
PNG = 2814ms
PNG = 2713ms
PNG = 2759ms
PNG = 2559ms
PNG = 2156ms
PNG = 2394ms
PNG = 2441ms |
What kind of additional metadata are you exactly looking for? |
Am i looking for additional metadata? What makes you ask this? At this stage, the last hurdle with your library is that the first frame of each video is a plain solid color frame, but that aside I'm quite happy with your library! |
I mean why do you require separate FFmpeg or IJK? Yeah, I also saw that issue on Android. I thought it was resolved after this:
EDIT: To be honest, increasing the delay to be slightly higher can be best solution for now (you can provide me with a value). My device doesn't show solid color frame anymore. For the cause, initially |
Aves shows stream details, etc. It's not just a viewer. I don't mind the delay, but couldn't the surface be transparent while it's initializing? |
You mean that solid color is black (or ?) |
I mean it should be possible to show stream details within media_kit. There's a large list of properties: |
No, it depends on the video. When the player initializes, it shows as the first frame a solid color which can be pink, brown, purple, etc. It seems derived from the video, and it's always the same color for a given video.
Maybe it's possible with MPV, but I didn't see an API in your package to retrieve the same info as I get from ffprobe. Also, I don't need it now but ffmpeg kit could allow Aves to edit videos someday. |
Just try to increase that delay & provide me with a value that works fine. That will avoid that first glitchy frame. I personally don't see that first uni-color 1x1 texture frame after that delay. |
I'd be really glad if we're able to avoid package:ffmpeg_kit_flutter. Is it really a good deal for it's size? You can download mpv on your macOS/PC & try out different properties/options, I think you'll find something relevant (if not all, certainly to some extent). |
I am just a consumer of |
It won't really take much effort from my end to expose an API that allows listening to native property changes like we already provide an API to make native property changes. It'd be up to you whichever you wish to listen to & display (but you have to find them out). The ultimate goal of Now things mostly work... improving performance for other platforms & some features like caching etc. are still in interest. Our new Android support has been well-tested by your project & now it is at its sweet spot. This stability can now be enjoyed by others, that's open-source. From a personal usage stand-point, I only created package:media_kit for my music app & wasn't even going to add video support. Lastly, public contributions are also welcomed :) At your project level, you may even consider forking our media-kit/libmpv-android-video-build & create a build that dynamically links to FFmpeg (instead of static, like we have to avoid conflicts). Then, you can use that "shared" FFmpeg to query metadata (while it'll be used by media_kit too). With our compilation optimizations in-place, the resulting bundle size is also decent (~5 MB for ARM64). |
Few more updates on my part: For allowing you to listen to custom properties. import 'package:media_kit/media_kit.dart';
Future<void> main() async {
MediaKit.ensureInitialized();
final player = Player();
await (player.platform as NativePlayer).observeProperty(
'demuxer-cache-state',
(data) async {
print(data);
},
);
await player.open(Media('https://user-images.githubusercontent.com/28951144/229373695-22f88f13-d18f-4288-9bf1-c3e078d83722.mp4'));
} Fixed support for AV1. For retrieving video, audio & subtitle streams data.
|
(originally explored as part of #555)
The good:
The bad:
often fails to load the first frame of local videos (cf [Android] First frame is sometimes a solid color media-kit/media-kit#339)v1.1.1
+ ffmpeg_kit
v5.1.0-LTS (min)
v1.1.1
+ ijk
only
The text was updated successfully, but these errors were encountered: