Skip to content

Instantly share code, notes, and snippets.

@hnaderi
Last active January 13, 2019 18:50
Show Gist options
  • Save hnaderi/ebd16c059a3e931c7dfd47f920f2fb60 to your computer and use it in GitHub Desktop.
Save hnaderi/ebd16c059a3e931c7dfd47f920f2fb60 to your computer and use it in GitHub Desktop.
stream all m3u8 playlist files to mp4 files using ffmpeg
#!/bin/bash
mkdir output;
for f in $2; do
output=$(echo $f| sed "s/.m3u8/.mp4/");
echo "streaming '$f' to '$output' ..."
echo from $(cat "$f" | grep -A 1 -i "$1" | tail -n 1);
ffmpeg -i "$f" -bsf:a aac_adtstoasc -vcodec copy -c copy output/"$output";
done
@hnaderi
Copy link
Author

hnaderi commented Jan 10, 2019

usage example:
./stream-to-file.sh "1280x720" "*.m3u8"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment