1. SDKs & Tools
  2. SDKs
  3. .NET SDK
  4. Pre-recorded Transcription

Pre-recorded Transcription

The DeepgramClient has a Transcription.Prerecorded property that allows you to request transcripts for pre-recorded audio. To request a transcript for a pre-recorded particular audio file, you'll use the Transcription.Prerecorded.GetTranscriptionAsync method.

Transcription Sources

There are two types of sources that can be provided for transcription:

UrlSource

Provides a url to the file to transcribe.

var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync(
    new UrlSource("URL_TO_FILE"));

StreamSource

Provide a stream containing the file to transcribe.

using (FileStream stream = File.OpenRead("PATH_TO_FILE"))
{
    var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync(
        new StreamSource(stream, "MIMETYPE_OF_FILE "));
}

Helper Functions

The SDK provides a few helper functions for converting pre-recorded transcriptions into common caption formats, like WebVTT and SRT.

Utterances Are Required for Helper Functions

In order to use the helper functions, the Utterances feature must be used when transcribing the audio.

Converting to WebVTT

Each pre-recorded transcription object provides a ToWebVTT function to convert the transcript to the WebVTT format.

var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync(
    new UrlSource("URL_TO_FILE"),
    new PrerecordedTranscriptionOptions()
    {
        Punctuate = true,
        Utterances = true
    });
var srtTranscript = response.toWebVTT();

Converting to SRT

Each pre-recorded transcription object provides a ToSRT function to convert the transcript to the SRT format.

var response = await deepgram.Transcription.Prerecorded.GetTranscriptionAsync(
    new UrlSource("URL_TO_FILE"),
    new PrerecordedTranscriptionOptions()
    {
        Punctuate = true,
        Utterances = true
    });
var srtTranscript = response.ToSRT();

FEEDBACK