【问题标题】:HTTP Live Streaming not working with GStreamerHTTP Live Streaming 不适用于 GStreamer
【发布时间】:2018-07-25 20:36:23
【问题描述】:

我正在尝试使用 GStreamer 通过 HTTP 创建一个实时流。我对 HLS 接收器使用了以下命令:

gst-launch-1.0 videotestsrc is-live=true pattern=snow ! x264enc ! mpegtsmux ! hlssink max-files=5

没有错误或警告。生成的tsm3u8 文件位于src/main/resources/videos。此文件夹是 Maven 项目的一部分,该项目还包含一个 Jetty 服务器。这是主要的类:

public class Main {
    private static final int PORT = 1778;
    private static final String RESOURCE_BASE = "./src/main/resources";
    private static final String WELCOME_FILE = "index.html";

    public static void main(String[] args) throws Exception {
        final Server jettyServer = new Server(PORT);

        final ResourceHandler resourceHandler = new ResourceHandler();

        resourceHandler.setDirectoriesListed(true);
        resourceHandler.setWelcomeFiles(new String[]{WELCOME_FILE});
        resourceHandler.setResourceBase(RESOURCE_BASE);

        final HandlerList handlers = new HandlerList();
        handlers.setHandlers(new Handler[] { resourceHandler, new DefaultHandler() });
        jettyServer.setHandler(handlers);

        try {
            jettyServer.start();
            jettyServer.join();
        } finally {
            jettyServer.stop();
            jettyServer.destroy();
        }
    }
}

还有src/main/resources/index.html 文件:

<!DOCTYPE html>
<html>
  <body>
    <video src="./videos/playlist.m3u8" controls="" autoplay="" width="960" height="540"></video>
  </body>
</html>

当我启动服务器时,我在 Safari 上看到以下屏幕(图片没有改变): ts 文件已正确生成,playlist.m3u8 已成功找到(否则播放器会出错)。为什么我没有收到默认雪花图案的直播?

如果相关,我在OS X Yosemite 10.10.5 上运行它,Safari 版本是Version 10.1 (10603.1.30.0.34)

【问题讨论】:

    标签: java jetty gstreamer http-live-streaming


    【解决方案1】:

    尝试强制使用特定的 H.264 配置文件。如果您不这样做,videotestsrcx264enc 可能会就解码器不支持的格式达成一致。

    ... x264enc ! video/x-h264, profile=main ! mpegtsmux ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-01
      • 2017-04-20
      • 2014-01-21
      • 2015-01-12
      • 1970-01-01
      • 2013-02-18
      相关资源
      最近更新 更多