Message ID | 1318367884-5246-2-git-send-email-martin@martin.st |
---|---|
State | Committed |
Headers | show |
On 10/11/11 11:18 PM, Martin Storsjö wrote: > This avoids writing these entries doubly if transcoding from > flv to flv, since the muxer blindly writes any and all metadata > keys set, in addition to the fixed fields that the muxer > always writes. 1 and 2 seems fine. lu
On Wed, 12 Oct 2011 00:18:04 +0300, Martin Storsjö <martin@martin.st> wrote: > This avoids writing these entries doubly if transcoding from > flv to flv, since the muxer blindly writes any and all metadata > keys set, in addition to the fixed fields that the muxer > always writes. > --- > This approach was preferred by Anton over the one in > http://patches.libav.org/patch/8402/. Since these metadata items > aren't really user-level metadata as such, they shouldn't be > copied along if transcoding, and he argued that it's better > just to skip them here instead. > > A longer term solution would be to add flags to metadata items, > to be able to flag these as not to be copied. > Discarding them in the muxer would mean that this garbage would propagate to any other formats, where it's just as pointless. So yeah, i think this patch is better.
On Wed, 12 Oct 2011, Anton Khirnov wrote: > > On Wed, 12 Oct 2011 00:18:04 +0300, Martin Storsjö <martin@martin.st> wrote: >> This avoids writing these entries doubly if transcoding from >> flv to flv, since the muxer blindly writes any and all metadata >> keys set, in addition to the fixed fields that the muxer >> always writes. >> --- >> This approach was preferred by Anton over the one in >> http://patches.libav.org/patch/8402/. Since these metadata items >> aren't really user-level metadata as such, they shouldn't be >> copied along if transcoding, and he argued that it's better >> just to skip them here instead. >> >> A longer term solution would be to add flags to metadata items, >> to be able to flag these as not to be copied. >> > > Discarding them in the muxer would mean that this garbage would > propagate to any other formats, where it's just as pointless. > > So yeah, i think this patch is better. Pushed, with the latter patch adjusted not to drop the "encoder" metadata key, after discussing it with Anton on irc. // Martin
diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index 815618d..864e108 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -296,6 +296,21 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vst acodec->bit_rate = num_val * 1024.0; } + if (!strcmp(key, "duration") || + !strcmp(key, "filesize") || + !strcmp(key, "width") || + !strcmp(key, "height") || + !strcmp(key, "videodatarate") || + !strcmp(key, "framerate") || + !strcmp(key, "videocodecid") || + !strcmp(key, "audiodatarate") || + !strcmp(key, "audiosamplerate") || + !strcmp(key, "audiosamplesize") || + !strcmp(key, "stereo") || + !strcmp(key, "audiocodecid") || + !strcmp(key, "encoder")) + return 0; + if(amf_type == AMF_DATA_TYPE_BOOL) { av_strlcpy(str_val, num_val > 0 ? "true" : "false", sizeof(str_val)); av_dict_set(&s->metadata, key, str_val, 0);