Opened 7 years ago

Closed 6 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 7 years ago.

Download all attachments as: .zip

Change History (4)

Changed 7 years ago by bbraun

comment:1 Changed 7 years ago by cehoyos

  • Keywords mov added
  • Version changed from unspecified to git-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 Changed 6 years ago by michael

+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 Changed 6 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed

Applied by Michael.

Note: See TracTickets for help on using tickets.