未验证 提交 7774db5b 编写于 作者: E Evan Spensley 提交者: GitHub

[EmbedThumbnail] Disable thumbnail conversion for mkv (#3512)

Closes #3209
Authored by: evansp
上级 9b8ee23b
......@@ -79,12 +79,10 @@ def run(self, info):
original_thumbnail = thumbnail_filename = info['thumbnails'][idx]['filepath']
# Convert unsupported thumbnail formats to PNG (see #25687, #25717)
# Original behavior was to convert to JPG, but since JPG is a lossy
# format, there will be some additional data loss.
# PNG, on the other hand, is lossless.
thumbnail_ext = os.path.splitext(thumbnail_filename)[1][1:]
if thumbnail_ext not in ('jpg', 'jpeg', 'png'):
# Convert unsupported thumbnail formats (see #25687, #25717)
# PNG is preferred since JPEG is lossy
if info['ext'] not in ('mkv', 'mka') and thumbnail_ext not in ('jpg', 'jpeg', 'png'):
thumbnail_filename = convertor.convert_thumbnail(thumbnail_filename, 'png')
thumbnail_ext = 'png'
......@@ -102,7 +100,7 @@ def run(self, info):
elif info['ext'] in ['mkv', 'mka']:
options = list(self.stream_copy_opts())
mimetype = 'image/%s' % ('png' if thumbnail_ext == 'png' else 'jpeg')
mimetype = 'image/%s' % ('jpeg' if thumbnail_ext in ('jpg', 'jpeg') else thumbnail_ext)
old_stream, new_stream = self.get_stream_number(
filename, ('tags', 'mimetype'), mimetype)
if old_stream is not None:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册