mutagen | 提取mp4封面

有的时候不想来回找了,就直接从文件中提取好了。

MP4提取封面

1
2
3
4
5
6
7
8
9
from mutagen.mp4 import MP4, MP4Cover
try:
audio = MP4(i)
cover = audio['covr'][0]
except:
cover = None
if cover:
with open(os.path.join(outputDir, "c.jpg"), 'wb') as f:
f.write(cover)