Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Commit 52d8381

Browse files
fix(transcribe): allow exact 4h duration and handle invalid metadata (#13561)
Co-authored-by: Steve Purcell <steve@sanityinc.com>
1 parent 4f689f3 commit 52d8381

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

localstack-core/localstack/services/transcribe/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ def _run_transcription_job(self, args: tuple[TranscribeStore, str]) -> None:
319319
job["MediaFormat"] = SUPPORTED_FORMAT_NAMES[format]
320320
duration = ffprobe_output["format"]["duration"]
321321

322-
if float(duration) >= MAX_AUDIO_DURATION_SECONDS:
322+
if float(duration) > MAX_AUDIO_DURATION_SECONDS:
323323
failure_reason = "Invalid file size: file size too large. Maximum audio duration is 4.000000 hours.Check the length of the file and try your request again."
324324
raise RuntimeError()
325325

tests/aws/services/transcribe/test_transcribe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def test_transcribe_error_invalid_length(self, transcribe_create_job, aws_client
459459
media_file = os.path.join(tempfile.gettempdir(), "audio_4h.mp3")
460460

461461
run(
462-
f"{ffmpeg_bin} -f lavfi -i anullsrc=r=44100:cl=mono -t 14400 -q:a 9 -acodec libmp3lame {media_file}"
462+
f"{ffmpeg_bin} -f lavfi -i anullsrc=r=44100:cl=mono -t 14401 -q:a 9 -acodec libmp3lame {media_file}"
463463
)
464464
job_name = transcribe_create_job(audio_file=media_file)
465465

0 commit comments

Comments
 (0)