This is my first post.
This is C# code for transcribing the file sample.webm.
Using this code, I uploaded a webm file that is over 14 minutes long, but it returned completely different text from the original audio file.
The responses vary, but they are entirely unrelated to the audio file and resemble the following:
=============================
Certainly! Here is the step-by-step guide on how to install and set up the DOOM retro port on your Windows computer:
- Download the DOOM retro port:
- Navigate to the official DOOM Retro website or…
=============================
When I upload a webm file that is about 2 minutes long, there are no problems at all.
So please investigate.
(MediaFile Information:)
Full path: output_000.webm
Format: WebM
Format version: Version 4 / Version 2
Size: 11.5 MiB
Duration: 24 minutes 59 seconds
Total bitrate: 64.5 Kbps
Encoder used: Lavf62.0.100
Library used: Lavf62.0.100
Audio
ID: 1
Format: Opus
Codec ID: A_OPUS
Duration: 24 minutes 59 seconds
Channels: 1 channel
Channel layout: M
Sample rate: 48.0 KHz
Bit depth: 16-bit
Compression: Lossy
Library used: Lavc62.0.101 libopus
Default: No
Forced: No
(A Part of ActualCode:)
try
{
using var httpClient = new HttpClient();
httpClient.DefaultRequestHeaders.Authorization =
new AuthenticationHeaderValue("Bearer", apiKey);
using var content = new MultipartFormDataContent();
// Specify the model for transcription
content.Add(new StringContent("gpt-4o-transcribe"), "model");
// Set response format to text
content.Add(new StringContent("text"), "response_format");
byte[] audioData = await File.ReadAllBytesAsync(audioFilePath);
string mimeType = GetMimeTypeFromExtension(Path.GetExtension(audioFilePath));
var audioContent = new ByteArrayContent(audioData);
audioContent.Headers.ContentType = new MediaTypeHeaderValue(mimeType);
content.Add(audioContent, "file", Path.GetFileName(audioFilePath));
string api //Snipped to create Topic.
HttpResponseMessage response = await httpClient.PostAsync(apiUrl, content);
if (!response.IsSuccessStatusCode)
{
string errorBody = await response.Content.ReadAsStringAsync();
Console.WriteLine($"API error (HTTP {response.StatusCode}): {errorBody}");
}
else
{
string transcriptionText = await response.Content.ReadAsStringAsync();
Console.WriteLine("【Transcription Result】");
Console.WriteLine(transcriptionText);
}