try fix detect_media_type
This commit is contained in:
parent
5f36e9a22a
commit
0c3e50ce95
|
|
@ -90,6 +90,7 @@ class MediaDetector:
|
||||||
]
|
]
|
||||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True)
|
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True)
|
||||||
data = json.loads(result.stdout)
|
data = json.loads(result.stdout)
|
||||||
|
logging.debug("detect_media_type ffprobe output: %s", data)
|
||||||
streams = data.get("streams", [])
|
streams = data.get("streams", [])
|
||||||
|
|
||||||
video_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 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:
|
if len(video_streams) == 1 and audio_count > 0:
|
||||||
codec_name = video_streams[0].get("codec_name", "")
|
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"
|
return "audio"
|
||||||
|
|
||||||
# Otherwise, if any video stream is not an attached picture, treat as video
|
# Otherwise, if any video stream is not an attached picture, treat as video
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue