QmlVlc icon indicating copy to clipboard operation
QmlVlc copied to clipboard

QmlVlc on Android framerate

Open mzafers opened this issue 10 years ago • 48 comments

Hello RSATom. I try to use QmlVlc on Android. I have a dual core 1Ghz tablet. VLC.apk can play fullHD video. But QmlVlc cannot. I think hardware acceleration mode is not enabled. I search VLC parameters, I found that:

const char _argv[] = {"-I", "dummy", "-vvv", "--no-drop-late-frames", "--codec", "iomx,all"}; size_t argc = sizeof(argv) / sizeof(_argv); return libvlc_new(argc, argv);

If I set that parameters in QmlVlcConfig.cpp file, tablet can play fullHD video low fps and some freeze. Do you know how to play a fullHD video on QmlVlc like VLC.apk? What are the best parameters? Any idea?

mzafers avatar Nov 12 '14 15:11 mzafers

Sorry, I didn't test it on android. I even don't have any android device to try.

RSATom avatar Nov 12 '14 15:11 RSATom

btw, do you use VlcPlayer or VlcMmPlayer? if you use VlcPlayer, then try VlcMmPlayer, it could help, but I don't sure.

RSATom avatar Nov 12 '14 15:11 RSATom

I've tried both of them. But I'm gonna try again VlcMmPlayer.

mzafers avatar Nov 12 '14 15:11 mzafers

btw, don't use "-vvv" option - it enables debug mode, and could affect performance.

RSATom avatar Nov 12 '14 15:11 RSATom

I just tried VlcMmPlayer. Same result. Yes you're right, "-vvv" enables debug mode. I removed it. The parames are now: const char *argv[] = {"-I", "dummy", "--no-drop-late-frames", "--codec", "iomx,all"};

mzafers avatar Nov 12 '14 15:11 mzafers

It seems QmlVlc needs some optimizations for android platform...

RSATom avatar Nov 12 '14 15:11 RSATom

Hello again RSATom. I spend too much time to solve this issue. But I couldnt yet. void QmlVlcVideoOutput::video_display_cb function is triggered well on android device. So, libvlc can decode all frames. But the render mechanism is too slow maybe and seems frame lost on the screen. What is the difference between desktop opengl and android opengl, do you know? Must I modify opengl code section for android? What function must be modified? Do you have any idea? Thank you.

mzafers avatar Dec 16 '14 12:12 mzafers

Android devices just much less powerful than any desktop platform, and if on desktop decoding frame to memory and after that transfer to video memory is fast enough for smooth playback, on android device it could be much worse. One possible solution, I think, could be decoding video frame directly to opengl framebuffer and use it as texture, but don't know haw good my guess is. Maybe it will be better look to vlc for android sourses to find way it uses, and use something similar...

RSATom avatar Dec 16 '14 14:12 RSATom

btw, did you try to use QtMultimedia (i.e. without QmlVlc at all)? Does it has acceptable performance?

RSATom avatar Dec 17 '14 06:12 RSATom

Yes, I tried 1080p videos on QtMultimedia QML Video element. It plays perfect on tablet. I checked vlc android sources, but it seems simple. It uses libvlc's display methods. I didnt find any opengl code section. I checked QtMultimedia sources also, it's too complicated. I checked opengl shaders code section. It's too hard to find the reason.

mzafers avatar Dec 17 '14 08:12 mzafers

Sorry, don't know how to help you... I even don't have any android device to test it on...

Do you really need QmlVlc if QtMultimedia work good?

RSATom avatar Dec 17 '14 08:12 RSATom

QtMultimedia cannot play http and rtsp streams, some video formats. If I rebuild QtMultimedia gstreamer with streaming feature, I can use that.

mzafers avatar Dec 17 '14 11:12 mzafers

Understand... I'm afraid I can't help you, at least this time, maybe later but don't know when exactly... Sorry.

RSATom avatar Dec 17 '14 11:12 RSATom

Hello, I've been trying to configure qmlvlc demo to compile to android devices with QT5.4 with no luck. I want to play a video stream from the raspberry pi in tablet. The problem with qtmultimedia is that it uses the android native player and this player don't support h264 high profile. At this time android player only support h264 baseline profile and raspberry pi can not stream it. The transcoding option is discarded due the power of the raspberry.

