Skip to content

Problem playing 4k streaming video

I'm trying to include the vlc-player in my application based on the vlc-android code provided with the purpose of playing SD, HD and 4K streaming channels, including a zapping application overlay. As I only need the vlc-player, I did not include any of the visual components (like reproduction bar or similars). So I only created my player, based on libvlc and mediaplayer components. It can play SD and HD without any problems, but I'm unable to get it to reproduce 4K. When I choose a 4K channel, after loading, the sound starts and I only get a black background.

When I try to play any 4K channel in the vlc-android application using MediaUtils.openmedia(), the video is played without problems. So I don't understand why I can't get it working in my app.

I included the code below.

private void createPlayer(){
    ArrayList<String> options = new ArrayList<>();
    options.add("--audio-time-stretch");
    options.add("--avcodec-skiploopfilter");
    options.add("1");
    options.add("--avcodec-skip-frame");
    options.add("--avcodec-skip-idct");
    options.add("--stats");
    options.add("--audio-resampler");
    options.add("soxr");
    options.add("--audiotrack-session-id=29");
    options.add("-vv");

    libVLC = new LibVLC(parentContext, options);
    
    mediaPlayer = new MediaPlayer(libVLC);
    mediaPlayer.setAudioDigitalOutputEnabled(true);
    mediaPlayer.setAudioOutput("opensles_android");
    mediaPlayer.attachViews(vlcVideoLayout, null, false, false);
}

private void startPlayback(String uri){
    MediaWrapper mw = new MediaWrapper(Uri.parse(finalUri));
    mw.setType(MediaWrapper.TYPE_STREAM);

    Media media = new Media(libVLC, mw.getUri());
    mediaPlayer.setMedia(media);
    mediaPlayer.play();
}

I included some logs in this txt file.logs_vlc.txt. I didn't find any difference between our app and vlc-android app regarding to errors, warnings, etc.

Furthermore, I tried a method ( Media.setHWDecoderEnabled(false, false) ) in order to disable HW acceleration. With this approach, I've got only one frame in the screen but the video never started.

Finally, the conditions are the same in both environments - in terms of vlc libraries versions and also android dependencies.

I would appreciate any help. Maybe I'm missing something or doing something wrong. Thanks in advance.

Versions

  • libvlcVersion 3.2-eap3
  • medialibraryVersion 0.5-eap3
  • minSdkVersion = 23
  • targetSdkVersion = 28
  • Java 1.8
  • NDK r10e
  • Android version 6.0.1
Edited by Angel Rodriguez