mrmaffen / vlc-android-sdk

VLC Android SDK pushed to Maven Central. Primarily used in project tomahawk-android.
792 stars 244 forks source link

How to enable and check if hardware acceleration is working? #130

Closed guybridge closed 2 years ago

guybridge commented 6 years ago

Hi,

I am using library version: de.mrmaffen:libvlc-android:2.1.12@aar on Android for streaming multicast streams and it's working fine however if the stream is a HD (1080p) stream there is considerable lag in the stream (pixels, jitter and lag)

The application is for an Android TV - If I try to connect to the multicast stream udp://239.1.1.114:1234 on the local network using the latest version of VLC from Google Play - there is no lag at all. Also if I use my laptop with VLC the stream is fine.

This is my code for the options setup;

`ArrayList options = new ArrayList<>(); options.add("--http-reconnect"); options.add("--network-caching=5000"); options.add("--avcodec-hw=any"); // Doesn't appear to do anything

        // Create the player
        libVLC = new LibVLC(context, options);
        mediaPlayer = new MediaPlayer(libVLC);

        //Create the media
        media = new Media(libVLC, AndroidUtil.LocationToUri(mediaUri));
        media.addOption(":network-caching=4096");
        media.addOption(":avcodec-hw=any"); // Doesn't appear to do anything

        mediaPlayer.setMedia(media);

        // Setup the surface
        surface = surfaceHolder.getSurface();
        vout = mediaPlayer.getVLCVout();
        vout.setVideoSurface(surface, surfaceHolder);
        vout.setWindowSize(Utils.getDisplaySize(context).x, Utils.getDisplaySize(context).y);
        vout.attachViews();`

As you can see i'm adding the options twice so one goes into the constructor and also the media options.

How do I check if the hardware acceleration is working on the TV?

I tried to add this: :avcodec-hw=any but it didn't do anything.

Thanks

JorgeABS commented 6 years ago

Hi, I´m having the same problem.

But tell-me, do you have fond a way to play a direct stream from youtube?

In the latest version of VLC from Google Play, is working perfect, but in the library version: de.mrmaffen:libvlc-android:2.1.12@aar, the stream starts, but no image view.

Maybe we can help each-other.

Do you have try to recompile direct from source? https://code.videolan.org/videolan/vlc-android

I have try to recompile, but my knowledge in linux is not very good, and a lot of sings in the tutorial just don´t work (: .

Tanks.

guybridge commented 6 years ago

What if you try with this version: implementation 'de.mrmaffen:vlc-android-sdk:3.0.0'

JorgeABS commented 6 years ago

Yes, but the result is the same.

What is the best version, supposedly the 3.0.0 is the latest version, no?

Why are you using the 2.1.12?

guybridge commented 5 years ago

I was using 2.1.12 because I get this error:

/lib/x86/libvlcjni.so: has text relocations

When I try to play a stream with 3.0.0. Since then I've actually gone back to 2.0.6 because I found that subtitles don't work in 2.1.12@arr

danielawde9 commented 5 years ago

m.setHWDecoderEnabled(true,true)