Skip to content

Speakr is a personal, self-hosted web application designed for transcribing audio recordings

Python

Switch to option B for video upload limits: any video file (by extension) uses max_audio_only_video_size_mb regardless of the keep_audio_only flag; the toggle now controls whether the video stream is kept, not the size cap; post-extraction guard adds chunking-aware check so large extracted audio is accepted when chunking is on and rejected with clear guidance when chunking is off; warning becomes a sky-blue informational hint plus updated locale strings

Murtaza Nasir95ff7a467573
diff --git a/docs/admin-guide/system-settings.md b/docs/admin-guide/system-settings.md
index a0af9347..a0d80ba7 100644
--- a/docs/admin-guide/system-settings.md
+++ b/docs/admin-guide/system-settings.md
@@ -16,9 +16,16 @@ The sweet spot depends on your use case. For typical meetings under an hour, 50,
## Maximum File Size
-The file size limit protects your system from being overwhelmed by massive uploads while ensuring users can work with reasonable recordings. The default 300MB accommodates several hours of compressed audio, which covers most use cases.
+Two separate caps apply depending on file type:
-Raising this limit allows longer recordings but requires careful consideration. Larger files take longer to upload, consume more storage, and might timeout during processing. Your server needs enough memory to handle these files, and your storage must accommodate them. Network timeouts, browser limitations, and user patience all factor into what's practical.
+- **`max_file_size_mb`** (default 300 MB) — applies to audio uploads. Protects storage from runaway audio.
+- **`max_audio_only_video_size_mb`** (default 4 × `max_file_size_mb`, ≈ 1200 MB) — applies to **any** video file regardless of whether the video stream will be kept. Video files are typically much larger than the audio they contain, so they get their own (larger) ceiling.
+
+When chunking is enabled (`ENABLE_CHUNKING=true`, the default), the upload route lets files through above these caps and chunks them on the server for the ASR call. When chunking is off, the caps are enforced strictly. Files whose **extracted audio** still exceeds `max_file_size_mb` are rejected with a clear error when chunking is off; with chunking on, the chunking pipeline handles them.
+
+The "Keep audio only" toggle on the upload form determines whether the video stream is retained — it no longer affects the size cap (that's controlled by file type). Use it when you specifically don't want the video kept on disk.
+
+Raising these limits allows longer recordings but requires careful consideration. Larger files take longer to upload, consume more storage, and might timeout during processing. Your server needs enough memory to handle these files, and your storage must accommodate them. Network timeouts, browser limitations, and user patience all factor into what's practical.
If users frequently hit the limit, consider whether they really need single recordings that long. Often, splitting long sessions into logical segments produces better results - easier to review, faster to process, and more focused summaries.
diff --git a/src/api/recordings.py b/src/api/recordings.py
index 759a751f..e69de7d4 100644
--- a/src/api/recordings.py
+++ b/src/api/recordings.py
@@ -2217,14 +2217,19 @@ def upload_file():
original_file_size = file.tell()
file.seek(0)
- # Resolve effective size limit. Audio-only video uploads use a
- # separate, larger limit because only the extracted audio is
- # stored. Regular limit applies to everything else.
+ # Resolve effective size limit. Video files (by extension) get
+ # the larger video cap regardless of whether the user opted
+ # into "Keep audio only". Audio files use the regular cap.
+ # This is the option-B model: admins set a single per-file-type
+ # upload cap and don't have to think about how the keep-audio
+ # toggle interacts with size validation. The post-extraction
+ # guard further down still enforces that the *stored* artifact
+ # fits the regular limit when only audio is kept.
regular_limit_mb = int(SystemSetting.get_setting('max_file_size_mb', 250))
audio_only_limit_mb = int(
SystemSetting.get_setting('max_audio_only_video_size_mb', regular_limit_mb * 4)
)
- if effective_audio_only and is_likely_video_by_ext:
+ if is_likely_video_by_ext:
effective_limit_mb = audio_only_limit_mb
else:
effective_limit_mb = regular_limit_mb
@@ -2377,12 +2382,18 @@ def upload_file():
# max_file_size_mb under the "audio-only video" exception, the
# stored file (after audio extraction) must still fit the regular
# limit. If it does not, the user picked a video whose audio track
- # alone is enormous; reject the upload, clean up, and let them know.
+ # alone is enormous AND chunking is off; reject the upload,
+ # clean up, and let the user know. When chunking is on the
+ # large extracted audio is fine — the chunking pipeline will
+ # split it for the ASR call.
+ chunking_will_handle_large_audio = (
+ chunking_service is not None and not should_enforce_size_limit
+ )
if (
effective_audio_only
and is_likely_video_by_ext
- and original_file_size > regular_limit_mb * 1024 * 1024
and final_file_size > regular_limit_mb * 1024 * 1024
+ and not chunking_will_handle_large_audio
):
try:
if os.path.exists(filepath):
@@ -2391,17 +2402,20 @@ def upload_file():
pass
current_app.logger.warning(
f"Audio-only extraction left {final_file_size/1024/1024:.1f}MB of audio, "
- f"which exceeds regular limit {regular_limit_mb}MB. Rejecting upload."
+ f"which exceeds regular limit {regular_limit_mb}MB and chunking is off. "
+ f"Rejecting upload."
)
return jsonify({
'error': (
f'The extracted audio is {final_file_size / 1024 / 1024:.0f} MB, '
f'larger than the {regular_limit_mb} MB stored-file limit. '
- f'Try a lower-bitrate video or shorten the recording.'
+ f'Enable chunking in admin settings (ENABLE_CHUNKING=true) or '
+ f'use a shorter / lower-bitrate source video.'
),
'max_size_mb': float(regular_limit_mb),
'extracted_audio_mb': round(final_file_size / 1024 / 1024, 1),
'audio_only_mode': True,
+ 'chunking_enabled': False,
}), 413
# (file_hash and duplicate_warning already computed above, before conversion)
diff --git a/static/locales/de.json b/static/locales/de.json
index 0a90e486..12fd0a1d 100644
--- a/static/locales/de.json
+++ b/static/locales/de.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "Wird nach der Transkription automatisch zusammengefasst",
"keepAudioOnly": "Nur Audio behalten",
"videoAudioOnlyAuto": "Der Videostream wird nicht beibehalten.",
- "videoExceedsAudioOnlyMaxSize": "Video „{{name}}“ überschreitet das Audio-only-Limit von {{size}} MB und wurde übersprungen.",
+ "videoExceedsAudioOnlyMaxSize": "Video „{{name}}\" überschreitet das Video-Upload-Limit von {{size}} MB und wurde übersprungen.",
"keepAudioOnlySubtitleOff": "Videostream verwerfen",
"keepAudioOnlySubtitleOn": "Video verworfen",
"keepAudioOnlyLargerAllowed": "Größere Uploads erlaubt",
- "enableKeepAudioOnlyForLargeVideo": "Über dem normalen Limit. Aktiviere unten „Nur Audio behalten\", um dieses Video hochzuladen."
+ "largeVideoNotice": "Großes Videodatei. Upload wird fortgesetzt; Transkription dauert ggf. länger und nutzt das Chunking auf dem Server."
},
"uploadProgress": {
"title": "Upload-Fortschritt"
diff --git a/static/locales/en.json b/static/locales/en.json
index d3cb3876..7745184c 100644
--- a/static/locales/en.json
+++ b/static/locales/en.json
@@ -1543,11 +1543,11 @@
"willAutoSummarize": "Will auto-summarize after transcription",
"keepAudioOnly": "Keep audio only",
"videoAudioOnlyAuto": "Video stream will not be kept.",
- "videoExceedsAudioOnlyMaxSize": "Video \"{{name}}\" exceeds the audio-only maximum of {{size}} MB and was skipped.",
+ "videoExceedsAudioOnlyMaxSize": "Video \"{{name}}\" exceeds the video upload maximum of {{size}} MB and was skipped.",
"keepAudioOnlySubtitleOff": "Drop video stream",
"keepAudioOnlySubtitleOn": "Video dropped",
"keepAudioOnlyLargerAllowed": "Larger uploads allowed",
- "enableKeepAudioOnlyForLargeVideo": "Over the regular size limit. Enable \"Keep audio only\" below to upload this video."
+ "largeVideoNotice": "Large video file. Upload will proceed; transcription may take longer and uses chunking on the server."
},
"uploadProgress": {
"title": "Upload Progress"
diff --git a/static/locales/es.json b/static/locales/es.json
index 635e4421..a49199df 100644
--- a/static/locales/es.json
+++ b/static/locales/es.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "Se resumirá automáticamente después de la transcripción",
"keepAudioOnly": "Conservar solo el audio",
"videoAudioOnlyAuto": "El flujo de vídeo no se conservará.",
- "videoExceedsAudioOnlyMaxSize": "El vídeo «{{name}}» supera el máximo de solo audio de {{size}} MB y se omitió.",
+ "videoExceedsAudioOnlyMaxSize": "El vídeo «{{name}}» supera el límite de subida de vídeo de {{size}} MB y se omitió.",
"keepAudioOnlySubtitleOff": "Descartar el vídeo",
"keepAudioOnlySubtitleOn": "Vídeo descartado",
"keepAudioOnlyLargerAllowed": "Se permiten subidas más grandes",
- "enableKeepAudioOnlyForLargeVideo": "Supera el límite habitual. Activa «Conservar solo el audio» abajo para subir este vídeo."
+ "largeVideoNotice": "Archivo de vídeo grande. La subida continuará; la transcripción puede tardar más y usa el troceado en el servidor."
},
"uploadProgress": {
"title": "Progreso de Carga"
diff --git a/static/locales/fr.json b/static/locales/fr.json
index f590f60c..0ee9f97f 100644
--- a/static/locales/fr.json
+++ b/static/locales/fr.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "Résumé automatique après la transcription",
"keepAudioOnly": "Conserver uniquement l’audio",
"videoAudioOnlyAuto": "Le flux vidéo ne sera pas conservé.",
- "videoExceedsAudioOnlyMaxSize": "La vidéo « {{name}} » dépasse le maximum audio uniquement de {{size}} Mo et a été ignorée.",
+ "videoExceedsAudioOnlyMaxSize": "La vidéo « {{name}} » dépasse la limite d’envoi vidéo de {{size}} Mo et a été ignorée.",
"keepAudioOnlySubtitleOff": "Supprimer le flux vidéo",
"keepAudioOnlySubtitleOn": "Vidéo supprimée",
"keepAudioOnlyLargerAllowed": "Envois plus volumineux autorisés",
- "enableKeepAudioOnlyForLargeVideo": "Au-delà de la limite normale. Activez « Conserver uniquement l’audio » ci-dessous pour envoyer cette vidéo."
+ "largeVideoNotice": "Fichier vidéo volumineux. L’envoi va se poursuivre ; la transcription peut être plus longue et utilise le découpage côté serveur."
},
"uploadProgress": {
"title": "Progression du Téléchargement"
diff --git a/static/locales/pt-BR.json b/static/locales/pt-BR.json
index ebe49345..6ab59e27 100644
--- a/static/locales/pt-BR.json
+++ b/static/locales/pt-BR.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "Será resumido automaticamente após a transcrição",
"keepAudioOnly": "Manter apenas o áudio",
"videoAudioOnlyAuto": "O fluxo de vídeo não será mantido.",
- "videoExceedsAudioOnlyMaxSize": "O vídeo “{{name}}” excede o máximo apenas-áudio de {{size}} MB e foi ignorado.",
+ "videoExceedsAudioOnlyMaxSize": "O vídeo \"{{name}}\" excede o limite de envio de vídeo de {{size}} MB e foi ignorado.",
"keepAudioOnlySubtitleOff": "Descartar o vídeo",
"keepAudioOnlySubtitleOn": "Vídeo descartado",
"keepAudioOnlyLargerAllowed": "Envios maiores permitidos",
- "enableKeepAudioOnlyForLargeVideo": "Excede o limite habitual. Ative “Manter apenas o áudio” abaixo para enviar este vídeo."
+ "largeVideoNotice": "Arquivo de vídeo grande. O envio será concluído; a transcrição pode demorar mais e usa o particionamento no servidor."
},
"uploadProgress": {
"title": "Progresso do Envio"
diff --git a/static/locales/ru.json b/static/locales/ru.json
index 1c3fdb30..8a1f4fee 100644
--- a/static/locales/ru.json
+++ b/static/locales/ru.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "Автоматически создаст резюме после транскрибирования",
"keepAudioOnly": "Сохранить только аудио",
"videoAudioOnlyAuto": "Видеопоток сохранён не будет.",
- "videoExceedsAudioOnlyMaxSize": "Видео «{{name}}» превышает лимит только для аудио в {{size}} МБ и было пропущено.",
+ "videoExceedsAudioOnlyMaxSize": "Видео «{{name}}» превышает лимит загрузки видео в {{size}} МБ и было пропущено.",
"keepAudioOnlySubtitleOff": "Отбросить видео",
"keepAudioOnlySubtitleOn": "Видео отброшено",
"keepAudioOnlyLargerAllowed": "Допустимы более крупные загрузки",
- "enableKeepAudioOnlyForLargeVideo": "Превышает обычный лимит. Включите «Сохранить только аудио» ниже, чтобы загрузить это видео."
+ "largeVideoNotice": "Большой видеофайл. Загрузка продолжится; транскрибация может занять больше времени и использует разбивку на сервере."
},
"uploadProgress": {
"title": "Прогресс загрузки"
diff --git a/static/locales/zh.json b/static/locales/zh.json
index 313bd668..6ac77399 100644
--- a/static/locales/zh.json
+++ b/static/locales/zh.json
@@ -1534,11 +1534,11 @@
"willAutoSummarize": "转录后将自动生成摘要",
"keepAudioOnly": "仅保留音频",
"videoAudioOnlyAuto": "不会保留视频流。",
- "videoExceedsAudioOnlyMaxSize": "视频 “{{name}}” 超出仅音频上限 {{size}} MB,已跳过。",
+ "videoExceedsAudioOnlyMaxSize": "视频 “{{name}}” 超出视频上传上限 {{size}} MB,已跳过。",
"keepAudioOnlySubtitleOff": "丢弃视频流",
"keepAudioOnlySubtitleOn": "已丢弃视频",
"keepAudioOnlyLargerAllowed": "允许更大文件",
- "enableKeepAudioOnlyForLargeVideo": "超过常规大小限制。请在下方启用“仅保留音频”后再上传此视频。"
+ "largeVideoNotice": "视频文件较大。上传将继续;转录可能耗时更长,并依赖服务器端的分块处理。"
},
"uploadProgress": {
"title": "上传进度"
diff --git a/templates/components/upload-view.html b/templates/components/upload-view.html
index 56c06387..07f98532 100644
--- a/templates/components/upload-view.html
+++ b/templates/components/upload-view.html
@@ -55,24 +55,18 @@
<i class="fas fa-volume-up text-xs mt-0.5 flex-shrink-0"></i>
<span>${ t('upload.videoAudioOnlyAuto') }</span>
</div>
- <!-- Inline WARNING when the upload route is
- actually going to reject this file. Fires
- only when: file is video, VIDEO_RETENTION
- is on, the "Keep audio only" toggle is
- off, the file exceeds the regular limit,
- AND chunking is off at the server. With
- chunking on, the upload-route's size check
- is bypassed (the file gets chunked
- server-side), so the warning would be
- misleading. -->
- <div v-if="videoRetentionEnabled
- && !keepAudioOnly
- && !chunkingEnabled
- && /\.(mp4|mov|mkv|avi|webm|m4v|wmv|flv|ts|mts)$/i.test(item.file.name)
+ <!-- Informational hint for video files larger
+ than the regular stored-file limit. The
+ upload will still succeed (video files use
+ the larger video cap), but processing may
+ take longer and depends on chunking being
+ on if the extracted audio also exceeds the
+ regular limit. -->
+ <div v-if="/\.(mp4|mov|mkv|avi|webm|m4v|wmv|flv|ts|mts)$/i.test(item.file.name)
&& item.file.size > maxFileSizeMB * 1024 * 1024"
- class="flex items-start gap-1.5 pl-5 mt-0.5 text-[11px] leading-snug text-amber-700 dark:text-amber-400">
- <i class="fas fa-exclamation-triangle text-xs mt-0.5 flex-shrink-0"></i>
- <span>${ t('upload.enableKeepAudioOnlyForLargeVideo') }</span>
+ class="flex items-start gap-1.5 pl-5 mt-0.5 text-[11px] leading-snug text-sky-700 dark:text-sky-400">
+ <i class="fas fa-info-circle text-xs mt-0.5 flex-shrink-0"></i>
+ <span>${ t('upload.largeVideoNotice') }</span>
</div>
</div>
</div>
diff --git a/tests/test_video_retention.py b/tests/test_video_retention.py
index 638205e1..dc44b28e 100644
--- a/tests/test_video_retention.py
+++ b/tests/test_video_retention.py
@@ -134,22 +134,26 @@ class TestUploadHandlerVideoRetention(unittest.TestCase):
self.assertIn('effective_audio_only', self.content)
def test_upload_handler_uses_separate_size_limit_for_audio_only_video(self):
- """When the upload is in audio-only mode AND the file extension
- looks like video, the size gate uses max_audio_only_video_size_mb
- instead of max_file_size_mb. The post-extraction guard then
- ensures the stored audio still fits the regular limit."""
+ """Per option-B semantics, the size gate uses the larger video
+ cap for ANY video file (by extension) regardless of the
+ keep_audio_only flag; the post-extraction guard still rejects
+ when the *extracted* audio exceeds the regular limit AND
+ chunking is off (chunking-on lets large audio through to the
+ chunking pipeline)."""
# The audio-only-video limit must be read from the SystemSetting,
# not hardcoded.
self.assertIn(
"SystemSetting.get_setting('max_audio_only_video_size_mb'",
self.content,
)
- # Effective limit must split on the (audio_only AND video) condition.
- self.assertIn('effective_audio_only and is_likely_video_by_ext', self.content)
- # And the post-extraction size guard must still cap the stored
- # audio against the regular limit.
+ # Effective limit splits purely on file type, not on audio-only mode.
+ self.assertIn('if is_likely_video_by_ext:', self.content)
+ # And the post-extraction size guard still caps the stored audio
+ # against the regular limit, but only when chunking won't handle
+ # it (chunking pipeline accepts large audio).
self.assertIn('regular_limit_mb * 1024 * 1024', self.content)
self.assertIn('extracted_audio_mb', self.content)
+ self.assertIn('chunking_will_handle_large_audio', self.content)
def test_upload_handler_persists_keep_audio_only_on_recording(self):
"""The recording row stores the effective audio-only flag so the