Opened 9 years ago

Closed 5 years ago

#4833 closed enhancement (fixed)

Long metadata truncated

Reported by: vance003 Owned by:
Priority: wish Component: avformat
Version: git-master Keywords: mov metadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


Summary of the bug:
For Apple / Quicktime files ffmpeg can handle metadata for the Lyrics ("©lyr" tag ID) and Long_Description (ldes tag ID; referred to by ffmpeg as "Synopsis") tags, both of which are able to exceed the standard 255 character limit for metadata. When ffmpeg encodes or adds them, however, it imposes a new limit of slightly less than 1024 characters, truncating as needed. For most instances this is not a problem, but for some files the tags may exceed this new limit. Is it possible to remove this length limit for these two tags?

How to reproduce (files test1.m4a and test1.txt hopefully will be attached for the sake of convenience):

ffmpeg -i test1.m4a -i test1.txt -map_metadata 1 -codec copy test2.m4a
ffmpeg -i test2.m4a -f ffmetadata test2.txt
compare test1.txt test2.txt

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

Attachments (1) (179.8 KB ) - added by vance003 9 years ago.
Zip file of test1.m4a and test1.txt

Download all attachments as: .zip

Change History (8)

by vance003, 9 years ago

Attachment: added

Zip file of test1.m4a and test1.txt

comment:1 by vance003, 9 years ago

Hmmm, on checking a bit more, I find that apparently ALL Quicktime textual metadata that is supposed to be no more than 255 characters long (like "Album," "Artist," etc.) can actually be encoded by ffmpeg at at this slightly-less-than-1024 length. That's good news if you're encoding Fiona Apple's second album, but it actually represents an error / defect, as it allows ffmpeg to produce encoded metadata that do not conform to the industry standard. Ultimately, however, I'm not that concerned about those tags --- I just want to be able to encode Lyrics and Synopses that exceed the 1024 limit.

comment:2 by vance003, 9 years ago

Cc: added
Type: enhancementdefect

comment:3 by Carl Eugen Hoyos, 9 years ago

Do I understand correctly that you both want metadata to be less than 1024 (255) and more than 1024 bytes? Probably depending on your current use-case?

comment:4 by Carl Eugen Hoyos, 9 years ago

Component: undeterminedavformat
Keywords: mov metadata added
Type: defectenhancement

comment:5 by vance003, 9 years ago

Thanks for the reply; hopefully I can clarify. It sort of looks like ffmpeg used a "one size fits all" strategy for the Quicktime textual tags, instead of saying that "Lyrics" and "Synopsis" can be of unlimited length, and all the others can be no more than 255 characters. Now for the short tags, I don't care. I'm converting file formats for some of my sound files, and with valid data coming in for tags like "Album" and "Artist," valid data will come out of ffmpeg. I suspect that there may exist somewhere programs that'll choke on the longer info in these basic tags, but that's not my main concern. What I'm first and foremost interested in is seeing if the "Lyrics" and "Synopsis" tags can be longer than 1024 characters.

comment:6 by vance003, 9 years ago

Hmmm, since this wasn't seen as a mission critical concern by the powers-that-be, I did a little more digging. It appears that this defect is not limited to Quicktime files --- other sound files generated by ffmpeg also seem to allow metadata up to around 1024 characters, regardless of the format's specs. If one wishes to change this limit, up or down, it is necessary to edit ffmetadec.c in the libavformat subdirectory of the source code. Change line 131 (which reads, "uint8_t line[1024];" [without quotes]) by editing "1024" to whatever limit you desire. Recompile, and it appears you are good to go. Now I'll admit I know exceedingly little about coding in c / c++, so I am again dependent upon the coding mavens here to reveal whether such an adjustment will be likely to produce any untoward consequences.

comment:7 by Elon Musk, 5 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.