<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
I have some problems adding metadata to a mp4 or mov container, not sure if it's a problem in avformat or if I'm doing something wrong.<br>
<br>
I'd like to have my metadata at the same level where I see "major_brand", "encoder" and similar stuff with ffprobe.<br>
<br>
To check the behaviour, I got the latest ffmpeg head sources and modified the test program:<br>
<br>
doc/examples/muxing.c<br>
<br>
I simply added the line:<br>
<br>
<div style="color: rgb(212, 212, 212); background-color: rgb(30, 30, 30); font-family: Menlo, Monaco, "Courier New", monospace; font-weight: normal; font-size: 14px; line-height: 21px;">
<span><span>    </span><span style="color: rgb(220, 220, 170);">av_dict_set</span><span>(&</span><span style="color: rgb(156, 220, 254);">oc</span><span>-></span><span style="color: rgb(156, 220, 254);">metadata</span><span>,
</span><span style="color: rgb(206, 145, 120);">"testKey"</span><span>, </span><span style="color: rgb(206, 145, 120);">"testValue"</span><span>,
</span><span style="color: rgb(181, 206, 168);">0</span><span>);</span></span>
<div><span></span></div>
</div>
<br>
just before av_dump_format (at line 601).<br>
<br>
I compiled and run the program (tested both with .mp4 and .mov)<br>
<br>
av_dump_format finds the metadata and prints....<br>
<br>
[libx264 @ 0x7f8e2d00b600] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
<div>[libx264 @ 0x7f8e2d00b600] profile High, level 1.3</div>
<div>[libx264 @ 0x7f8e2d00b600] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16
 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1
 open_gop=0 weightp=2 keyint=12 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=400 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00</div>
<div>Output #0, mp4, to 'test.mp4':</div>
<div>  Metadata:</div>
<div>    testKey         : testValue</div>
<div>    Stream #0:0: Video: h264, yuv420p, 352x288, q=2-31, 400 kb/s, 25 tbn</div>
    Stream #0:1: Audio: aac (LC), 44100 Hz, stereo, fltp, 64 kb/s<br>
<br>
... but when I probe with ffprobe the final file I get:<br>
<br>
../../ffprobe test.mp4
<div>ffprobe version N-102394-g4fda451c9f Copyright (c) 2007-2021 the FFmpeg developers</div>
<div>  built with Apple clang version 12.0.0 (clang-1200.0.32.29)</div>
<div>  configuration: --disable-lzma --prefix=/usr/local/sdk/darwin-x64 --enable-libx264 --enable-libfdk-aac --enable-nonfree --enable-gpl --enable-libopus --enable-libvpx --enable-libvorbis --enable-pic --disable-sdl2</div>
<div>  libavutil      57.  0.100 / 57.  0.100</div>
<div>  libavcodec     59.  0.100 / 59.  0.100</div>
<div>  libavformat    59.  0.101 / 59.  0.101</div>
<div>  libavdevice    59.  0.100 / 59.  0.100</div>
<div>  libavfilter     8.  0.101 /  8.  0.101</div>
<div>  libswscale      6.  0.100 /  6.  0.100</div>
<div>  libswresample   4.  0.100 /  4.  0.100</div>
<div>  libpostproc    56.  0.100 / 56.  0.100</div>
<div>Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mp4':</div>
<div>  Metadata:</div>
<div>    major_brand     : isom</div>
<div>    minor_version   : 512</div>
<div>    compatible_brands: isomiso2avc1mp41</div>
<div>    encoder         : Lavf58.29.100</div>
<div>  Duration: 00:00:10.03, start: 0.000000, bitrate: 328 kb/s</div>
<div>  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 352x288, 255 kb/s, 25.10 fps, 25 tbr, 12800 tbn (default)</div>
<div>    Metadata:</div>
<div>      handler_name    : VideoHandler</div>
<div>      vendor_id       : [0][0][0][0]</div>
<div>  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 65 kb/s (default)</div>
<div>    Metadata:</div>
<div>      handler_name    : SoundHandler</div>
<span>      vendor_id       : [0][0][0][0]</span><br>
<br>
<br>
.... no trace at all of my metadata!<br>
<br>
I'm doing something wrong?<br>
</div>
</body>
</html>