【问题标题】:I want to create a HLS (HTTP Live Streaming) Stream using Gstreamer but Audio only我想使用 Gstreamer 创建 HLS(HTTP Live Streaming)流,但仅使用音频
【发布时间】:2017-04-20 02:04:36
【问题描述】:
我想做的是从alsa soundcard 输入中创建一个m3u8-file。
喜欢:
arecord hw:1,0 -d 10 test.wav | gst-launch-1.0 ....
我试过这个进行测试:
gst-launch-1.0 audiotestsrc ! audioconvert ! audioresample ! hlssink
但它不起作用。
感谢您的帮助。
【问题讨论】:
标签:
gstreamer
alsa
http-live-streaming
m3u8
gst-launch
【解决方案1】:
您不能直接从音频原始源创建 HLS 视频传输段 (.ts)。您需要使用一些编码器对其进行编码,然后在发送到 hlssink 插件之前对其进行复用。
您会遇到的一个问题是 hlssink 插件不会仅使用音频流分割片段,因此您将需要类似 keyunitsscheduler 之类的东西来正确分割流并创建文件。
使用 voaacenc 对音频进行编码并将 mpegtmux 编码为 mux 的示例管道如下:
gst-launch-1.0 audiotestsrc is-live=true ! audioconvert ! voaacenc bitrate=128000 ! aacparse ! audio/mpeg ! queue ! mpegtsmux ! keyunitsscheduler interval=5000000000 ! hlssink playlist-length=5 max-files=10 target-duration=5 playlist-root="http://localhost/hls/" playlist-location="/var/www/html/hls/stream0.m3u8" location="/var/www/html/hls/fragment%05d.ts"