[FFmpeg-user] Adding metadata at the stream level for a multi-stream media file

Alfredo Di Napoli alfredo.dinapoli at gmail.com
Mon Jul 25 13:02:44 EEST 2016


Hey guys,

Suppose I have a media file composed by 1 video stream and 2 audio streams
(both AAC).
Is it possible to add metadata at the stream level, for each of the two
audio?

Here is the probe of the media in question:

ffprobe version 3.1.1-tessus Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build
--extra-cflags=-I/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build/include
--extra-ldflags=-L/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build/lib
--bindir=/Users/adinapoli/ffmpeg-3.1.1/bin --extra-libs=-ldl --as=yasm
--disable-debug --disable-ffplay --disable-indev=qtkit
--disable-indev=x11grab_xcb --enable-avisynth --enable-avresample
--enable-fontconfig --enable-frei0r --enable-gpl --enable-libmp3lame
--enable-libx264 --enable-libxvid --enable-nonfree --enable-pthreads
--enable-shared --enable-vda --enable-version3 --extra-version=tessus
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'multi.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.41.100
  Duration: 00:05:00.05, start: 0.000000, bitrate: 3799 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 2560x720 [SAR 1:1 DAR 32:9], 3664 kb/s, 29.97 fps,
29.97 tbr, 11988 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 64 kb/s
    Metadata:
      handler_name    : SoundHandler

Here is the command I  tried:

ffmpeg-3.1.1 -i multi.mp4 -y -map 0:v -map 0:a -codec copy -metadata:s:a:0
title="Foo" -metadata:s:a:1 title="bar" multi2.mp4

But the metadata does not show in the output probe:

ffprobe version 3.1.1-tessus Copyright (c) 2007-2016 the FFmpeg developers
  built with Apple LLVM version 7.3.0 (clang-703.0.31)
  configuration: --prefix=/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build
--extra-cflags=-I/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build/include
--extra-ldflags=-L/Users/adinapoli/ffmpeg-3.1.1/ffmpeg_build/lib
--bindir=/Users/adinapoli/ffmpeg-3.1.1/bin --extra-libs=-ldl --as=yasm
--disable-debug --disable-ffplay --disable-indev=qtkit
--disable-indev=x11grab_xcb --enable-avisynth --enable-avresample
--enable-fontconfig --enable-frei0r --enable-gpl --enable-libmp3lame
--enable-libx264 --enable-libxvid --enable-nonfree --enable-pthreads
--enable-shared --enable-vda --enable-version3 --extra-version=tessus
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'multi2.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf57.41.100
  Duration: 00:05:00.08, start: 0.000000, bitrate: 3799 kb/s
    Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 /
0x31637661), yuv420p, 2560x720 [SAR 1:1 DAR 32:9], 3664 kb/s, 29.97 fps,
29.97 tbr, 11988 tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 64 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
    Stream #0:2(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 64 kb/s
    Metadata:
      handler_name    : SoundHandler

What am I doing wrong? Is this even possible or am I flogging a dead horse?

Thanks in advance!

Alfredo


More information about the ffmpeg-user mailing list