【问题标题】:Create and update HLS playlist programmatically以编程方式创建和更新 HLS 播放列表
【发布时间】:2018-02-26 10:31:41
【问题描述】:

我有一个 C++ 应用程序,它从我的默认输入设备录制音频,以 AAC 格式对其进行编码并写入 .aac 文件。我想使用 HTTP Live Streaming 来直播这个 AAC 文件。根据this question,我必须创建一个FFMPEG 脚本来将我的音频文件拆分为几个.ts 文件。

# bitrate, width, and height, you may want to change this
BR=512k
WIDTH=432
HEIGHT=240
input=${1}

# strip off the file extension
output=$(echo ${input} | sed 's/\..*//' )

# works for most videos
ffmpeg -y -i ${input} -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s ${WIDTH}x${HEIGHT} -vcodec libx264 -b ${BR} -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 0 -refs 0 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate ${BR} -bufsize ${BR} -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 30 -qmax 51 -qdiff 4 -level 30 -aspect ${WIDTH}:${HEIGHT} -g 30 -async 2 ${output}-iphone.ts

(在我的情况下略有不同,因为我只处理音频)

我可以在 C++ 中以编程方式执行此操作吗?如果可以,我是否必须使用第三方库或 macOS 是否提供本机函数来执行此操作?

【问题讨论】:

    标签: macos ffmpeg http-live-streaming


    【解决方案1】:

    不,您不必拆分它(您可以将字节偏移量放入 m3u8 中),不,您不需要给我们一个 ts。 HLS 支持 .aac 文件。是的,您可以在没有库的情况下以编程方式制作 m3u8。 C++ 或任何其他编程语言都可以。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-28
      • 1970-01-01
      • 2012-06-16
      • 2014-03-10
      • 2022-01-24
      • 2021-03-22
      • 1970-01-01
      相关资源
      最近更新 更多