On 2018-08-27, CD Projekt RED streamed base64-encoded text on their twitch channel.
This repo contains code used to decode the stream.
The file pipeline.sh
contains commands used to decode the stream.
# 1) Downloading the stream using youtube-dl:
youtube-dl.exe https://www.twitch.tv/videos/302423092 -o full_stream.mp4`
# 2) Converting the stream to images:
ffmpeg -i full_stream.mp4 -vf fps=1/10 shots/%04d.png
# 3) Building the dumb OCR program:
cargo build --release --manifest-path dec/Cargo.toml
# 4) Running OCR on images:
dec/target/release/dec > cyberpunk2077-raw.b64
# 5) Running deduplication/error correction:
ConsoleApplication69/ConsoleApplication69/bin/Debug/ConsoleApplication69.exe
# 6) Finally, decoding base64:
base64 -id < cyberpunk2077-decoded.png.b64 > cyberpunk2077-decoded.png
The source code is in dec/src/main.rs
The process used for OCR is very dumb:
- Hand-craft an alphabet of images, see
alphabet.png
- Obtain characters from the source image using a hardcoded grid (lines 37..40)
- Find which character from the alphabet has the smallest difference with current character (lines 51..61)
The source code is in ConsoleApplication69/ConsoleApplication69/Program.cs
- Throw away duplicate files
- Mark rows that appear at least twice as "legit"
- Start outputting rows
- If encountered end of current file, or "illegit" row, find a copy the last "legit row", which is followed by a "legit" row, goto step 3.
- Hacks