Skip to content

Commit

Permalink
fix #34 should classify mp3 as audio
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemia committed Oct 11, 2023
1 parent 1cee6c1 commit b4cf745
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ffmpeg_media_type/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def _guess_media_info(

for stream in info.streams:
# NOTE: if there is at least one video stream, the media is video
if stream.codec_type == "video":
if stream.codec_type == "video" and format_name not in ("mp3", ):
width = stream.width
height = stream.height

Expand Down
11 changes: 11 additions & 0 deletions src/ffmpeg_media_type/tests/__snapshots__/6.0/test_info.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@
'width': 1280,
})
# ---
# name: test_detect[mp3-with-cover.mp3][mp3-with-cover.mp3]
dict({
'duration': 1.044898,
'format': 'mp3',
'height': 0,
'size': 677673,
'suggest_ext': 'mp3',
'type': 'audio',
'width': 0,
})
# ---
# name: test_detect[overlay.png][overlay.png]
dict({
'duration': 0.0,
Expand Down
Binary file not shown.

0 comments on commit b4cf745

Please sign in to comment.