Skip to content

Instantly share code, notes, and snippets.

@patrickgill
Last active March 28, 2024 17:50
Show Gist options
  • Star 25 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save patrickgill/130bf9eaa76138596137c7234e80f339 to your computer and use it in GitHub Desktop.
Save patrickgill/130bf9eaa76138596137c7234e80f339 to your computer and use it in GitHub Desktop.
download m3u8 ts segments, then decode, join, and remux them! (HTTP Live Streaming TS files)
# download
aria2c -x 5 -i file.m3u8
# decode (example)
openssl aes-128-cbc -d -K 15D0F46608409DA364E3F5D92BDE9F61 -iv 00000000000000000000000000000000 -nosalt -in G00000000.ts -out G00000000.d.ts
# join all ts files
cat *.ts > out.ts
# convert ts output file
# This will re-encode the video and stream copy the audio:
# ffmpeg -i input -c:v libx264 -c:a copy -bsf:a aac_adtstoasc output.mp4
ffmpeg -i d_out.ts-vcodec copy -acodec copy -bsf:a aac_adtstoasc d_out.mp4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment