🐛(summary) support webm

Mutagen lib doesn't support webm files.
Since we have ffmpeg installed I just switch to
using ffprobe for a broader support.
This commit is contained in:
Florent Chehab
2026-04-21 17:48:59 +02:00
parent 5a81e2b92c
commit 28acbb5459
3 changed files with 23 additions and 4 deletions
+4
View File
@@ -12,6 +12,10 @@ and this project adheres to
- ✨(backend) add metadata collection of VAD, connection and chat events - ✨(backend) add metadata collection of VAD, connection and chat events
### Fixed
- 🐛(summary) support webm #1290
## [1.14.0] - 2026-04-16 ## [1.14.0] - 2026-04-16
### Added ### Added
-1
View File
@@ -10,7 +10,6 @@ dependencies = [
"celery==5.6.2", "celery==5.6.2",
"redis==5.2.1", "redis==5.2.1",
"minio==7.2.20", "minio==7.2.20",
"mutagen==1.47.0",
"openai==2.28.0", "openai==2.28.0",
"posthog==7.9.12", "posthog==7.9.12",
"requests==2.33.0", "requests==2.33.0",
+19 -3
View File
@@ -1,6 +1,7 @@
"""File service to encapsulate files' manipulations.""" """File service to encapsulate files' manipulations."""
import io import io
import json
import logging import logging
import os import os
import subprocess import subprocess
@@ -10,7 +11,6 @@ from datetime import timedelta
from pathlib import Path from pathlib import Path
from urllib.parse import urlparse from urllib.parse import urlparse
import mutagen
import requests import requests
from minio import Minio from minio import Minio
from minio.error import MinioException, S3Error from minio.error import MinioException, S3Error
@@ -155,8 +155,24 @@ class FileService:
def _validate_duration(self, local_path: Path) -> float: def _validate_duration(self, local_path: Path) -> float:
"""Validate audio file duration against configured maximum.""" """Validate audio file duration against configured maximum."""
file_metadata = mutagen.File(local_path).info result = subprocess.run(
duration = file_metadata.length [
"ffprobe",
"-v",
"quiet",
"-print_format",
"json",
"-show_format",
local_path,
],
check=False,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)
data = json.loads(result.stdout)
duration = float(data["format"]["duration"])
logger.info( logger.info(
"Recording file duration: %.2f seconds", "Recording file duration: %.2f seconds",