anindyamitra2002/Indic-ASR-Transcript-Generator

This repo helps to transcript indic languages and generate a specific xml

1

stars

7

commits

Python

primary language

Jul 13, 2024

updated

README

Indic-ASR-Transcript-Generator

This repository contains a pipeline for audio transcription and diarization using wav2vec2 and whisper. The pipeline processes audio files, splits them into chunks, performs transcription and diarization (on whole audio), and merges the results into a single XML file.

Table of Contents

Prerequisites

  • Python 3.8 or higher
  • mp3splt: For windows, you need to install mp3splt (2.6.2) from here.
  • ffmpeg: Use this blog to install it.

Installation

  1. Clone the repository:

    git clone https://github.com/anindyamitra2002/Indic-ASR-Transcript-Generator.git
    cd Indic-ASR-Transcript-Generator
    
  2. Install the required packages:

    pip install -r requirements.txt
    

Usage

Running the Pipeline

The main entry point for running the pipeline is the run_pipeline function. This function handles the entire process from splitting the audio into chunks to merging the XML results. But before running the pipeline you need to follow some step to get the average silence duration in the input or extracted audio. This is optional when you want to split the line in transcript based on the silence threshold.

  1. Calculate the average silence duration (optional):

    1. The following commands will generate a logfile. For more info refere this docs. If you have any input video then you need to extract the audio using utils\mp3_converter.py.
    cd utils
    path C:\Program Files (x86)\mp3splt;%PATH% 
    mp3splt -s -p th=-35,min=0.4,rm=50_50,trackjoin=2.5 <your-input-mp3-filepath> -o @f-@n -d ./temp
    
    1. Run utils\avg_silence.py to get the average silence duration from the logfile.

    2. Edit line 49 of xml_creation.py and line 92 of xml_merger.py by replacing the threshold time with the new duration threshold.

  2. Running the Pipeline: Edit following variables before running the pipeline. Keep your input videos/audios in a subfolder (named with the language) within video directory.

    video_input = "path/to/your/video.mp4" # .\videos\english\Video.mp4
    audio_dir = "path/to/audio/output" # .\audios
    lang = "language" # english
    json_dir = "path/to/json/output" # .\transcripts\jsons
    transcript_xml_dir = "path/to/xml/output" # .\transcripts\xmls
    chunk_length_s = 30 # chunk length in seconds 
    

    After setting all the parameters run the wav2vec2_pipeline.py file.

Contributors

anindyamitra2002/Indic-ASR-Transcript-Generator

This repo helps to transcript indic languages and generate a specific xml

1

stars

7

commits

Python

primary language

Jul 13, 2024

updated

README

Indic-ASR-Transcript-Generator

This repository contains a pipeline for audio transcription and diarization using wav2vec2 and whisper. The pipeline processes audio files, splits them into chunks, performs transcription and diarization (on whole audio), and merges the results into a single XML file.

Table of Contents

Prerequisites

  • Python 3.8 or higher
  • mp3splt: For windows, you need to install mp3splt (2.6.2) from here.
  • ffmpeg: Use this blog to install it.

Installation

  1. Clone the repository:

    git clone https://github.com/anindyamitra2002/Indic-ASR-Transcript-Generator.git
    cd Indic-ASR-Transcript-Generator
    
  2. Install the required packages:

    pip install -r requirements.txt
    

Usage

Running the Pipeline

The main entry point for running the pipeline is the run_pipeline function. This function handles the entire process from splitting the audio into chunks to merging the XML results. But before running the pipeline you need to follow some step to get the average silence duration in the input or extracted audio. This is optional when you want to split the line in transcript based on the silence threshold.

  1. Calculate the average silence duration (optional):

    1. The following commands will generate a logfile. For more info refere this docs. If you have any input video then you need to extract the audio using utils\mp3_converter.py.
    cd utils
    path C:\Program Files (x86)\mp3splt;%PATH% 
    mp3splt -s -p th=-35,min=0.4,rm=50_50,trackjoin=2.5 <your-input-mp3-filepath> -o @f-@n -d ./temp
    
    1. Run utils\avg_silence.py to get the average silence duration from the logfile.

    2. Edit line 49 of xml_creation.py and line 92 of xml_merger.py by replacing the threshold time with the new duration threshold.

  2. Running the Pipeline: Edit following variables before running the pipeline. Keep your input videos/audios in a subfolder (named with the language) within video directory.

    video_input = "path/to/your/video.mp4" # .\videos\english\Video.mp4
    audio_dir = "path/to/audio/output" # .\audios
    lang = "language" # english
    json_dir = "path/to/json/output" # .\transcripts\jsons
    transcript_xml_dir = "path/to/xml/output" # .\transcripts\xmls
    chunk_length_s = 30 # chunk length in seconds 
    

    After setting all the parameters run the wav2vec2_pipeline.py file.

Contributors

Languages

Python

99.1%