From b161f81913b35caf540365453ae0caf2ac13cfad Mon Sep 17 00:00:00 2001 From: intelligence Date: Fri, 14 Aug 2026 14:10:41 +0200 Subject: [PATCH] feat: compression --- README.md | 3 ++- src/main.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0f3e778..d9aadf1 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,8 @@ transui # same as record Bind `transui record` to a shortcut in your desktop environment. Transui does not register a global shortcut itself. Press the same shortcut again to stop -and transcribe the current recording. +and transcribe the current recording. Audio is recorded as 16 kHz mono MP3 at +32 kbps to keep uploads small. The **Hosted first, local fallback** setting tries the Hosted endpoint, then the Local endpoint when the first request fails. With it disabled, Transui uses diff --git a/src/main.cpp b/src/main.cpp index 70a4608..8cf73af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -330,8 +330,8 @@ bool transcription_request(const std::string& url, const std::string& key, part = curl_mime_addpart(mime); curl_mime_name(part, "file"); curl_mime_filedata(part, path.c_str()); - curl_mime_filename(part, "recording.wav"); - curl_mime_type(part, "audio/wav"); + curl_mime_filename(part, "recording.mp3"); + curl_mime_type(part, "audio/mpeg"); if (!prompt.empty()) { part = curl_mime_addpart(mime); curl_mime_name(part, "prompt"); @@ -568,7 +568,9 @@ void start_recording(App* app) { app->recording_path = template_path; g_free(template_path); gchar* pipeline_text = g_strdup_printf( - "autoaudiosrc ! audioconvert ! audioresample ! wavenc ! filesink location=\"%s\"", + "autoaudiosrc ! audioconvert ! audioresample ! " + "audio/x-raw,format=S16LE,rate=16000,channels=1 ! " + "lamemp3enc target=bitrate bitrate=32 cbr=true ! filesink location=\"%s\"", app->recording_path.c_str()); GError* error = nullptr; app->pipeline = gst_parse_launch(pipeline_text, &error);