Skip to content

Instantly share code, notes, and snippets.

@moltak
Created March 11, 2021 00:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moltak/f5cd8ccd1dac99d64de3da5beb4203e2 to your computer and use it in GitHub Desktop.
Save moltak/f5cd8ccd1dac99d64de3da5beb4203e2 to your computer and use it in GitHub Desktop.
ffmpeg hls for audio
#!/bin/sh
BASE_URL="https://hls-test-bucket-will-be-removed.s3.ap-northeast-2.amazonaws.com/test3/"
FILE_KEY=file.key
FILE_KEY_INFO=file.keyinfo
openssl rand 16 > $FILE_KEY
echo $BASE_URL$FILE_KEY > $FILE_KEY_INFO
echo $FILE_KEY >> $FILE_KEY_INFO
echo $(openssl rand -hex 16) >> $FILE_KEY_INFO
ffmpeg -y -i $1 \
-b:a 24k \
-hls_list_size 0 \
-hls_time 4 \
-hls_base_url $BASE_URL \
-hls_key_info_file $FILE_KEY_INFO \
-hls_segment_filename "segment%03d.ts" \
$2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment