HTTP Live Streaming 不适用于 GStreamer

HTTP Live Streaming not working with GStreamer

我正在尝试使用 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 服务器。这是主要的 class:

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)

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

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