Opened 3 years ago

#9438 new defect

mp4: ffmpeg can't read track title metadata

Reported by: Dong Nguyen Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mp4 metadata
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

  • Generate any test mp4 file with multiple audio streams
  • Using ffmpeg to add "title" metadata to each audio stream
  • Using ffprobe to check the file metadata, expect output has the title metadata
  • VLC can show audio track title in drop down menu

How to reproduce:

# generate test.mp4 with 3 audio streams or any similar test file can do
% gst-launch-1.0 -e videotestsrc pattern="ball" ! video/x-raw,width=1280,height=720 ! x264enc ! queue ! mp4mux name=mux ! filesink location="test.mp4" \
audiotestsrc wave="sine" volume=0.5 ! audio/x-raw,layout=interleaved,format=F32LE,rate=48000,channels=2 ! avenc_aac ! aacparse ! queue ! mux. \
audiotestsrc wave="pink-noise" ! audio/x-raw,layout=interleaved,format=F32LE,rate=48000,channels=2 ! avenc_aac ! aacparse ! queue ! mux. \
audiotestsrc freq=5 ! audio/x-raw,layout=interleaved,format=F32LE,rate=48000,channels=2 ! avenc_aac ! aacparse ! queue ! mux.

# add title
% ffmpeg -i test.mp4 -map 0 -c copy \
          -metadata:s:a:0 title="My Title 1" \
          -metadata:s:a:1 title="My Title 2" \
          -metadata:s:a:2 title="My Title 3" \
          test_labeled.mp4
...
Output #0, mp4, to 'test_labeled.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42mp41isomiso2
    encoder         : Lavf59.5.100
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 79 kb/s, 30 fps, 30 tbr, 12k tbn (default)
    Metadata:
      creation_time   : 2021-09-24T03:43:33.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2021-09-24T03:43:33.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
      title           : My Title 1
  Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2021-09-24T03:43:33.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
      title           : My Title 2
  Stream #0:3(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2021-09-24T03:43:33.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
      title           : My Title 3
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
  Stream #0:2 -> #0:2 (copy)
  Stream #0:3 -> #0:3 (copy)
Press [q] to stop, [?] for help
frame=  257 fps=0.0 q=-1.0 Lsize=     453kB time=00:00:08.46 bitrate= 438.1kbits/s speed=1.67e+03x    
video:83kB audio:356kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.177835%

# probe the output file
% ffprobe test_labeled.mp4
ffprobe version N-103790-g447cf53774 Copyright (c) 2007-2021 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)
  configuration: --prefix=/usr/local --disable-static --enable-shared --enable-gpl --enable-openssl --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libzimg --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libdav1d --enable-nonfree --enable-vulkan --enable-cuda-nvcc --enable-cuvid --enable-nvenc --enable-libnpp --extra-cflags='-I/usr/local/cuda/include -march=native -mtune=native' --extra-ldflags=-L/usr/local/cuda/lib64 --nvccflags='-gencode arch=compute_52,code=sm_52 -O2'
  libavutil      57.  6.100 / 57.  6.100
  libavcodec     59.  9.100 / 59.  9.100
  libavformat    59.  5.100 / 59.  5.100
  libavdevice    59.  0.101 / 59.  0.101
  libavfilter     8.  9.100 /  8.  9.100
  libswscale      6.  1.100 /  6.  1.100
  libswresample   4.  0.100 /  4.  0.100
  libpostproc    56.  0.100 / 56.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_labeled.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.5.100
  Duration: 00:00:08.57, start: 0.000000, bitrate: 432 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 79 kb/s, 30 fps, 30 tbr, 12k tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2[0x3](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:3[0x4](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]

Expect stream metadata should have title field. Thanks.

Attachments (2)

test.mp4 (448.2 KB ) - added by Dong Nguyen 3 years ago.
test_labeled.mp4 (452.7 KB ) - added by Dong Nguyen 3 years ago.

Download all attachments as: .zip

Change History (2)

by Dong Nguyen, 3 years ago

Attachment: test.mp4 added

by Dong Nguyen, 3 years ago

Attachment: test_labeled.mp4 added
Note: See TracTickets for help on using tickets.