SKY-SCRAPER is a small Flask app plus two processing scripts for turning selected regions of a video into a PDF.
It is designed for videos where a small control area changes when the content changes. The app lets you pick:
- A start time and stop time.
- A crop region to extract from each selected frame.
- A control region used to detect when a frame is novel.
When processing runs, the script saves cropped frames to tmp/, then buildpdf.py compiles those images into out.pdf.
- Open the web UI and load
static/vid.mp4. - Choose the start and stop timestamps.
- Draw the crop rectangle.
- Draw the control rectangle.
- Send the selection to the backend.
- Run
process.pyto extract frames. - Run
buildpdf.pyto pack the extracted images into a PDF.
main.py: Flask server that serves the UI and writescrop.cfg.templates/index.html: video selection page.static/main.js: front-end interaction logic for timestamps and rectangles.static/style.css: basic page styling.process.py: extracts cropped frames from the configured video range.buildpdf.py: converts extracted JPEGs intoout.pdf.crop.cfg: generated selection data.tmp/: generated cropped frame images.
- Python 3.14+
- Flask
- OpenCV
- Pillow
- tqdm
Install dependencies with your preferred tool, for example uv sync if you are using uv.
Put the source video at static/vid.mp4.
Run:
python main.pyOpen the app in your browser, select the start/stop times, crop area, and control area, then click Send.
This writes the current selection to crop.cfg.
Run:
python process.pyThis will:
- Clear and recreate
tmp/. - Read
crop.cfg. - Scan the video between the selected start and stop times.
- Save cropped frames only when the control region is considered novel.
Run:
python buildpdf.pyThis creates out.pdf from the images in tmp/.
process.pyuses a similarity threshold (SIMILARITY_THRESHOLD = 0.97) to decide whether a control frame is new.buildpdf.pycurrently places up to 6 images per A4 page.- The selected rectangles are stored in video pixel coordinates, not canvas coordinates.
- The workflow is intentionally manual because fully automatic extraction is unreliable across arbitrary videos.
crop.cfg: selected timestamps and rectangles.tmp/frame-*.jpg: cropped frames.out.pdf: final compiled document.