Audio Transcription SRT
ARK Platform Example / Audio Transcription SRT
With the ARK API, you can generate transcriptions of audio files in various formats including SRT (SubRip Text), which is a popular subtitle format that includes timestamps.
Using the response_format
parameter with the value "srt"
enables you to get transcriptions with properly formatted timestamps that can be directly used for subtitling videos.
-
# NOTE: This code assumes an "audio.mp3" file exists in the current path with recorded speech. import openai ark_api_key = "API_KEY" ark_base_url = "https://api.ark-labs.cloud/api/v1" client = openai.OpenAI(api_key=ark_api_key, base_url=ark_base_url) with open("Rozmowa_1.mp3", "rb") as audio_file: print("Requesting transcription in SRT format...") response = client.audio.transcriptions.create( model="whisper-1", file=audio_file, language="pl", response_format="srt" # Request SRT format ) print("Transcription (SRT):") print(response) # SRT is plain text, so directly printing the response