--- license: other task_categories: - video-classification - reinforcement-learning language: - en tags: - gaming - computer-use - screen-recording - behavior-cloning - video - events - lance pretty_name: gaming-500-hours-lance size_categories: - n<1K --- # Gaming 500 Hours (Lance Format) A Lance-formatted version of [markov-ai/gaming-500-hours](https://huggingface.co/datasets/markov-ai/gaming-500-hours) — **776 gameplay screen-recording sessions (494.7 hours, 168 games)** with whole-session MP4 video stored inline as Lance **blob v2** columns, plus **57.5 million frame-aligned input and system events** exploded into a fully queryable table — available directly from the Hub at `hf://datasets/lance-format/gaming-500-hours-lance/data`. Each session ("workflow") is native PC/console gameplay trimmed to pure gameplay at 30fps CFR H.264, with every mouse move, click, drag, scroll, window change, and system event aligned to the exact video frame it occurred in. That alignment is what makes this bundle interesting: you can query 57.5M events with SQL, pick a moment, and seek the corresponding video to that millisecond through a lazy blob handle — without downloading the session's multi-gigabyte MP4. ## Key features - **Whole-session MP4 bytes** in the `video` column of `train.lance`, stored with Lance **blob v2** (file format 2.2): each video lives in its own dedicated `.blob` file inside the dataset and is surfaced as a lazy, seekable `BlobFile` handle via `take_blobs`. Metadata scans, search, and filtering never read a byte of video. - **57.5M frame-aligned events** in `events.lance` with typed columns (`type`, `frame`, `video_t_ms`, `x`, `y`, `button`, `app_name`, …) plus the full original JSON payload — every event knows its video frame and video-relative millisecond. - **Raw event streams preserved**: the original `events.json` and `frame_events.json` NDJSON files ride along as blob v2 columns, so nothing from the source dataset is lost. - **Pre-built indices** — `INVERTED` (FTS) on session titles and descriptions, `BITMAP`/`BTREE`/`LABEL_LIST` scalar indices on both tables — ship inside the Lance directories. - **Rich session metadata**: game, platform, tags, duration, event counts, frame counts, fps, screen resolution, and SHA-256 checksums for every video. > **Format note.** This dataset is written with Lance file format **2.2** and uses the blob v2 storage scheme. Reading requires a recent Lance stack — `pylance >= 8.0` (blob v2 APIs) and `lancedb >= 0.34`. The 🤗 `datasets` library's Lance integration does not read format 2.2 yet; load through LanceDB or pylance as shown below. ## Splits | Table | Rows | What it is | |---|---|---| | `data/train.lance` | 776 | One row per gameplay session: metadata scalars + `video`, `events`, `frame_events` blob columns | | `data/events.lance` | 57,548,204 | One row per frame-aligned event, exploded from `frame_events.json` | `train.lance` is the primary table; `events.lance` is a derived view of the same sessions keyed by `workflow_id`, so the two join cleanly. Both tables are written as a single commit (version 1) with large fragments — `train.lance` is one fragment, `events.lance` is 55 fragments of ~1M rows. The full bundle is ~1.5 TB, dominated by the video blobs. ## Schema ### `train.lance` — sessions | Column | Type | Notes | |---|---|---| | `workflow_id` | `string` | Unique session id (joins to `events.lance`) | | `game` | `string` | Game title, 168 distinct (e.g. `Valorant`, `Minecraft`) | | `category` | `string` | Always `gaming` in this release | | `platform` | `string` | `windows` (489.3h) or `macos` (5.3h) | | `title` | `string` | Human-written session title (FTS-indexed) | | `description` | `string` | Session summary (FTS-indexed) | | `tags` | `list` | Free-form labels incl. `risk:*` and `conf:*` annotations | | `duration_min` / `duration_ms` | `float64` / `int64` | Session length (median 24 min, max 457.7 min) | | `event_count` | `int64` | Number of aligned events in the session | | `num_frames` | `int64` | Video frame count (30fps CFR) | | `fps` | `float64` | Frames per second derived from the frame timeline | | `screen_width` / `screen_height` | `int32` | Primary display resolution at recording time | | `source_path` | `string` | Original `{game-slug}/{workflow_id}` path in the source repo | | `video_size_bytes` | `int64` | MP4 size (median ~1 GB, max 29 GB) | | `video_sha256` | `string` | Checksum of the MP4 bytes | | `events_size_bytes` / `frame_events_size_bytes` | `int64` | Raw NDJSON sizes | | `video` | blob v2 | Whole-session MP4; dedicated `.blob` file, lazy `take_blobs` access | | `events` | blob v2 | Original `events.json` NDJSON (timestamps rebased to the clip timeline) | | `frame_events` | blob v2 | Original `frame_events.json` NDJSON (one line per video frame) | ### `events.lance` — frame-aligned events | Column | Type | Notes | |---|---|---| | `workflow_id` | `string` | Session id (joins to `train.lance`) | | `game` | `string` | Denormalized game title for one-table filters | | `frame` | `int64` | Video frame index the event belongs to | | `video_t_ms` | `float64` | Video-relative time in milliseconds | | `t_in_frame_ms` | `float64` | Offset within the frame | | `type` | `string` | `mouse_move`, `drag`, `click`, `scroll`, `active_app`, `window_moved`, `screen_config`, … | | `timestamp` | `float64` | Original event timestamp (epoch ms) | | `x` / `y` | `float64` | Pointer position (mouse events) | | `screen` | `int32` | Screen index (multi-monitor sessions) | | `button` | `string` | Mouse button for click/drag | | `click_count` | `int32` | Click multiplicity | | `is_down` | `bool` | Press vs. release | | `pressure` | `float64` | Pointer pressure | | `delta_x` / `delta_y` | `float64` | Scroll deltas | | `app_name` / `bundle_id` | `string` | Foreground application | | `window_title` | `string` | Window title when reported | | `browser_url` | `string` | URL for browser-focused events | | `payload` | `string` | JSON of any remaining type-specific fields (battery, wifi, screens list, …) | ## Pre-built indices `train.lance`: - `INVERTED` (FTS) on `title` and `description` — keyword search over sessions - `BITMAP` on `game`, `platform`, `category` · `LABEL_LIST` on `tags` · `BTREE` on `workflow_id`, `duration_ms`, `event_count` `events.lance`: - `BITMAP` on `type`, `game`, `app_name` · `BTREE` on `workflow_id`, `frame`, `video_t_ms` No vector index is bundled — the source dataset ships no embeddings. The Evolve section shows how new columns (including embeddings computed locally) can be added without rewriting the video blobs. ## Why Lance? 1. **Blazing Fast Random Access**: Optimized for fetching scattered rows, making it ideal for random sampling, real-time ML serving, and interactive applications without performance degradation. 2. **Native Multimodal Support**: Store text, embeddings, and other data types together in a single file. Large binary objects are loaded lazily, and vectors are optimized for fast similarity search. 3. **Native Index Support**: Lance comes with fast, on-disk, scalable vector and FTS indexes that sit right alongside the dataset on the Hub, so you can share not only your data but also your embeddings and indexes without your users needing to recompute them. 4. **Efficient Data Evolution**: Add new columns and backfill data without rewriting the entire dataset. This is perfect for evolving ML features, adding new embeddings, or introducing moderation tags over time. 5. **Versatile Querying**: Supports combining vector similarity search, full-text search, and SQL-style filtering in a single query, accelerated by on-disk indexes. 6. **Data Versioning**: Every mutation commits a new version; previous versions remain intact on disk. Tags pin a snapshot by name, so retrieval systems and training runs can reproduce against an exact slice of history. ## Load with LanceDB LanceDB is the embedded retrieval library built on top of the Lance format ([docs](https://lancedb.com/docs)), and is the interface most users interact with. It wraps both tables as queryable handles with search and filter builders, and is the entry point used by the Search, Curate, Evolve, Train, Versioning, and Materialize-a-subset sections below. ```python import lancedb db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") sessions = db.open_table("train") events = db.open_table("events") print(len(sessions), len(events)) ``` ## Load with Lance `pylance` is the Python binding for the Lance format and works directly with the format's lower-level APIs. Reach for it when you want to inspect dataset internals — schema, scanner, fragments, the list of pre-built indices — or when you need the blob-level `take_blobs` entry point that streams video bytes lazily out of blob storage. ```python import lance ds = lance.dataset("hf://datasets/lance-format/gaming-500-hours-lance/data/train.lance") print(ds.count_rows(), ds.schema.names) print([idx["name"] for idx in ds.list_indices()]) ``` > **Tip — for production use, download locally first.** Streaming from the Hub works for exploration, but heavy random access, FTS, and video decoding are far faster against a local copy. The full bundle is ~1.6 TB (the video blobs dominate), so consider starting with the Materialize-a-subset pattern at the end of this card instead of a full download: > ```bash > hf download lance-format/gaming-500-hours-lance --repo-type dataset --local-dir ./gaming500 > ``` > Then point Lance or LanceDB at `./gaming500/data`. ## Search Session discovery starts with the bundled FTS index. Titles and descriptions are human-written summaries of what happens in each session, so a keyword query over them is an effective way to find gameplay of a particular kind without touching any video bytes. The `INVERTED` index on `description` makes this a sub-second call even from the Hub mount. ```python import lancedb db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") sessions = db.open_table("train") hits = ( sessions.search("ranked competitive multiplayer", query_type="fts", fts_columns="description") .select(["workflow_id", "game", "title", "duration_min"]) .limit(10) .to_list() ) for r in hits: print(f"{r['game']:<20} {r['duration_min']:7.1f} min | {r['title'][:60]}") ``` The same table supports plain SQL filtering through the scalar indices, and both can be combined — a keyword query post-filtered to one platform, for example: ```python long_windows_sessions = ( sessions.search("boss fight", query_type="fts", fts_columns="description") .where("platform = 'windows' AND duration_min > 60", prefilter=True) .select(["workflow_id", "game", "title"]) .limit(10) .to_list() ) ``` ## Curate Curation in this dataset usually means finding *moments*, not just sessions — and that is what the `events.lance` table is for. Because every event carries its `workflow_id`, `frame`, and `video_t_ms`, a SQL filter over 57.5M events produces an explicit list of video-addressable moments. The `BITMAP` index on `type` and `BTREE` on `workflow_id` keep these scans cheap. ```python import lancedb db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") events = db.open_table("events") clicks = ( events.search() .where("game = 'Valorant' AND type = 'click' AND is_down", prefilter=True) .select(["workflow_id", "frame", "video_t_ms", "x", "y", "button", "app_name"]) .limit(500) .to_list() ) print(f"{len(clicks)} click moments") ``` To look at what actually happened on screen at one of those moments, pull the session's video through pylance's `take_blobs`. With blob v2, each MP4 lives in its own dedicated `.blob` file, and `take_blobs` returns a seekable, file-like `BlobFile` — a decoder can seek straight to the event's timestamp and read only the bytes it touches, even though the session file may be tens of gigabytes. ```python import lance sessions_ds = lance.dataset("hf://datasets/lance-format/gaming-500-hours-lance/data/train.lance") moment = clicks[0] row = ( sessions_ds.scanner( columns=["workflow_id"], filter=f"workflow_id = '{moment['workflow_id']}'", with_row_id=True, ) .to_table() .to_pylist()[0] ) blob = sessions_ds.take_blobs("video", ids=[row["_rowid"]])[0] ``` Each `BlobFile` implements the file protocol, so it can be passed straight to PyAV without copying the clip through a `bytes` object first. Seeking to the click's `video_t_ms` decodes a handful of packets, not the whole session: ```python import av with av.open(blob) as container: stream = container.streams.video[0] target_s = moment["video_t_ms"] / 1000.0 container.seek(int(target_s / stream.time_base), stream=stream) frame = next(f for f in container.decode(stream) if f.time is not None and f.time >= target_s) frame.to_image().save("click_moment.png") ``` The raw NDJSON event streams are also one `take_blobs` call away (`events` and `frame_events` columns) for pipelines that prefer to parse the original files. ## Evolve Lance stores each column independently, so new columns append without rewriting existing data — including the video blob files, which stay exactly where they are. The lightest form is a SQL expression over existing columns. The example below adds an actions-per-minute measure and a session-length bucket, both of which are immediately usable in `where` clauses. > **Note:** Mutations require a local copy, since the Hub mount is read-only. See Materialize-a-subset at the end of this card, or the `hf download` tip above. ```python import lancedb db = lancedb.connect("./gaming500/data") # local copy required for writes sessions = db.open_table("train") sessions.add_columns({ "apm": "event_count / duration_min", "length_bucket": ( "CASE WHEN duration_min < 15 THEN 'short' " "WHEN duration_min < 60 THEN 'medium' ELSE 'long' END" ), }) ``` Labels or predictions computed offline — quality scores from a VLM pass over sampled frames, per-session skill ratings, safety annotations — merge in by joining on `workflow_id`: ```python import pyarrow as pa labels = pa.table({ "workflow_id": pa.array(["770970bc-9bf1-4275-90f7-74081578ae46"]), "skill_rating": pa.array([0.87]), }) sessions.merge(labels, on="workflow_id") ``` The original columns, indices, and blob files are untouched, and readers that do not reference the new columns are unaffected. The same pattern is how you would attach video embeddings computed locally (e.g. by decoding sampled frames through a video encoder) and then build an `IVF_PQ` index over them for similarity search. ## Train Gameplay sessions feed two different kinds of training. Input-behavior models (action prediction, behavior cloning, UI-interaction agents) train directly on the typed event stream — no video decoding required. Video models typically pre-extract decoded frame windows once into a derived Lance table and train against that; `take_blobs` is what makes that extraction pass tractable, since each session MP4 is randomly addressable and the pass can decode windows on demand without an external file store. In both cases the training loop itself is the same permutation-API dataloader; only the source table and the column list change. The permutation API separates *what to read* from *how to order it*. A permutation table defines splits, filtering, and shuffle order over a base table without copying any data; the `Permutation` object then fulfills the PyTorch map-style `Dataset` contract, reading only the projected columns in the permuted order. ```python import lancedb from lancedb.permutation import Permutation, permutation_builder from torch.utils.data import DataLoader db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") events = db.open_table("events") # Build a shuffled 95/5 train/eval permutation over all click events. perm_tbl = ( permutation_builder(events) .filter("type = 'click'") .split_random(ratios=[0.95, 0.05], split_names=["train", "eval"], seed=42) .shuffle(seed=42) .execute() ) train_ds = ( Permutation.from_tables(events, perm_tbl, split="train") .select_columns(["game", "frame", "video_t_ms", "x", "y", "button", "is_down"]) .with_format("python") ) loader = DataLoader( train_ds, batch_size=512, num_workers=4, multiprocessing_context="spawn", # Lance is not fork-safe persistent_workers=True, collate_fn=lambda rows: rows, ) for batch in loader: ... # your training step ``` `select_columns(...)` is the lever: only the projected columns are read per epoch, and columns added in Evolve cost nothing until you opt in. The permutation table itself is tiny (row ids and split ids), and the same `perm_tbl` with `split="eval"` yields the held-out loader with an identical, reproducible shuffle. > **Scale note.** Building a split/shuffled permutation sorts the selected row ids under a bounded memory pool in current `lancedb`, which caps the *filtered* selection at a few million rows (the click subset above is ~800k and works directly against the Hub). To shuffle a larger slice — say all 43.8M `mouse_move` events — materialize that slice into a local table first (see Materialize a subset) and build the permutation there. The identity permutation below has no such limit: it streams the full 57.5M-row table without a sort. For a session-level loader — curriculum construction, per-session statistics, or driving a frame pre-extraction pass — the identity permutation over `train.lance` is enough: ```python sessions = db.open_table("train") session_ds = ( Permutation.identity(sessions) .select_columns(["workflow_id", "game", "duration_ms", "num_frames", "fps"]) .with_format("python") ) loader = DataLoader(session_ds, batch_size=8, collate_fn=lambda rows: rows) ``` The video blobs deliberately stay out of these loaders. Whole-session MP4s are the wrong unit for a training batch; the pre-extraction pattern (decode sampled windows once, write a derived frames table, train on that with the exact same `Permutation` snippet) is the shape that scales, and the Curate section shows the `take_blobs` + PyAV seek mechanics that the extraction pass is built from. ## Versioning Every mutation to a Lance dataset — adding the `apm` column, merging labels, building an index — commits a new version, and previous versions remain intact with their blob handles still valid. Versions and tags can be listed directly against the Hub copy; creating tags is a write and needs a local copy. ```python import lancedb db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") sessions = db.open_table("train") print("Current version:", sessions.version) print("Tags:", sessions.tags.list()) ``` Once you have a local copy, pin a snapshot by name and reopen it later: ```python local_db = lancedb.connect("./gaming500/data") local_sessions = local_db.open_table("train") local_sessions.tags.create("baseline-v1", local_sessions.version) pinned = local_db.open_table("train", version="baseline-v1") ``` Pinning supports both directions of reproducibility: a training run recorded against `baseline-v1` can be rerun later against exactly the same 776 sessions regardless of columns added since, and an evaluation service can keep serving a stable snapshot while curation continues on the head version. ## Materialize a subset Reads from the Hub are lazy, so exploratory queries transfer only the columns and row groups they touch. But mutations (Evolve, tags) need a writable store, and a training loop is happiest with local data. At 1.6 TB, downloading everything is rarely the right first move — instead, stream a filtered projection into a local LanceDB table. `.to_batches()` returns a record-batch reader, so the rows flow directly from the Hub into the local table without materializing in Python memory. ```python import lancedb remote_db = lancedb.connect("hf://datasets/lance-format/gaming-500-hours-lance/data") remote_events = remote_db.open_table("events") batches = ( remote_events.search() .where("game = 'Minecraft' AND type IN ('click', 'drag', 'scroll')") .select(["workflow_id", "frame", "video_t_ms", "type", "x", "y", "is_down", "button"]) .to_batches() ) local_db = lancedb.connect("./gaming500-subset") local_db.create_table("minecraft_events", batches) ``` The resulting `./gaming500-subset` is a first-class LanceDB database: every Evolve, Train, and Versioning snippet above works against it by swapping the connection path. Videos are best pulled per-session rather than in bulk — the `take_blobs` pattern in Curate fetches exactly the sessions your subset references, and `video_sha256` lets you verify each transfer. ## Citation This is a format conversion of [markov-ai/gaming-500-hours](https://huggingface.co/datasets/markov-ai/gaming-500-hours). Please credit the original dataset: ``` @misc{markovai2026gaming500, title = {Gaming Dataset (gaming-1) — 494.7 Hours}, author = {Markov AI}, year = {2026}, url = {https://huggingface.co/datasets/markov-ai/gaming-500-hours} } ``` ## License Content inherits the original dataset's terms; no explicit license is declared upstream. Review the [source dataset card](https://huggingface.co/datasets/markov-ai/gaming-500-hours) before downstream use.