-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Drop frames problem fps is very bad #134
Comments
please show me the log following issue template |
Experiencing the same issue on Windows. I am using the Player low level object and showing the texture:
And even with a bare bone UI (nothing else but the player's texture) I get severe frame dropping compared to the vanilla Flutter player. Here's the logs although, ignore the buffering my internet was a bit unstable at that moment: https://pastebin.com/VczcUvV7 I also have a sample to showcase the issue: Aurora.Media.Center.2024-09-07.11-48-07.-.Trim.mp4 |
In case it's not clear enough in the sample, here you have another player at the top and FVP at the bottom. You can clearly see the dropped frame after slowing down the footage Timeline.1.mov |
flutter's rendering performance is very poor, comparing to my Qt examples, higher cpu and gpu load, lower fps. It's texture api for native plugins is not good enough, we can't know the rendering context used by flutter gui, so in fvp I create another context to render video. but it's impossible to sync 2 contexts in fvp without knowing flutter's context, so if flutter does not handle resource synchronization correctly(I guess yes), you will see tearing. You can download libmdk and run What is vanilla Flutter player? |
THE PROBLEM IN ANDROID TV, |
I need the log, otherwise I can't help |
is there a way to fix this? for example adding a buffer for the texture synchronisation?
I mean the basic VideoPlayer component in Flutter. It does not have the chopiness issue
OK so I tried it. It does work much better but I think. See the footage. First half is MDK, second half is MPV. BTW there is an issue in glfwplay.exe I think because cli options (like adding a video URL or adding -log all) don't do anything, so unfortunately I wasn't able to get any log. Timeline.1.mov |
Impossible to fix tearing issue. Must fix in flutter side.
which platform?
I run commands in msys2, then log will print to msys2 terminal. If no msys2, you can add |
It's not a tearing issue, the issue is frame dropping / stuttering. And when using the Flutter Video_player or Media_kit packages instead, there's no issues at all, that's why I think it comes from the FVP package (not MDK lib itself, just the way the binding to Flutter is). Also see for the terminal, if I run the command, the terminal detaches: |
I see tearing in #134 (comment)
|
No it's not tearing, I superposed two video. The top half is MPV, the bottom half is MDK |
I edit the screenshot. Do you mean there are 2 players in your recorded video, top left triangle is mpv, bottom right triangle is mdk? What I see is tearing at diagonal. |
yes correct that is it |
Be sure to specify the texture size in the updateTexture(width, heigth) method. |
I see thanks, I am assuming that only is relevant when the viewport is not 4k |
try master branch, and set max texture size as screen size or smaller registerWith(options: {
'maxWidth': screenWidth,
'maxHeight': screenHeight,
}); |
Screen.Record_2024-09-08-03-29-28.mp4Look drops in the apk test |
4k live Android mobile Screen.Record_2024-09-08-03-32-55.mp4 |
Same Channel 4k working good in vlc player Screen.Record_2024-09-08-03-35-16.mp4 |
Yes. Flutter is not the best choice for a video application. It copies each frame to his own scene. This is a very large volume of more than 9Mb for a 2000x1200 screen. |
It had no effect.
In Flutter:
In this case, there are no lags. Unfortunately, I can't build such an option in release mode. |
I think this is the important point. Every players uses the same technique I think but only the MDK-flutter one seems to have the lags. I think there might just be a bug rather than a hard Flutter limitation. |
Maybe it has some meaning. There is a constant message in the logs, similar to missed frames. But I do not know exactly what it means. W/vulkan (10596): vkAcquireNextImageKHR: non-infinite timeouts not yet implemented |
any news ? |
Well, this is not a package issue. |
There was something strange. |
thanks for your information. I guess the reason is audio time is not accurate. Can you test other platforms? |
On Windows, deleting the audio decoder has no result.
|
for android, use the latest libmdk via environment var |
Mr Wang-Bin this build: Working good in android can you do this build in pub.dev to use it ?! |
in a few days |
I hope to not forget it 🥇 thank you. |
try 0.27.0 |
thank you so mush i will try it and back to you soooooon |
Today's nightly build of libmdk works fine on android. But sourceforge did not allow it to be downloaded for several days. I gave the assembly for apple to all requests. And the auto-upload during the build loads the version from 30.08 on which the frames are lost. |
Perfect Job Mr Wang Bin, thank you so mush bro i respect you job its very good <3 |
Thanks! On Android, FHD does work well indeed but 4K is impossible (despite being able to play 4k with other players). I noted two things: On my phone (where playback is choppy) I have these logs in loop:
is it normal? On my Nvidia Shield, the playback does not start in 4k (but works well in FHD). The app just crash. Here are the logs. The timeout and "stop called" are repeated until it crashes completely (I hear 1sec of sound, and no image).
|
@azukaar it's using software decoder instead of hardware decoder, performance will be poor. can you show me the complete log so i can know what happens? your phone log repeats several times, it's weird. https://github.com/wang-bin/mdk-examples/blob/master/flutter/simple/lib/main.dart you can use this example to test, logging is enabled there. |
can you show me 4k playback log? you can use this example to test: |
@wang-bin thanks for your answer, it is weird that it's using the software decoder, I am doing
i was assuming that registerWith without decoder would select the default decoders for each platform (at least that's what I see in the code). Also in the logs I can see that it selected FFmpeg as decoder no? Here are the logs on the phone when playing the 4k video: https://pastebin.com/u589xTYh |
If you are using backend api, you have to set hardware decoders manually like this https://github.com/wang-bin/fvp/blob/v0.27.0/lib/src/video_player_mdk.dart#L149-L158 and https://github.com/wang-bin/fvp/blob/v0.27.0/lib/src/video_player_mdk.dart#L220 btw, the latest release add more features in VideoPlayerController via extension, so we can reuse video_player code with most of backend api features, and no need to add configurations like video_player_mdk.dart(e.g. hardware decoder). see https://pub.dev/documentation/fvp/latest/fvp/FVPControllerExtensions.html |
I have the same problem, github actions can download them, I don't know why.
?
for macos and ios, increasing mdk version in fvp.podspec will download libmdk again, but there's no new libmdk release, so you have to clean up cocoapods cache |
OK that makes sense, it works now, the only last issue I am having is the crash on the NVidia Shield with the 4k video and the log I posted before. I'll create a different ticket for it |
I do not know exactly what kind of problem soruceforge has. I go to the nightly builds page, click download mdk-sdk-android.7z and... It is being downloaded mdk-sdk-apple.zip . |
I your libmdk.so, libmdk.so.dsym, and crash info from logcat, run
before playing a video, when crash occurs, wait a few seconds then |
Here's the latest log from my NVidia shield with 0.27, it seems to mostly work but I still have choppy playback (subtle but present lags every few seconds) Here are the logs for info: https://pastebin.com/69ia7J81
|
it's using hardware decoder, but many frames are dropped in renderer. what about disabling audio tracks: player.activeAudioTracks=[] ? |
Same results with no audio: https://pastebin.com/MAkhz9X5
|
@azukaar try master branch code and send me log again, audio can be enabled. |
This is the log after a few secs of playback : https://pastebin.com/WYeucfsJ
Does this mean that 18 frames have been dropped in total? If yes it does not match what I see on screen, I can clearly see many more frame drops that do not increment that value. Sometime even the sound stutters what about when FPS goes < 24, could it be what I see? 23.7 is very close to 24 FPS, but if the frames are dropped instead of drawn, it could be what I see no? The thing is my Windows PC also goes to 23.9 FPS but has no visible stutter so probably not the issue |
signal-2024-10-25-115738.mp4Here's a sample, you can see there is 2 significant frame drops in this short 5sec clip (slow motioned 50%) |
hi dear,
i have problem with fvp drop frames on android (mobile, tv) im trying to use AMediaCodec and FFmpeg but his give me same results frame drops i test it in: XIAOMI MI BOX S2 (Android), And mobile RED MAGIC 6, Poco x3 Pro, Tecno Spark 8 tecno spark 10 pro, give me same results, drop frames in LIVE M3u8, and Movies MP4, MKV
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000 and the pakage is com.poppycorn.rax.poppycorn
I/AudioTrack(21381): AudioTrack::setVolume L:1.000000 R:1.000000
I/AudioTrack(21381): AudioTrack::setVolume L:1.0
The log note give me anything about dropframes
The text was updated successfully, but these errors were encountered: