[FFmpeg-trac] #9462(undetermined:new): Ffmpeg not removing unwanted metadata

FFmpeg trac at avcodec.org
Tue Oct 26 19:32:46 EEST 2021


#9462: Ffmpeg not removing unwanted metadata
-------------------------------------+-------------------------------------
             Reporter:  steipal      |                    Owner:  (none)
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  unspecified  |               Resolution:
             Keywords:  METADATA     |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
Comment (by steipal):

 It looks like this following section in fftools\ffmpeg.c (line 3640) is
 responsible for the behavior that leads to incompatible side data in the
 output file:

 {{{
         /*
          * Add global input side data. For now this is naive, and copies
 it
          * from the input stream's global side data. All side data should
          * really be funneled over AVFrame and libavfilter, then added
 back to
          * packet side data, and then potentially using the first packet
 for
          * global side data.
          */
         if (ist) {
             int i;
             for (i = 0; i < ist->st->nb_side_data; i++) {
                 AVPacketSideData *sd = &ist->st->side_data[i];
                 if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
                     uint8_t *dst = av_stream_new_side_data(ost->st,
 sd->type, sd->size);
                     if (!dst)
                         return AVERROR(ENOMEM);
                     memcpy(dst, sd->data, sd->size);
                     if (ist->autorotate && sd->type ==
 AV_PKT_DATA_DISPLAYMATRIX)
                         av_display_rotation_set((uint32_t *)dst, 0);
                 }
             }
         }
 }}}


 I commented it out, compiled and ffmpeg no longer copied the side data.
 Also, when reading the comment it looks like this implementation is rather
 unfinished ad-hoc code that should not treat global packet side data this
 way. One thought was to link it to the "-map_metadata -1" option and when
 this is specified global side data will NOT be copied. However, I guess
 this implementation is rather ad-hoc too but from a user point of view it
 would make sense.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9462#comment:11>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list