[FFmpeg-devel] [BUG] Storage of 3gpp metadata in 3gp files

Baptiste Coudurier baptiste.coudurier
Fri May 29 19:54:20 CEST 2009


Hi Larbi,

On 5/29/2009 5:51 AM, Larbi Joubala wrote:
> Aurelien Jacobs a ?crit :
>> On Fri, May 29, 2009 at 11:21:57AM +0200, Larbi Joubala wrote:
>>  
>>> Baptiste Coudurier a ?crit :
>>>    
>>>> Hi,
>>>>
>>>> Larbi Joubala wrote:
>>>>        
>>>>> Hi guys!
>>>>>
>>>>>    I recently found that when I set metadata in 3gp files that the
>>>>> metadata are not displayed by any players or tools. I tested with
>>>>> QuickTime player and an other mp4/3gp/mov file analyzer
>>>>> tool("scenescope"). Then, to see where the issue comes from, I
>>>>> digged in
>>>>> the source code in paricularly "movenc.c" and I found out that the
>>>>> metadata are stored in UTF16 way but without the BOM(Byte Order
>>>>> Marker)
>>>>> to indicate the endianness. The 3gp standard say that the metadata
>>>>> value
>>>>> can be stored in UTF8 way or UTF16 way but for UTF16 the string value
>>>>> shall start with the following BOM 0xFFFE for big-endian.
>>>>>
>>>>> Is this issue known and why don't store the metadata value with UTF8
>>>>> encoding characters to avoid to add the BOM in the beginning of the
>>>>> string?
>>>>>             
>>>> UTF8 is prefered I think.
>>>>
>>>>         
>>> Ok, so here is a patch which allows MOV muxer to store 3gpp metadata 
>>> value in a UTF8 way.
>>>
>>> Index: movenc.c
>>> ===================================================================
>>> --- movenc.c    (revision 18980)
>>> +++ movenc.c    (working copy)
>>> @@ -1437,7 +1437,8 @@
>>>          put_be16(pb, atoi(t->value));
>>>      else {
>>>          put_be16(pb, language_code("eng")); /* language */
>>> -        ascii_to_wc(pb, t->value);
>>> +        put_buffer(pb, t->value, strlen(t->value)); /* string value */
>>> +        put_byte(pb, 0); /* string NULL-terminated */
>>>     
>>
>> Just use:
>>   put_buffer(pb, t->value, strlen(t->value)+1);
>> so that you don't need to manually add the 0 byte at the end.
>>
>> Aurel
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at mplayerhq.hu
>> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel
>>
>>   
> Ok, no problem.
> I attached the updated patch.
> 
> 
> ------------------------------------------------------------------------
> 
> Index: movenc.c
> ===================================================================
> --- movenc.c	(revision 18980)
> +++ movenc.c	(working copy)
> @@ -1437,7 +1437,7 @@
>          put_be16(pb, atoi(t->value));
>      else {
>          put_be16(pb, language_code("eng")); /* language */
> -        ascii_to_wc(pb, t->value);
> +        put_buffer(pb, t->value, strlen(t->value)+1); /* string value */
>          if (!strcmp(tag, "albm") &&
>              (t = av_metadata_get(s->metadata, "year", NULL, 0)))
>              put_byte(pb, atoi(t->value));

Patch ok.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list