Views
1
video_vec2wav2_tokenizer, CLI command
video2dataset) that turns a folder of videos into clean AI training datasets
for speech recognition (ASR) and text-to-speech (TTS).videos ──► audio (16 kHz mono PCM) ──► whisper transcript ──► clips ──► metadata.csv / dataset.jsonl / tts_metadata.csv / report.jsonmp4 / mkv / avi / mov / webm, FFmpeg
audio extraction to mono · 16 kHz · 16-bit PCM WAV.dataset/audio/000001.wav ….metadata.csv, dataset.jsonl, tts_metadata.csv.features/train.bin + train.dat
with float32 samples, mel spectrograms, duration and sample rate.report.json with totals, durations and language distribution.train_wav2vec2.py: HuggingFace Wav2Vec2 CTC with resume,
multi-GPU, mixed precision and checkpointing.PATH.1# 1. FFmpeg (one of):
2# macOS: brew install ffmpeg
3# Ubuntu: sudo apt install ffmpeg
4# Windows: winget install Gyan.FFmpeg (or choco install ffmpeg)
5
6# 2. The package
7python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
8pip install -r requirements.txt
9pip install -e . # exposes the `video2dataset` command
10
11# Optional: training extras (torch + transformers)
12pip install -e ".[train]"1video2dataset --version
2ffmpeg -version1# Drop videos into input/videos/ (any nesting), then run the full pipeline:
2video2dataset process ./input/videos --extract-featuresdataset/:dataset/
├── audio/
│ ├── 000001.wav
│ ├── 000002.wav
│ └── ...
├── metadata.csv # 000001.wav|Hello world
├── dataset.jsonl # {"audio":"audio/000001.wav","text":"Hello world","duration":2.5}
├── tts_metadata.csv # 000001.wav|speaker_001|Hello world
└── report.json
features/
├── train.bin
└── train.dat1video2dataset process ./videos # video -> full dataset
2video2dataset transcribe ./audio # wav -> transcripts/<name>.jsonl
3video2dataset segment ./audio # wav + sidecar transcript -> clips
4video2dataset features ./dataset # clips -> features/train.{bin,dat}
5video2dataset train ./dataset # fine-tune Wav2Vec2 CTCconfig.yaml): --config, --output-dir, --device {auto,cpu,cuda}, --whisper-model, --language, -v/--verbose.1# Examples
2video2dataset process ./input/videos --whisper-model large-v3 --device cuda
3video2dataset process ./input/videos --language en --output-dir build/en
4video2dataset transcribe ./dataset/_work --device cpu
5video2dataset features ./dataset
6video2dataset train ./dataset --epochs 30 --batch-size 8 --resume1torchrun --nproc_per_node=4 -m video_vec2wav2_tokenizer.training.train_wav2vec2 \
2 --dataset-dir dataset --output-dir dataset/checkpointsconfig.yaml)1model_name: facebook/wav2vec2-base-960h # training model
2whisper_model: large-v3 # ASR model
3language: null # null = auto-detect
4device: auto # auto | cpu | cuda
5sample_rate: 16000
6channels: 1
7min_segment_length: 1.0
8max_segment_length: 20.0
9default_speaker: speaker_001
10speaker_mode: fixed # fixed | per_video | per_file
11output_dir: dataset
12features_dir: features
13num_workers: 4
14batch_size: 16speaker_mode controls TTS speaker identification: a single fixed speaker, one
per source video, or one per clip.video-vec2wav2-tokenizer/ # repo root
├── config.yaml
├── requirements.txt
├── pyproject.toml
├── README.md
├── input/videos/ # drop source videos here
└── video_vec2wav2_tokenizer/ # importable package
├── cli/ # argparse command surface
├── audio/ # FFmpeg extraction + WAV loading/resampling
├── transcription/ # faster-whisper wrapper (lazy import)
├── segmentation/ # timestamp normalisation + clip cutting
├── features/ # streaming bin/dat feature store + mel spectrograms
├── training/ # Wav2Vec2 CTC trainer
├── utils/ # config, logging, data models, IO
├── configs/ # packaged default.yaml
├── tests/ # pytest suite (no heavy deps required)
├── pipeline.py # end-to-end orchestration
├── dataset_builder.py / statistics.py
└── main.py # `python main.py` entry pointfaster-whisper, torch and transformers are
imported only when their command runs, so the core library and tests stay
light and fast.soundfile/librosa aren't installed.| File | Format |
|---|---|
metadata.csv | `000001.wav |
dataset.jsonl | {"audio":"audio/000001.wav","text":"Hello world","duration":2.5} |
tts_metadata.csv | `000001.wav |
report.json | totals, total/average duration, language distribution |
features/train.bin | flat little-endian float32: audio samples + mel per clip |
features/train.dat | JSONL index (offsets, shapes, duration, sample rate) |
1pip install -e ".[dev]"
2pytest # runs video_vec2wav2_tokenizer/tests
3pytest --cov=video_vec2wav2_tokenizer # with coveragenumpy, pyyaml and pytest — no FFmpeg,
whisper or torch required.