I'm new in android development. I followed these steps:

  • https://wiki.videolan.org/AndroidCompile/:
  • Download / Install Android SDK
  • Download / Install Android NDK
  • Exported the paths
  • Exported the abi (export ANDROID_ABI=armeabi-v7a)
  • Download VLC (git clone git://git.videolan.org/vlc-ports/android.git)
  • Compile VLC (sh compile.sh release)
  • Create SDK (make .sdk ) => Fail. I have to build it manually copying the folders manually
  • In QT Creator:
  • I copied the generated sdk to the project folder. At this point, how can I link the android vlc sdk to QT Creator? I tried something like: X86{ LIBS += -lvlc } else{ LIBS += -Landroid/vlc-sdk/src/org/videolan/libvlc/libVLC.java } but doesn't work. There are a los of errors like: QmlVlcConfig.o:QmlVlcConfig.cpp:function QmlVlcConfig::createLibvlcInstance(): error: undefined reference to 'libvlc_new'

Anyone can help me?

Thank you.

Mikelgate avatar Jan 11 '15 12:01 Mikelgate

Are you really need QmlVlc? It needs to be optimized for android before.

RSATom avatar Jan 11 '15 13:01 RSATom

I would like to try and help its development if I can.

Mikelgate avatar Jan 11 '15 15:01 Mikelgate

I will be glad if you will try. But, unfortunately, I couldn't help you with any android related questions - Maybe somebody else will... Please keep me informed about progress. Thanks!

RSATom avatar Jan 11 '15 16:01 RSATom

Hi friends. I follow different way on Android and it's done. I've integrated LibVLC into QtMultimedia source, modified original java files, compiled it. I created a hybrid system. After compiling, I just copy modified jar files into my "C:\Qt\5.4\android_armv7\jar" directory. It means I can use original QML elements in my QML project on Android. I can use original MediaPlayer or modified MediaPlayer. It's too easy. If I add ":VLC" suffix to MediaPlayer.source it uses QtMultimediaWithLibVLC at backend, otherwise it uses original QtMultimedia. So, QtMultimedia on Android is powerful now. I want to share it with Qt friends, but I have no time. I will. And dear Tom, I worked LibVLC QML project on desktop. It's a small project and uncompleted yet. It uses widget hwnd to display. Can I create a different repo for this?

mzafers avatar Apr 03 '15 07:04 mzafers

@mzafers, it's great! And I would like to see how you did it.

Can I create a different repo for this?

I don't understand. Why do you ask me? You free to do anything you like :)

RSATom avatar Apr 03 '15 07:04 RSATom

Ok :) I will do some cosmetics (clean some output logs) for QtMultimediaVLC on Android and share it. Maybe name is "QtMultimediaVLC". In fact, I did try Vitamio integration before. I did it, but I faced an issue about hardware acceleration modules releasing. It can play first attempt fine, but if I release mediaPlayer and create again it cannot play with hardware acceleration mode. And then I decided to work on LibVLC.

And my second job is LibVLC QML for desktop. I couldn't find a name for it. It's tiny and uncompleted yet.

mzafers avatar Apr 03 '15 08:04 mzafers

Btw, on what hardware did you test it? And how smooth was playback?

RSATom avatar Apr 03 '15 08:04 RSATom

I've Samsung 7" T230 tablet and LG G2 Mini mobile phone. I tested bigbuckbunny 1080p 30fps video. It plays fine. If VLC application can play then QtMultimediaVLC can play. Same result.

mzafers avatar Apr 03 '15 08:04 mzafers

How do you think, is it possible achieve same result with QmlVlc? Do you know what exactly wrong with it?

RSATom avatar Apr 03 '15 09:04 RSATom

I think, EGLImage method can do that. It's hard to implement it.

mzafers avatar Apr 03 '15 09:04 mzafers

So the bottleneck in QmlVlc is copy decoded frame from memory to video memory?

RSATom avatar Apr 03 '15 10:04 RSATom

Yes it is. I see that, glTexImage2D / glTexSubImage2D functions work slow.

mzafers avatar Apr 03 '15 10:04 mzafers

It was predictable... Thank you for info.

RSATom avatar Apr 03 '15 10:04 RSATom

@mzafers mzafers

Can you please tell what you have done?

sk2212 avatar Jun 16 '15 12:06 sk2212

Hi. I've downloaded VLC Android and QtMultimedia source, copied VLC java files into QtMultimedia dirs, added them to jar project, modified QtMultimedia's own java files and compiled jar.pro only. It generates 2 jar files. (QtMultimedia.jar and QtMultimedia-bundled.jar) I copied them into C:\Qt\5.4\android_armv7\jar dir. I cannot create my own repo yet about this project.

mzafers avatar Jun 16 '15 14:06 mzafers

[removed]

sk2212 avatar Jun 16 '15 14:06 sk2212