try fix detect_media_type

This commit is contained in:
user 2025-03-01 18:51:37 +03:00
parent 5f36e9a22a
commit 0c3e50ce95
1 changed files with 2 additions and 1 deletions

View File

@ -90,6 +90,7 @@ class MediaDetector:
]
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True)
data = json.loads(result.stdout)
logging.debug("detect_media_type ffprobe output: %s", data)
streams = data.get("streams", [])
video_streams = []
@ -104,7 +105,7 @@ class MediaDetector:
# If there is exactly one video stream with codec 'mjpeg' and audio is present, treat as audio
if len(video_streams) == 1 and audio_count > 0:
codec_name = video_streams[0].get("codec_name", "")
if codec_name.lower() == "mjpeg":
if codec_name.lower() in ("mjpeg", "jpeg", "jpg", "png", "bmp", "gif", "tiff", "heif", "heic"):
return "audio"
# Otherwise, if any video stream is not an attached picture, treat as video