0

I have a C++ application that records audio from my default input device, encodes it in AAC format and writes to a .aac file. I want to use HTTP Live Streaming to live stream this AAC file. According to this question, I have to create a FFMPEG script to split my audio file into several .ts files.

# 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

(It is slightly different in my case because I only work with audio)

Can I do so programmatically in C++ and if so, do I have to use a third-part library or does macOS provide native functions to do so ?

Pierre P.
  • 1,055
  • 2
  • 14
  • 26

1 Answers1

0

No, you don’t have to split it (you can put byte offsets into the m3u8) and no you don’t need to us a ts. HLS supports .aac files. Yes you can programmatically make an m3u8 without a library. C++ or literally any other programming language is capable.

szatmary
  • 29,969
  • 8
  • 44
  • 57