Opened 6 years ago

Last modified 5 years ago

#5879 new defect

Remove all metadata does not work with MKV files

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


Summary of the bug: Remove all metadata does not work with MKV files, DURATION metadata is still here.
How to reproduce:

% ffmpeg -i input -map_metadata -1 ... output.mkv
ffmpeg version N-81872-gbe1d324
built gcc 5.4.0 (GCC) Windows 64 bits

Change History (4)

comment:1 by Carl Eugen Hoyos, 6 years ago

Keywords: mkv added

comment:2 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavformat
Keywords: regression added
Version: unspecifiedgit-master

Could you explain your use-case?
FFmpeg was patched in 31852540d4fba0c4e8a16d0b3ddff08fc98e48fd to intentionally write not metadata (from the muxer's perspective) but the actual duration of the streams after they are written to the file.

comment:3 by Kdmeizk, 6 years ago

I don't really understand what you mean with "use-case".

I'm using one of the latest builds from

And the result from MediaInfo:

ID                                       : 1
Format                                   : VP9
Codec ID                                 : V_VP9
Duration                                 : 3 min 24 s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (30000/1001) FPS
Language                                 : English
Default                                  : Yes
Forced                                   : No
DURATION                                 : 00:03:24.203000000

ID                                       : 2
Format                                   : FLAC
Format/Info                              : Free Lossless Audio Codec
Codec ID                                 : A_FLAC
Duration                                 : 3 min 24 s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Bit depth                                : 16 bits
Default                                  : No
Forced                                   : No
DURATION                                 : 00:03:24.220000000

It can calculate or retrieve the duration one time, that's why the second DURATION is not useful for me, and impossible to delete.

comment:4 by Kdmeizk, 5 years ago

Since mkvmerge is the possible reference here, I checked with the version 9.7.1.

With mkvmerge -o out.mkv in.mkv, there is no DURATION fields while ffmpeg does it.

But the main information I retained is in their documentation (, you can see for the --enable-durations option:

Write durations for all blocks. This will increase file size and does not offer any additional value for players at the moment.

So if -map_metadata -1 is not the original way to avoid the write of these DURATION fields (that I believe I understood from your answer), is it possible to do something (you or me) to avoid the use of mkvmerge in addition to ffmpeg to fix this problem?

Note: See TracTickets for help on using tickets.