Opened 6 years ago

Closed 6 years ago

#7262 closed enhancement (fixed)

ffmpeg automatically add "handler_name" to track metadata

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

Description

Summary of the bug:
Inputting a mp4 without handler_name and does not specify it in the command, ffmpeg add "handler_name" not matter what.

In the log below, video track and audio track of 1.mp4 creation_time in their metadata and -map_metadata -1 should remove all metadata. However, "handler_name" was added to 2.mp4 by ffmpeg.

How to reproduce:

% ffmpeg -i in.mp4 -map_metadata -1 -codec copy out.mp4
ffmpeg version 3.4
built with gcc 6.4.0 (Alpine 6.4.0)

Log:

$ ffmpeg -i 1.mp4 -map_metadata -1 -codec copy 2.mp4

ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Alpine 6.4.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libmp3lame --enable-librtmp --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isomavc1
    creation_time   : 2018-06-16T17:18:50.000000Z
  Duration: 00:24:00.04, start: 0.000000, bitrate: 1549 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 1341 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      creation_time   : 2018-06-16T17:18:50.000000Z
    Stream #0:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 204 kb/s (default)
    Metadata:
      creation_time   : 2018-06-16T17:11:42.000000Z
Output #0, mp4, to '2.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 1341 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 204 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=34525 fps=30679 q=-1.0 Lsize=  272712kB time=00:24:00.02 bitrate=1551.4kbits/s speed=1.28e+03x
video:235787kB audio:35953kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.357371%
$ffmpeg -i 2.mp4 -map_metadata -1 -codec copy 3.mp4

ffmpeg version 3.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Alpine 6.4.0)
  configuration: --prefix=/usr --enable-avresample --enable-avfilter --enable-gnutls --enable-gpl --enable-libmp3lame --enable-librtmp --enable-libvorbis --enable-libvpx --enable-libxvid --enable-libx264 --enable-libx265 --enable-libtheora --enable-libv4l2 --enable-postproc --enable-pic --enable-pthreads --enable-shared --enable-libxcb --disable-stripping --disable-static --enable-vaapi --enable-vdpau --enable-libopus --disable-debug
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.83.100
  Duration: 00:24:00.04, start: 0.000000, bitrate: 1551 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 1341 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 204 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Output #0, mp4, to '3.mp4':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 1341 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc (default)
    Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 204 kb/s (default)
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=34525 fps=26192 q=-1.0 Lsize=  272712kB time=00:24:00.02 bitrate=1551.4kbits/s speed=1.09e+03x
video:235787kB audio:35953kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.357374%

Change History (10)

comment:1 by Gyan, 6 years ago

Not a bug.

ISO 14996-12 5/e 8.4.3.1 mandates that the hdlr be present.

Box Type: ‘hdlr’
Container: Media Box (‘mdia’) or Meta Box (‘meta’)
Mandatory: Yes
Quantity: Exactly one

in reply to:  1 comment:2 by Carl Eugen Hoyos, 6 years ago

Replying to Gyan:

Not a bug.

ISO 14996-12 5/e 8.4.3.1 mandates that the hdlr be present.

Box Type: ‘hdlr’
Container: Media Box (‘mdia’) or Meta Box (‘meta’)
Mandatory: Yes
Quantity: Exactly one

But does this specify that a box has to be written or that the box has to contain a string with length > 0?

comment:3 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavformat
Keywords: mov added
Version: 3.4git-master

For future tickets: Please remember that only current FFmpeg git head is supported here.

comment:4 by Carl Eugen Hoyos, 6 years ago

I found This field may contain a zero-length (empty) string.

in reply to:  4 ; comment:5 by Gyan, 6 years ago

Replying to cehoyos:

I found This field may contain a zero-length (empty) string.

In which document/edition/section?

The complete description for this field that I have is

name is a null-terminated string in UTF-8 characters which gives a human-readable name for the track type (for debugging and inspection purposes).

in reply to:  5 comment:6 by Carl Eugen Hoyos, 6 years ago

Replying to Gyan:

Replying to cehoyos:

I found This field may contain a zero-length (empty) string.

In which document/edition/section?

An antique QuickTime document.

The complete description for this field that I have is

name is a null-terminated string in UTF-8 characters which gives a human-readable name for the track type (for debugging and inspection purposes).

Which sounds ambiguous to me...

comment:7 by Gyan, 6 years ago

GPAC allows empty strings. For us to allow that, a new muxer option would be required.

comment:8 by Carl Eugen Hoyos, 6 years ago

Priority: normalwish
Reproduced by developer: set
Status: newopen
Type: defectenhancement

comment:9 by Gyan, 6 years ago

Fixed in deb9a04d54045c8021816cfe019bf2bba0e9595d.

Default behaviour is to write non-empty string.

comment:10 by Carl Eugen Hoyos, 6 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.