fix 处理jpg图片的codec_name应为mjpg

This commit is contained in:
shuohigh@gmail.com 2025-06-06 10:19:37 +08:00
parent 9785cb45d7
commit 45bb33e67a
1 changed files with 4 additions and 3 deletions

View File

@ -128,15 +128,16 @@ class VideoMetadata(BaseModel):
if isinstance(stream, Dict): if isinstance(stream, Dict):
logger.info(f"Parsing stream : {json.dumps(stream, ensure_ascii=False)}") logger.info(f"Parsing stream : {json.dumps(stream, ensure_ascii=False)}")
if stream.get("codec_type") == 'audio': if stream.get("codec_type") == 'audio':
if stream.get("duration"): if stream.get("duration") is None:
hls_audio = HLSMediaVideoStream.model_validate(stream) logger.info("Parsing audio stream")
hls_audio = HLSMediaAudioStream.model_validate(stream)
streams.append(hls_audio) streams.append(hls_audio)
else: else:
logger.info("Parsing hls audio stream") logger.info("Parsing hls audio stream")
audio = AudioStream.model_validate(stream) audio = AudioStream.model_validate(stream)
streams.append(audio) streams.append(audio)
elif stream.get("codec_type") == 'video': elif stream.get("codec_type") == 'video':
if stream.get("codec_name") in ("gif", "png", "jpg", "jpeg", "webp"): if stream.get("codec_name") in ("gif", "png", "mjpg", "jpeg", "webp"):
logger.info("Parsing image stream") logger.info("Parsing image stream")
image = ImageStream.model_validate(stream) image = ImageStream.model_validate(stream)
streams.append(image) streams.append(image)