ScottishHaze commited on
Commit
1980aa2
·
verified ·
1 Parent(s): 0c0cc88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +55 -21
README.md CHANGED
@@ -11,44 +11,78 @@ language:
11
  - en
12
  pretty_name: Speaker Identification Toolkit
13
  ---
14
- # Speaker Identification Toolkit (Speaker Diarization)
15
 
16
- This repository contains Python scripts for processing audio and video files, focusing on speaker diarization, speaker identification, audio extraction, and dataset creation. These tools leverage `ffmpeg`, `pyannote.audio`, and other Python libraries for efficient and accurate processing.
17
 
18
  ## Workflow
19
 
20
- 1. **Extract Audio from Videos**:
21
- Use `dataset-creation.py` to extract English audio tracks from video files.
22
 
23
- 2. **Generate Speaker Diarization Data**:
24
- Use `diarize-dataset.py` to process the extracted WAV files and generate JSON files containing diarization data.
25
 
26
- 3. **Identify Target Speaker**:
27
- Use `identify-speaker.py` to play audio segments from diarization files and map the target speaker interactively.
28
 
29
- 4. **Isolate and Trim Target Speaker Audio**:
30
- Run `isolate-trim.py` to extract and trim the target speaker's audio segments for dataset creation.
31
 
32
  ## Dependencies
33
 
34
- Ensure you have the following installed:
35
 
36
- - Python 3.8+
37
-
38
- - `ffmpeg`:
39
- Install `ffmpeg` via your system's package manager or [official site](https://ffmpeg.org/).
40
 
41
  ## Configuration
42
 
43
- The script will automatically create the folders it needs, pause for users to populate them with data, or proceed without prompt if they're already populated.
44
 
45
  - **Video Input Directory**: `base-folder/videos`
46
  - **WAV Output Directory**: `base-folder/wavs`
47
  - **JSON Output Directory**: `base-folder/jsons`
48
- - **Speaker Mapping File**: `base-folder/scripts/mappings.csv`
49
  - **Processed Speaker Output Directory**: `base-folder/targeted`
50
 
51
- **Additionally:**
52
-
53
- - For `diarize-dataset.py`, set the Hugging Face API token in the script manually for faster, prompt-free processing. Insert it between the final set of quotes on line 29.
54
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
  - en
12
  pretty_name: Speaker Identification Toolkit
13
  ---
14
+ # Speaker Identification Toolkit
15
 
16
+ This repository provides a comprehensive toolkit for processing audio and video files, with a focus on speaker diarization, speaker identification, audio extraction, and dataset creation. By leveraging tools like `ffmpeg`, `pyannote.audio`, and other Python libraries, the scripts enable efficient and accurate workflows for handling audio data.
17
 
18
  ## Workflow
19
 
20
+ ### 1. Extract Audio from Videos
21
+ Use `dataset-creation.py` to extract English audio tracks from video files.
22
 
23
+ ### 2. Generate Speaker Diarization Data
24
+ Run `diarize-dataset.py` to process the extracted WAV files and produce JSON files containing diarization data.
25
 
26
+ ### 3. Identify Target Speaker
27
+ Execute `identify-speaker.py` to play audio segments from diarization files and interactively map the target speaker.
28
 
29
+ ### 4. Isolate and Trim Target Speaker Audio
30
+ Use `isolate-trim.py` to extract and trim the target speaker's audio segments, preparing them for dataset creation.
31
 
32
  ## Dependencies
33
 
34
+ Ensure the following are installed:
35
 
36
+ - **Python 3.8+**
37
+ - **ffmpeg**: Install via your system's package manager or from the [official site](https://ffmpeg.org/).
 
 
38
 
39
  ## Configuration
40
 
41
+ The scripts automatically create necessary directories and pause execution for users to populate them with required data. Ensure the following directory structure is in place:
42
 
43
  - **Video Input Directory**: `base-folder/videos`
44
  - **WAV Output Directory**: `base-folder/wavs`
45
  - **JSON Output Directory**: `base-folder/jsons`
46
+ - **Speaker Mapping File**: `base-folder/scripts/speaker_mapping.csv`
47
  - **Processed Speaker Output Directory**: `base-folder/targeted`
48
 
49
+ ### Notes
50
+
51
+ - For `diarize-dataset.py`, you can set the Hugging Face API token directly in the script for prompt-free operation. Replace the placeholder value in the following line:
52
+ ```python
53
+ default="your_hugging_face_token"
54
+ ```
55
+ - Verify directory paths and ensure all dependencies are installed to avoid runtime issues.
56
+
57
+ ## Extended Description
58
+
59
+ ### 1. `dataset-creation.py`
60
+ - **Description**: Extracts English audio tracks from video files and converts them to mono 16-bit PCM WAV format.
61
+ - **Key Features**:
62
+ - Processes video files in `.mp4` and `.mkv` formats.
63
+ - Automatically names output files using a sequential naming convention.
64
+ - **Dependencies**: `rich`, `ffmpeg`
65
+
66
+ ### 2. `diarize-dataset.py`
67
+ - **Description**: Processes WAV files to generate JSON files containing speaker diarization data.
68
+ - **Key Features**:
69
+ - Leverages Hugging Face's `pyannote.audio` for diarization.
70
+ - Outputs JSON files with timestamps and speaker labels.
71
+ - **Dependencies**: `pyannote.audio`, `rich`
72
+
73
+ ### 3. `identify-speaker.py`
74
+ - **Description**: Plays audio segments from diarization files to help users identify and map the target speaker for isolation.
75
+ - **Key Features**:
76
+ - Interactive selection of the target speaker.
77
+ - Maintains a CSV file to map diarization files to speakers.
78
+ - **Recommendations**:
79
+ - Listen to multiple segments to confirm the target speaker, as segments may contain mixed audio.
80
+ - If a mistake occurs, update the CSV file to correct mappings.
81
+ - **Dependencies**: `playsound`, `rich`, `pandas`, `ffmpeg`
82
+
83
+ ### 4. `isolate-trim.py`
84
+ - **Description**: Extracts and trims audio segments of the target speaker, splitting them into smaller clips if necessary.
85
+ - **Key Features**:
86
+ - Isolates diarized segments for the target speaker.
87
+ - Trims silence and ensures clips are 30 seconds or shorter.
88
+ - **Dependencies**: `rich`, `pandas`, `ffmpeg`