Opened 10 hours ago

Last modified 10 hours ago

#11275 new defect

(Audio) Metadata is wrongly exported and reimported with current format resulting in data loss

Reported by: mytait Owned by:
Priority: normal Component: undetermined
Version: 7.1 Keywords: ffmetadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

i want to export audio metadata using the metadata muxer and reimport it later after processing and possibly re-enconding.

https://ffmpeg.org/ffmpeg-all.html#ffmetadata

Data is exported but the metadataformat reads only one key=value line at a time
However, embedded metadata in files can be multi-line: e.g. song lyrics.
that metadata is exported like this:

;FFMETADATA1
title=test title
artist=test artist
album_artist=test album artits
lyrics=Lyrics line1 
Lyricsline2 
Lyricsline3 
comment=test song
encoder=Lavf61.7.100

The "Lyricsline2" and "Lyricsline3" are exported to a new line and the import function ignores them as they seem to be keys without a value. Therefore the new file ends with only the first line "Lyrics line1".

POSSIBLE FIX

I found out that if i modify the resulting metadata export (it is a text file) adding unix like line continues then all lyrics are imported correctly:

;FFMETADATA1
title=test title
artist=test artist
album_artist=test album artits
lyrics=Lyrics line1\ 
Lyricsline2\ 
Lyricsline3 
comment=test song
encoder=Lavf61.7.100

How to reproduce:

% #extract metadata from mp3 with multiline lyrics to txt file
% ffmpeg -i in_file_embedded.mp3 -c copy -map_metadata 0 -map_metadata:s 0:s -map_metadata:s:a 0:s:a -f ffmetadata 1out_export.txt

#embed metadata to another metadata empty mp3 file
ffmpeg -i in_test_no_metadata.mp3 -f ffmetadata -i 1out_export.txt -c copy -map_metadata 1 out_embedded.mp3

#extract the metadata again from the new embeddeed file. Lines are missing
ffmpeg -i out_embedded.mp3 -c copy -map_metadata 0 -map_metadata:s 0:s -map_metadata:s:a 0:s:a -f ffmetadata 2out_export_missinglines.txt


ffmpeg version
ffmpeg version 7.1-full_build-www.gyan.dev 

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (2)

in_file_embedded.mp3 (968.2 KB ) - added by mytait 10 hours ago.
test file with embedded multi line lyrics
in_test_no_metadata.mp3 (967.8 KB ) - added by mytait 10 hours ago.
file with no metadata embedded for testing

Download all attachments as: .zip

Change History (3)

by mytait, 10 hours ago

Attachment: in_file_embedded.mp3 added

test file with embedded multi line lyrics

by mytait, 10 hours ago

Attachment: in_test_no_metadata.mp3 added

file with no metadata embedded for testing

comment:1 by mytait, 10 hours ago

added test files

Note: See TracTickets for help on using tickets.