mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 17:51:24 +01:00
Compare commits
No commits in common. "e9a49de89cb68c1f674d53003a6b07643edb2ab0" and "8c31540e3ab91da858cc0ca742f0e9e2117a0d9d" have entirely different histories.
e9a49de89c
...
8c31540e3a
|
@ -100,12 +100,12 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
|
|||
del audio['APIC']
|
||||
with open(thumbnail_filename, 'rb') as thumbfile:
|
||||
audio['APIC'] = mutagen.id3.APIC(
|
||||
encoding=mutagen.id3.Encoding.UTF8, mime='image/%s' % thumbnail_ext, type=3,
|
||||
encoding=3, mime='image/%s' % thumbnail_ext, type=3,
|
||||
desc=u'Cover (front)', data=thumbfile.read())
|
||||
audio.save()
|
||||
temp_filename = filename # Mutagen saves to the original file
|
||||
except Exception as err:
|
||||
self.report_warning(f'unable to embed using mutagen; {err}')
|
||||
self.report_warning('unable to embed using mutagen; %s' % error_to_compat_str(err))
|
||||
success = False
|
||||
# Method 2: Use ffmpeg
|
||||
else:
|
||||
|
|
|
@ -639,7 +639,6 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
|
|||
if not mp4_ass_warn and ext == 'mp4' and sub_ext == 'ass':
|
||||
mp4_ass_warn = True
|
||||
self.report_warning('ASS subtitles cannot be properly embedded in mp4 files; expect issues')
|
||||
|
||||
if not sub_langs:
|
||||
return [], info
|
||||
|
||||
|
@ -673,16 +672,14 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
|
|||
def embed_lyrics(self, input_files):
|
||||
audio_file = input_files[0]
|
||||
subs = input_files[1]
|
||||
if len(input_files) > 2:
|
||||
self.report_warning('More than one subtitle file found. Only one will be embedded')
|
||||
if not subs.endswith('.lrc'):
|
||||
raise PostProcessingError('LRC subtitles required. Use "--convert-subs lrc" to convert')
|
||||
|
||||
else:
|
||||
with open(subs, 'r', encoding='utf-8') as f:
|
||||
lyrics = f.read().strip()
|
||||
if audio_file.endswith('.mp3'):
|
||||
audio = mutagen.id3.ID3(audio_file)
|
||||
audio.add(mutagen.id3.USLT(encoding=mutagen.id3.Encoding.UTF8, lang='und', desc='', text=lyrics))
|
||||
audio.add(mutagen.id3.USLT(encoding=3, lang='eng', desc='', text=lyrics))
|
||||
audio.save()
|
||||
else:
|
||||
metadata = mutagen.File(audio_file)
|
||||
|
|
Loading…
Reference in New Issue
Block a user