Qwen3-ASR-Toolkit Documentation

repository·main·Indexed 21 days ago

https://github.com/qwenlm/qwen3-asr-toolkit

A high-performance Python CLI tool for transcribing long-form audio and video files using the Qwen-ASR API. It utilizes Voice Activity Detection (VAD) to split media into chunks for parallel processing, bypassing API duration limits. Features include support for local files and remote URLs, context-guided recognition, and the ability to generate timestamped SRT subtitle files.

Tokens
897
Snippets
6
Records
7
Agent score
26%

What's inside Qwen3-ASR-Toolkit

  1. Install Qwen3-ASR-Toolkit from source

    main

    To install the latest development version from the repository:

    1. Clone the repository.
    2. Install the package using pip from the root directory.
    # Clone the repository
    git clone https://github.com/QwenLM/Qwen3-ASR-Toolkit.git
    cd Qwen3-ASR-Toolkit
    
    # Install the package
    pip install .
  2. Configure the DASHSCOPE_API_KEY environment variable

    main

    The toolkit requires a DashScope API key from Alibaba Cloud. While you can pass it via the --dashscope-api-key flag, it is highly recommended to set it as an environment variable named DASHSCOPE_API_KEY for security and convenience.

    # On Linux/macOS
    export DASHSCOPE_API_KEY="your_api_key_here"
    
    # On Windows (Command Prompt)
    set DASHSCOPE_API_KEY="your_api_key_here"
    
    # On Windows (PowerShell)
    $env:DASHSCOPE_API_KEY="your_api_key_here"
  3. Customize transcription with context and chunk duration

    main

    You can improve recognition of specific jargon using the --context (-c) flag and control the granularity of subtitles by adjusting the --vad-segment-threshold (-d) flag.

    qwen3-asr -i "/path/to/my/tech_talk.mp4" -c "Qwen-ASR, DashScope, FFmpeg" -d 60 -srt
  4. Generate SRT subtitles with qwen3-asr

    main

    To generate both a plain text transcript (.txt) and a timestamped subtitle file (.srt), use the --save-srt or -srt flag. The files will be saved in the same directory as the input file.

    qwen3-asr -i "/path/to/my/documentary.mp4" -srt
  5. Reference: qwen3-asr CLI arguments

    main

    The following arguments are available for the qwen3-asr command:

    ArgumentShortDescriptionRequired/Optional
    --input-file-iPath to the local media file or a remote URL (http/https) to transcribe.Required
    --context-cText context to guide the ASR model, improving recognition of specific terms.Optional (Default: "")
    --dashscope-api-key-keyYour DashScope API Key.Optional (if DASHSCOPE_API_KEY is set)
    --num-threads-jThe number of concurrent threads to use for API calls.Optional (Default: 4)
    --vad-segment-threshold-dTarget duration in seconds for each VAD-split audio chunk.Optional (Default: 120)
    --tmp-dir-tPath to a directory for storing temporary chunk files.Optional (Default: ~/qwen3-asr-cache)
    --save-srt-srtGenerate and save a timestamped SRT subtitle file in addition to the .txt file.Optional
    --silence-sSilence mode. Suppresses detailed progress and chunking information on the terminal.Optional
  6. Use the qwen3-asr CLI command

    main

    The qwen3-asr command is used to transcribe local media files or remote URLs. It automatically handles audio splitting via VAD, parallel processing, and post-processing to remove hallucinations.

    qwen3-asr -i <input_file_or_url> [-key <api_key>] [-j <num_threads>] [-c <context>] [-d <duration>] [-t <tmp_dir>] [--save-srt] [-s]