title: How to set custom handler_name metadata for subtitle stream using FFMPEG
body: <p>I'm currently using <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a> to embed subtitles into my MP4 files and I am stumped trying to figure out how to custom set the "handler_name" metadata tag on my subtitle stream so I can control the name that is displayed when selecting the subtitle within a player like <a href="http://mpc-hc.org/" rel="noreferrer">MPC-HC</a> (Media Player Classic)?</p>
  
  <p>My current command to embed the subtitle is:</p>
  
  <pre><code>ffmpeg -i "video.mp4" -sub_charenc UTF-8 -i "video.srt" -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language=eng -metadata:s:s:0 handler_name="English" -id3v2_version 3 -write_id3v1 1 "subbed_video.mp4"
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>C:\path\to&gt;ffmpeg -y -i "video.mp4" -sub_charenc UTF-8 -i "video.srt" -c:v copy -c:a copy -c:s mov_text -metadata:s:s:0 language="eng" -metadata:s:s:0 handler_name="English" -id3v2_version 3 -write_id3v1 1 "subbed_video.mp4"
  ffmpeg version N-68482-g92a596f Copyright (c) 2000-2014 the FFmpeg developers
    built on Dec 16 2014 02:53:08 with gcc 4.9.2 (GCC)
    configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable
    libavutil      54. 15.100 / 54. 15.100
    libavcodec     56. 15.100 / 56. 15.100
    libavformat    56. 15.105 / 56. 15.105
    libavdevice    56.  3.100 / 56.  3.100
    libavfilter     5.  3.101 /  5.  3.101
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  3.100 / 53.  3.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf55.34.101
    Duration: 01:27:44.17, start: 0.000000, bitrate: 878 kb/s
      Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x536 [SAR 1:1 DAR 160:67], 842 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (HE-AAC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 32 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
      Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
      Metadata:
        handler_name    : SubtitleHandler
  Input #1, srt, from 'video.srt':
    Duration: N/A, bitrate: N/A
      Stream #1:0: Subtitle: subrip
  Output #0, mp4, to 'subbed_video.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      encoder         : Lavf56.15.105
      Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x536 [SAR 1:1 DAR 160:67], q=2-31, 842 kb/s, 24 fps, 24 tbr, 12288 tbn, 12288 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo, 32 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
      Stream #0:2(eng): Subtitle: mov_text ([8][0][0][0] / 0x0008) (default)
      Metadata:
        handler_name    : English
        encoder         : Lavc56.15.100 mov_text
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (copy)
    Stream #0:1 -&gt; #0:1 (copy)
    Stream #0:2 -&gt; #0:2 (mov_text (native) -&gt; mov_text (native))
  Press [q] to stop, [?] for help
  frame=126337 fps=13751 q=-1.0 Lsize=  564499kB time=01:27:44.17 bitrate= 878.5kbits/s
  video:541239kB audio:20564kB subtitle:39kB other streams:0kB global headers:0kB muxing overhead: 0.472881%
  </code></pre>
  
  <p>The command completes sucessfully, but when I run:</p>
  
  <pre><code>ffmpeg -i "C:\path\to\subbed_video.mp4"
  </code></pre>
  
  <p>it shows:</p>
  
  <pre><code>Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 0 kb/s (default)
  Metadata:
    handler_name    : SubtitleHandler
  </code></pre>
  
  <p>Even though the output from the command shows:</p>
  
  <pre><code>Stream #0:2(eng): Subtitle: mov_text ([8][0][0][0] / 0x0008) (default)
  Metadata:
    handler_name    : English
    encoder         : Lavc56.15.100 mov_text
  </code></pre>
  
  <p>No matter what options I have tried or what order I place the -metadata tags in, this tag simply will not set with <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a>? I find it really ugly to see <strong>SubtitleHandler [eng] (tx3g) (English)</strong> within my player's menu instead of simply saying <strong>English</strong>.</p>
  
  <p>Now, I can work around this issue by using <a href="http://gpac.wp.mines-telecom.fr/mp4box/" rel="noreferrer">MP4BOX</a> to embed the subtitles into my mp4's using:</p>
  
  <pre><code>MP4BOX -lang eng -add "video.srt:name=English" "video.mp4" -out "subbed_video.mp4"
  </code></pre>
  
  <p>Adding <strong>"name=English"</strong> allows me to set the subtitle stream's "handler_name" to "English"; which displays perfectly in <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a> and <a href="http://mpc-hc.org/" rel="noreferrer">MPC-HC</a>, but the problem is that I do not want my app to be dependent on an additional external tool like <a href="http://gpac.wp.mines-telecom.fr/mp4box/" rel="noreferrer">MP4BOX</a> if it can be avoided?</p>
  
  <p>I would greatly appreciate any advice regarding how to properly set the "handler_name" tag on my subtitle stream using <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a>, or maybe a confirmation as to whether <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a> can even handle this tag seeing as it is not technically listed in <a href="https://www.ffmpeg.org/doxygen/2.4/group__metadata__api.html" rel="noreferrer">FFMPEG's valid metadata tag list</a>?</p>
  
  <p><em>P.S. As an alternative to <a href="https://www.ffmpeg.org/" rel="noreferrer">FFMPEG</a>, I would be willing to use <a href="http://atomicparsley.sourceforge.net/" rel="noreferrer">AtomicParsley</a> to set the "handler_name" as I will already be using it to set advanced metadata on the "subbed_video.mp4" after I embed the subtitles. It does seem like it would be possible to do with <a href="http://atomicparsley.sourceforge.net/" rel="noreferrer">AtomicParsley</a>, but I have not been able to understand half the help information with regards to setting custom ATOM's.</em></p>
  
  <p>TIA!!</p>