caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.1k stars 260 forks source link

During loop play, the screen is briefly black each time you switch to the next one. #1205

Closed Curtaingit closed 7 months ago

Curtaingit commented 7 months ago

There will be no black screen on computers that support hardware acceleration, But computers that don't support hardware acceleration (and don't have a separate graphics card) will have a black screen

Whether I can optimize it by direct software decoder ?(on computers without a separate graphics card), but I can't find the parameter Settings for this.

I wanted to simulate this on the developer machine by disabling hardware decoding but this parameter doesn't seem to work.

public class MyEmbeddedMediaPlayerComponent extends EmbeddedMediaListPlayerComponent {

    private static String[] libvlcArgs = new String[] {"--no-xlib", "--avcodec-hw=none"};

    @Override
    protected String[] onGetMediaPlayerFactoryExtraArgs() {
        return libvlcArgs;
    }
}
Curtaingit commented 7 months ago
vlc 3.8.0
java 1.8
vlc 3.0.8
Curtaingit commented 7 months ago
        mediaPlayerComponent.getMediaPlayer().addMediaPlayerEventListener(new MediaPlayerEventAdapter() {
  @Override
            public void finished(MediaPlayer mediaPlayer) {

                SwingUtilities.invokeLater(() -> {
                    // 列表循环播放
                        if (mrlList.size() == 1) {
                            mediaPlayer.setRepeat(true);
                        } else {
                            if (++playIndex >= mrlList.size()) {
                                playIndex = 0;
                            }
                            mediaPlayer.prepareMedia(mrlList.get(playIndex));
                            playingMrl = mrlList.get(playIndex);
                            mediaPlayer.play();
                        }
               });
          }
 });
caprica commented 7 months ago

You should really not be using the --no-xlib switch.

What is the actual question here? How to disable hardware decoding? If so, that is a VLC question and not a vlcj question.

If you do "vlc -H" in a command-prompt/terminal window, have a look for any relevant switches.

Curtaingit commented 7 months ago

Back to the core issue, I want to check whether the specified software decoding is supported, because some devices do not have the condition of hardware decoding, resulting in a delayed black screen every time the playback is switched again.

caprica commented 7 months ago

There is no way through LibVLC/vlcj to check any hardware device capabilities.

Generally speaking, VLC will pick the "best" values for video output/decoding etc.

Curtaingit commented 7 months ago

Since I'm new to VLC, I'm not very clear on the core parts. There is a black screen for one second when switching video playback, but this problem now only exists on devices without a separate graphics card. So I was wondering if there was an initiative to specify the decoding method to optimize the loading speed of the next video after the completion of one video. Of course this is just my idea, or if there are other optimization ways to solve this problem. Because there is no search for the relevant problem situation on the Internet, so I came to vlcj/github.

Curtaingit commented 7 months ago

https:forum.videolan.org/viewtopic.php?f=14&t=163540&p=540959&hilit=black%20screen#p540959

It seems to be a problem inherent in VLC itself, I will look for other ways to try to solve it without vlc.

caprica commented 7 months ago

Sure, it's no problem to raise the issue here, but as you've found out there wasn't really anything could be done in vlcj here.

caprica commented 2 months ago

(deleted comment, posted to wrong issue)