Skip to content

Instantly share code, notes, and snippets.

@muellermartin
Created June 9, 2015 18:01
Show Gist options
  • Save muellermartin/4b1111091538efe380bd to your computer and use it in GitHub Desktop.
Save muellermartin/4b1111091538efe380bd to your computer and use it in GitHub Desktop.
Download Apple's WWDC 2015 in 1080p
#!/bin/sh
# The file containing the list of MPEG TS files
filename=8500_vod.m3u8
# The base URL containing all the MPEG TS files
baseURL=http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/vod2/8500/
# The directory where to store the MPEG TS files
# WARNING: Needs ~10 GB of disk space (and additional 10 GB for the merged file)!
tsDir=ts
# Check if download directory exists
if [ ! -d "$tsDir" ]
then
# Try to create the dir
mkdir -p "$tsDir"
# If dir creation fails exit
if [ $? != 0 ]
then
exit 1
fi
# Clean file list from previous runs
echo "" > "$tsDir/filelist.txt"
fi
# Save old path (which this script is running from) to return to it later
oldPWD=$PWD
# Change into download directory
cd "$tsDir"
# Iterate over each line in the m3u8 playlist
while read line
do
# Ignore metadata (lines beginning with '#' character)
# Only filenames are left
if [ "$(echo "$line" | cut -c1)" != "#" ]
then
# Download the file into the current directory
curl --continue-at - --remote-name "$baseURL/$line"
# Append the filename to a list needed later for merging all the files
echo "file '$line'" >> filelist.txt
fi
done < "$oldPWD/$filename"
cd "$oldPWD"
# Merge all the files to one single file
# Note: The -bsf option fixes following error with malformed AAC data
# "Malformed AAC bitstream detected: use the audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)"
ffmpeg -f concat -i "$tsDir/filelist.txt" -bsf:a aac_adtstoasc -c copy "Apple-WWDC-2015.mp4"
@muellermartin
Copy link
Author

Note: You need to download the playlist (m3u8) first e.g. from http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/vod2/8500/8500_vod.m3u8

This URL is taken out the main playlist linked in the source code of Apple's WWDC 2015 website. Here is a link to it (contains also lower qualities if you prefer them):
http://p.events-delivery.apple.com.edgesuite.net/15pijbnaefvpoijbaefvpihb06/m3u8/hls_vod_mvp.m3u8

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