Skip to content

Improve embedded lyrics extraction: replace ffmpeg with ffprobe to avoid 1024-byte truncation #3978

Description

@ktech0

Problem
Emby currently uses ffmpeg -i file -f ffmetadata to read embedded lyrics. However, FFmpeg has a hardcoded 1024-byte line buffer in ffmetadec.c, so any lyric line longer than 1024 characters gets silently truncated.

Suggestion
Replace it with ffprobe, which has no such limitation:

ffprobe -v quiet -show_entries format_tags=lyrics-eng -of default=noprint_wrappers=1:nokey=1 "file.mp3"

or

ffprobe -v quiet -show_entries format_tags=lyrics-chi -of default=noprint_wrappers=1:nokey=1 "file.mp3"

This is a simple drop-in replacement using the same dependency (ffprobe comes with ffmpeg) and fully preserves long lyrics.

In addition, the ffmpeg command also carries a large amount of error information into the lyrics text, such as content starting with the following:
Error starting ffmpeg\n-loglevel +timing -y -print_graphs_file \"/logs/ffmpeg-transcode-7922d72e-250c-432b-a594-04091542c92c_1graph.txt\" -f mp3 -c:v:0 png -i \"/data/a.mp3\" -map 0:0 -vn -sn -c:a:0 copy \"/transcoding-temp/XAA639F/XAA639F\"\n\n06:56:33.612 ffmpeg version 5.1-emby_2023_06_25_p4 Copyright (c) 2000-2022 the FFmpeg developers and softworkz for Emby LLC\n06:56:33.612 built with gcc 10.3.0 (crosstool-NG 1.25.0)\n06:56:33.612 Execution Date: 2026-07-04 06:56:33\n06:56:33.637 Input #0, mp3, from \'/data/a.mp3\'

and ending with the following:
Unable to find a suitable output format for \'/transcoding-temp/XAA639F/XAA639F\'\n06:56:33.637 /transcoding-temp/XAA639F/XAA639F: Invalid argument\n06:56:33.638 EXIT\n\n\n\n"

please remove them promptly.

Thanks for considering!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions