Datasets:
|
Download scripts/README.md from meetween/mumospee_v3: direct link, hf CLI and curl.
- Browser
- Download file 2.54 kB
-
https://huggingface.co/datasets/meetween/mumospee_v3/resolve/main/scripts/README.md
- Command line
-
hf download hf://datasets/meetween/mumospee_v3/scripts/README.md
-
curl -L -o README.md https://huggingface.co/datasets/meetween/mumospee_v3/resolve/main/scripts/README.md
2.54 kB
| # Scripts | |
| ## make_clips.py: cut the clips from source videos | |
| The dataset contains no audio. `make_clips.py` cuts the clips of the dataset from | |
| source videos that you have downloaded yourself, with the same processing that produced | |
| the dataset: | |
| 1. decode the audio track to 16 kHz mono 16-bit PCM with ffmpeg | |
| (`ffmpeg -vn -ac 1 -ar 16000 -c:a pcm_s16le`); | |
| 2. take the samples from `int(start * 16000)` to `int(end * 16000)`; | |
| 3. write them as FLAC to `<out-dir>/<audio_input_path>`. | |
| The script does not download videos. The source video of a row is | |
| `https://www.youtube.com/watch?v=<video_id>`. | |
| ### Requirements | |
| Python 3.9 or later with `pyarrow` and `soundfile`, and the `ffmpeg` program: | |
| ```bash | |
| pip install pyarrow soundfile | |
| ``` | |
| ### Usage | |
| Get the dataset rows, for example the Dutch rows of the `asr` split (files `data/asr/nl/`): | |
| ```bash | |
| huggingface-cli download meetween/mumospee_v3 --repo-type dataset \ | |
| --include "data/asr/nl/*" --local-dir mumospee | |
| ``` | |
| Cut the clips of one video: | |
| ```bash | |
| python make_clips.py --rows mumospee/data/asr/nl \ | |
| --video downloads/-H9G_NHn4Xc.mp4 --out-dir clips | |
| ``` | |
| or of all videos in a folder: | |
| ```bash | |
| python make_clips.py --rows mumospee/data/asr/nl --videos-dir downloads --out-dir clips | |
| ``` | |
| The video ID is read from the file name: `<video_id>.<ext>`, `<video_id>_<anything>.<ext>` | |
| or `<anything>[<video_id>].<ext>`; otherwise pass `--video-id`. `--rows` also accepts a | |
| CSV or JSON Lines file with the columns `video_id`, `clip_id`, `start`, `end` and | |
| `audio_input_path`. | |
| ### Output | |
| ```text | |
| clips/ | |
| ├── audio/<lang>/<video_id>/<clip_id>.flac one file per clip, at the row's audio_input_path | |
| └── make_clips_report.csv video_id, clip_id, status (written / skipped / failed), note | |
| ``` | |
| The audio of a row is `clips/<audio_input_path>`. Clips that already exist are skipped, | |
| so an interrupted run can be repeated; `--overwrite` rewrites them. | |
| ### Notes | |
| - The clips match the clips the dataset was built from when the downloaded audio is the | |
| same as the original. In a test with the original source files, 142 of 144 clips were | |
| identical sample by sample, and the other 2 differed by at most one unit in single | |
| samples (a rounding difference between ffmpeg versions). | |
| - A video downloaded at a different time or in another format can differ slightly from | |
| the original, and a video may no longer be available. | |
| - If the downloaded audio is shorter than a clip's `end`, the clip is cut at the end of | |
| the audio, and the report notes this. | |