Skip to content

Instantly share code, notes, and snippets.

@chfoo
Created May 19, 2020 16:48
Show Gist options
  • Save chfoo/53cfd46c508993ba9c2b85c064c21748 to your computer and use it in GitHub Desktop.
Save chfoo/53cfd46c508993ba9c2b85c064c21748 to your computer and use it in GitHub Desktop.
HeartGold VOD instructions

Get the list FLV files from here using the boardcast URL http://www.twitch.tv/twitchplayspokemon/b/531310020 and http://www.twitch.tv/twitchplayspokemon/b/531783169

For each of the FLV URL, check the Wayback Machine CDX API and get the timestamp and Base32- SHA1 digest. I.E.: Get https://web.archive.org/cdx/search/cdx?url=[FLV_URL_HERE] and get the 2nd and 6th column.

Download the FLV file using the associated timestamp using this URL pattern: https://web.archive.org/web/[TIMESTAMP]id_/[URL] where [TIMESTAMP] is the timestamp from the CDX and [URL] is the URL of the FLV file.

Verify that the FLV file is not corrupt or truncated by computing the SHA1 digest with the one from the CDX API. Do not skip this step because the download may be incomplete.

Each FLV file is usually 30 minutes long. 2 FLV files can make 1 hour long YouTube video, 20 FLV files to make 10 hour video, etc. To join them, you need to remux the FLV files into a new file. Do not reencode! See this answer on how to remux using ffmpeg to a single MP4 file.

Compute an appropriate title for the video so that users can find them. The FLV URLs contain a Unix timestamp in seconds and can be used to determine when the FLV began recording. You can use this to generate a TPP timestamp (such as 5d 14h 30m) by computing the difference with the run start time of 2014-05-24T04:00:00 or 1400904000.

Upload the combined files with the appropriate title using the YouTube API.

Finally, verify that the videos and titles are correct.

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