Opened 13 years ago

Closed 12 years ago

#1052 closed defect (fixed)

libavformat doesn't preserve some metadata for mov containers

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

Description

libavformat doesn't support writing the metadata tags: episode_sort, season_number, media_type, hd_video, or gapless_playback.

Attached is a diff to provide writing these metadata tags.

This can be reproduced by:
ffmpeg -i foo.m4v -metadata episode_sort=2 -metadata season_number=5 bar.m4v
ffmpeg -i bar.m4v
look for those metadata tags. They are not preserved.

Additionally, when reencoding files that have these tags set, the metadata is not preserved.

Attachments (1)

movenc.diff (2.2 KB ) - added by bbraun 13 years ago.

Download all attachments as: .zip

Change History (4)

by bbraun, 13 years ago

Attachment: movenc.diff added

comment:1 by Carl Eugen Hoyos, 13 years ago

Keywords: mov added
Version: unspecifiedgit-master

Please send patches to ffmpeg-devel, they receive more attention there.

And please change indentation slightly:

static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb, 
                                   const char *name, const char *tag, 
                                   int long_style)

comment:2 by Michael Niedermayer, 13 years ago

+static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
+ const char *name, const char *tag,
+ int long_style)
+{
+ int64_t pos = avio_tell(pb);
+ AVDictionaryEntry *t = NULL;

always writen before read, thus =NULL is useless

+ uint8_t num;
+
+ if (!(t = av_dict_get(s->metadata, tag, NULL, 0)))
+ return 0;

+ num = t ? atoi(t->value) : 0;

t cant be NULL here

+
+ avio_wb32(pb, 4);
+ ffio_wfourcc(pb, name);
+ avio_w8(pb, 0);
+ avio_w8(pb, 0);
+ avio_w8(pb, 0);
+ avio_w8(pb, num);

+ return update_size(pb, pos);

you dont need update_size when the size is fixed

also this function can be factored with the very similar mov_write_int8_metadata_no_padding()

comment:3 by Carl Eugen Hoyos, 12 years ago

Resolution: fixed
Status: newclosed

Applied by Michael.

Note: See TracTickets for help on using tickets.