Skip to content

Instantly share code, notes, and snippets.

@stefansundin
Last active August 20, 2021 14:19
Show Gist options
  • Save stefansundin/cf8e42e73d4e16978c119ea64d506504 to your computer and use it in GitHub Desktop.
Save stefansundin/cf8e42e73d4e16978c119ea64d506504 to your computer and use it in GitHub Desktop.
Download Twitch video that has muted sound.
#!/usr/bin/env ruby
files = Dir["*.ts"].sort_by { |fn| fn.split(".")[0].to_i }
puts "ffmpeg -i 'concat:#{files.join("|")}' -codec copy output.mkv"
puts
puts "run this first:"
puts "ulimit -n 4096"
#!/usr/bin/env ruby
# https://www.twitch.tv/videos/574519037
playlist_url = "http://dqrpb9wgowsf5.cloudfront.net/afe4f2fd56853c62507b_monstercat_37252580992_1397079807/chunked/index-muted-YE1NQ5PUXI.m3u8"
playlist_baseurl = playlist_url[0..playlist_url.rindex("/")]
File.read("index-muted-YE1NQ5PUXI.m3u8").split("\n").reject { |line| line.start_with?("#") }.each do |line|
url = if !line.start_with?("http://", "https://")
"#{playlist_baseurl}#{line}"
else
line
end
if url.end_with?("-muted.ts")
url = url[..-("-muted.ts".length+1)] + ".ts"
end
puts "wget #{url}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment