从FLAC创建HLS音频流 [英] Create HLS audio stream from FLAC

查看:84
本文介绍了从FLAC创建HLS音频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个FLAC文件,其中包含一首歌曲.我想创建一个质量最高的HLS流,即FLAC(匹配输入,所以只是通过但分块),然后是AAC-LC 320、160和96Kbps.

I have a FLAC file that contains a single song. I want to create a HLS stream with the best quality stream being FLAC (matching the input so just pass-through but chunked) followed by AAC-LC 320, 160 and 96Kbps.

我该怎么办?

推荐答案

以下命令是一个不错的起点:

The following command is a good point to start:

./ffmpeg -i my.flac -map 0:a -map 0:a -map 0:a -map 0:a -c:a:0 flac -c:a:1 aac -c:a:2 aac -c:a:3 aac -b:a:1 320k -b:a:2 160k -b:a:3 96k -f hls -hls_playlist_type vod -master_pl_name master.m3u8 -var_stream_map "a:0 a:1 a:2 a:3" stream_%v.m3u8

一些解释:

  • -map 0:a 将音频输入添加4次(0:a表示从第一个输入文件(0)开始的音频流)
  • -c:a:0 为每个流设置编解码器(0 = flac; aac为1 + 2 + 3)
  • -b:a:0 设置每个流的比特率(aac 320/160/96kbits为1-3)
  • -f hls ,因为您需要HLS
  • -hls_playlist_type视频以保留HLS流的所有段
  • 主播放列表的
  • -master_pl_name master.m3u8 名称(包含所有4个流)
  • -var_stream_map"a:0 a:1 a:2 a:3" 将所有4个音频流添加到输出中
  • 每个流的HLS播放列表的
  • stream_%v.m3u8 名称(对于流变体,占位符%v
  • -map 0:a adds the audio input 4 times (0:a means from the first input file (0) the audio stream)
  • -c:a:0 sets the codec for each stream (0 = flac; 1+2+3 for aac)
  • -b:a:0 sets the bitrate for each steam (1-3 for aac 320/160/96kbits)
  • -f hls because you want HLS
  • -hls_playlist_type vod to keep all segments of the HLS stream
  • -master_pl_name master.m3u8 name of the master playlist (contains all 4 streams)
  • -var_stream_map "a:0 a:1 a:2 a:3" add all 4 audio streams to the output
  • stream_%v.m3u8 name of the HLS playlist for each stream (with the placeholder %v for the stream variant

这篇关于从FLAC创建HLS音频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