1

我从vlcj 示例页面运行此示例代码。我进入http://127.0.0.1:5555浏览器和VLC 播放器,但没有显示任何内容。

public class StreamHttp extends VlcjTest {
public static void main(String[] args) throws Exception {
    if(args.length != 1) {
        System.out.println("Specify a single MRL to stream");
        System.exit(1);
    }

    String media = args[0];
    String options = formatHttpStream("127.0.0.1", 5555);

    System.out.println("Streaming '" + media + "' to '" + options + "'");

    MediaPlayerFactory mediaPlayerFactory = new MediaPlayerFactory(args);
    HeadlessMediaPlayer mediaPlayer = mediaPlayerFactory.newHeadlessMediaPlayer();
    mediaPlayer.playMedia(media, options);

    // Don't exit
    Thread.currentThread().join();
}

private static String formatHttpStream(String serverAddress, int serverPort) {
    StringBuilder sb = new StringBuilder(60);
    sb.append(":sout=#duplicate{dst=std{access=http,mux=ts,");
    sb.append("dst=");
    sb.append(serverAddress);
    sb.append(':');
    sb.append(serverPort);
    sb.append("}}");
    return sb.toString();
}

}

4

1 回答 1

0
  • 使用options= ":sout=#transcode{vcodec=h264,vb=56,venc=x264{profile=baseline},fps=12,width=176,height=144,acodec=mp3,ab=24,channels=1,samplerate=44100}:http{mux=ffmpeg{mux=flv},dst=:8080/" 您可以在 VLC->stream 功能中查找更多选项字符串

  • 传递一个有效的 mrl。

于 2017-06-16T16:44:05.913 回答