mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-07-10 15:28:33 +00:00
Update yt_dlp/postprocessor/ffmpeg.py
Co-authored-by: Simon Sawicki <accounts@grub4k.xyz>
This commit is contained in:
parent
79bb8f51e4
commit
51af60e6d7
@ -674,17 +674,17 @@ def embed_lyrics(self, input_files):
|
||||
subs = input_files[1]
|
||||
if not subs.endswith('.lrc'):
|
||||
raise PostProcessingError('LRC subtitles required. Use "--convert-subs lrc" to convert')
|
||||
|
||||
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=3, lang='eng', desc='', text=lyrics))
|
||||
audio.save()
|
||||
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=3, lang='eng', desc='', text=lyrics))
|
||||
audio.save()
|
||||
else:
|
||||
metadata = mutagen.File(audio_file)
|
||||
metadata['©lyr' if audio_file.endswith('.m4a') else 'lyrics'] = [lyrics]
|
||||
metadata.save()
|
||||
metadata = mutagen.File(audio_file)
|
||||
metadata['©lyr' if audio_file.endswith('.m4a') else 'lyrics'] = [lyrics]
|
||||
metadata.save()
|
||||
|
||||
|
||||
class FFmpegMetadataPP(FFmpegPostProcessor):
|
||||
|
Loading…
Reference in New Issue
Block a user