title: Converting DVD image with subtitles to MKV using avconv
body: <p>This is the procedure I know to convert a DVD image to another videoformat (v.g. MP4):</p>
  
  <ol>
  <li>concatenate the <code>VTS_01_</code><em>n</em><code>.VOB</code> files inside <code>VIDEO_TS</code> folder (for <em>n</em> >= 0) into a single VOB file.</li>
  <li>use <code>avconv</code> or <code>ffmpeg</code> in order to convert that VOB into another format.</li>
  </ol>
  
  <p>So far so good, however now I want to convert the DVD image <strong>with</strong> the subtitles.  As far as I know the MKV format supports subtitles, so it seems an obvious choice.  Alternatively I might use any other format with hard subtitles (subtitles as part of the video image).</p>
  
  <p>However, the subtitle encoding in the DVD image is <code>dvdsub</code> and I get the following error</p>
  
  <pre><code>Only SUBTITLE_ASS type supported.
  Subtitle encoding failed
  </code></pre>
  
  <p>However, when running <code>avconv -codecs</code> I get:</p>
  
  <pre><code>...
   DES    dvdsub          DVD subtitles
  ...
  </code></pre>
  
  <p>And the <code>-c:s copy</code> switch, while it prevents the command to fail, it does not seem to produce a subtitle that the player can understand.</p>
  
  <p>So, how can I create <code>ass</code> subtitles from <code>dvdsub</code> using <code>avconv</code>?</p>
  
  <p>My VOB file has eight subtitle channels and two audio channels.  The Ubuntu video app does not show any subtitles, and only the first audio channel seems to be working, do the DVD image might be broken.</p>
  
  <p>Another file, for a double-layer DVD, displays the Subtitle encoding error, however when using the <code>-c:s copy</code> switch it further displays:</p>
  
  <pre><code>Application provided invalid, non monotonically increasing dts to muxer in stream 2: 49 &gt;= 49
  av_interleaved_write_frame(): Invalid argument
  </code></pre>
  
  <p>Thank you in advance for any ideas on how to solve these problems.</p>
  
  <p>(I am using Ubuntu where <code>ffmpeg</code> is an alias for <code>avconv</code>.  I know it is possible to install the real ffmpeg but so far I have not done so.)</p>
  
  <hr>
  
  <p>update: commands and console outputs:</p>
  
  <p>commands</p>
  
  <pre><code>cat VTS_01_1.VOB VTS_01_2.VOB VTS_01_3.VOB VTS_01_4.VOB VTS_01_5.VOB &gt; ~/temp/mymovie.VOB
  cd ~/temp
  avconv -i mymovie.VOB
  </code></pre>
  
  <p>output</p>
  
  <pre><code>avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
    built on Mar 30 2013 22:20:06 with gcc 4.7.2
  [mpeg @ 0x1a64d40] max_analyze_duration reached
  Input #0, mpeg, from 'mymovie.VOB':
    Duration: 00:00:01.95, start: 0.280633, bitrate: -2147483 kb/s
      Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 7500 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
      Stream #0.1[0x20]: Subtitle: dvdsub
      Stream #0.2[0x21]: Subtitle: dvdsub
      Stream #0.3[0x22]: Subtitle: dvdsub
      Stream #0.4[0x23]: Subtitle: dvdsub
      Stream #0.5[0x24]: Subtitle: dvdsub
      Stream #0.6[0x25]: Subtitle: dvdsub
      Stream #0.7[0x26]: Subtitle: dvdsub
      Stream #0.8[0x27]: Subtitle: dvdsub
      Stream #0.9[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
      Stream #0.10[0x81]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
  At least one output file must be specified
  </code></pre>
  
  <p>command</p>
  
  <pre><code>avconv -i mymovie.VOB mymovie.mkv
  </code></pre>
  
  <p>output</p>
  
  <pre><code>avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
    built on Mar 30 2013 22:20:06 with gcc 4.7.2
  [mpeg @ 0x1cdad40] max_analyze_duration reached
  Input #0, mpeg, from 'mymovie.VOB':
    Duration: 00:00:01.95, start: 0.280633, bitrate: -2147483 kb/s
      Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 7500 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
      Stream #0.1[0x20]: Subtitle: dvdsub
      Stream #0.2[0x21]: Subtitle: dvdsub
      Stream #0.3[0x22]: Subtitle: dvdsub
      Stream #0.4[0x23]: Subtitle: dvdsub
      Stream #0.5[0x24]: Subtitle: dvdsub
      Stream #0.6[0x25]: Subtitle: dvdsub
      Stream #0.7[0x26]: Subtitle: dvdsub
      Stream #0.8[0x27]: Subtitle: dvdsub
      Stream #0.9[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
      Stream #0.10[0x81]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
  File 'mymovie.mkv' already exists. Overwrite ? [y/N] y
  [buffer @ 0x1ce23c0] w:720 h:480 pixfmt:yuv420p
  Output #0, matroska, to 'mymovie.mkv':
    Metadata:
      encoder         : Lavf53.21.1
      Stream #0.0: Video: mpeg4, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 1k tbn, 29.97 tbc
      Stream #0.1: Audio: libvorbis, 48000 Hz, 5.1, s16
      Stream #0.2: Subtitle: ass, 200 kb/s
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (mpeg2video -&gt; mpeg4)
    Stream #0:9 -&gt; #0:1 (ac3 -&gt; libvorbis)
    Stream #0:1 -&gt; #0:2 (dvdsub -&gt; ass)
  Press ctrl-c to stop encoding
  [ass @ 0x1ce0140] Only SUBTITLE_ASS type supported.
  Subtitle encoding failed
  </code></pre>
  
  <p>command</p>
  
  <pre><code>avconv -i mymovie.VOB -c:s copy mymovie.mkv
  </code></pre>
  
  <p>output omitted.</p>
  
  <p>command</p>
  
  <pre><code>avconv -i mymovie.mkv
  </code></pre>
  
  <p>output</p>
  
  <pre><code>avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
    built on Mar 30 2013 22:20:06 with gcc 4.7.2
  [matroska,webm @ 0xbc1d40] Estimating duration from bitrate, this may be inaccurate
  Input #0, matroska,webm, from 'mymovie.mkv':
    Metadata:
      ENCODER         : Lavf53.21.1
    Duration: 01:05:09.47, start: 0.000000, bitrate: N/A
      Stream #0.0: Video: mpeg4 (Simple Profile), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 29.97 fps, 29.97 tbr, 1k tbn, 30k tbc (default)
      Stream #0.1: Audio: vorbis, 48000 Hz, 5.1, s16 (default)
      Stream #0.2: Subtitle: dvdsub (default)
  At least one output file must be specified
  </code></pre>
  
  <p>Now, for the double-layer:
  commands</p>
  
  <pre><code>cat VTS_01_1.VOB VTS_01_2.VOB VTS_01_3.VOB VTS_01_4.VOB VTS_01_5.VOB VTS_01_6.VOB VTS_01_7.VOB VTS_01_8.VOB &gt; ~/temp/mylongmovie.VOB
  cd ~/temp
  avconv -i mylongmovie.VOB mylongmovie.mkv
  </code></pre>
  
  <p>output</p>
  
  <pre><code>avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
    built on Mar 30 2013 22:20:06 with gcc 4.7.2
  [mpeg @ 0x13c2d40] max_analyze_duration reached
  Input #0, mpeg, from 'Cosmos-0203.VOB':
    Duration: 00:00:30.24, start: 0.280633, bitrate: 2103365 kb/s
      Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 8000 kb/s, 27.46 fps, 59.94 tbr, 90k tbn, 59.94 tbc
      Stream #0.1[0x20]: Subtitle: dvdsub
      Stream #0.2[0x21]: Subtitle: dvdsub
      Stream #0.3[0x22]: Subtitle: dvdsub
      Stream #0.4[0x23]: Subtitle: dvdsub
      Stream #0.5[0x24]: Subtitle: dvdsub
      Stream #0.6[0x25]: Subtitle: dvdsub
      Stream #0.7[0x26]: Subtitle: dvdsub
      Stream #0.8[0x27]: Subtitle: dvdsub
      Stream #0.9[0x81]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
      Stream #0.10[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
  File 'mylongmovie.mkv' already exists. Overwrite ? [y/N] y
  [buffer @ 0x13ca3c0] w:720 h:480 pixfmt:yuv420p
  Output #0, matroska, to 'mylongmovie.mkv':
    Metadata:
      encoder         : Lavf53.21.1
      Stream #0.0: Video: mpeg4, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 1k tbn, 59.94 tbc
      Stream #0.1: Audio: libvorbis, 48000 Hz, 5.1, s16
      Stream #0.2: Subtitle: ass, 200 kb/s
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (mpeg2video -&gt; mpeg4)
    Stream #0:9 -&gt; #0:1 (ac3 -&gt; libvorbis)
    Stream #0:1 -&gt; #0:2 (dvdsub -&gt; ass)
  Press ctrl-c to stop encoding
  [ass @ 0x13d19c0] Only SUBTITLE_ASS type supported.
  Subtitle encoding failed
  </code></pre>
  
  <p>command</p>
  
  <pre><code>avconv -i mylongmovie.VOB -c:s copy mylongmovie.mkv 
  </code></pre>
  
  <p>output</p>
  
  <pre><code>avconv version 0.8.6-6:0.8.6-1ubuntu2, Copyright (c) 2000-2013 the Libav developers
    built on Mar 30 2013 22:20:06 with gcc 4.7.2
  [mpeg @ 0xce1d40] max_analyze_duration reached
  Input #0, mpeg, from 'mylongmovie.VOB':
    Duration: 00:00:30.24, start: 0.280633, bitrate: 2103365 kb/s
      Stream #0.0[0x1e0]: Video: mpeg2video (Main), yuv420p, 720x480 [PAR 8:9 DAR 4:3], 8000 kb/s, 27.46 fps, 59.94 tbr, 90k tbn, 59.94 tbc
      Stream #0.1[0x20]: Subtitle: dvdsub
      Stream #0.2[0x21]: Subtitle: dvdsub
      Stream #0.3[0x22]: Subtitle: dvdsub
      Stream #0.4[0x23]: Subtitle: dvdsub
      Stream #0.5[0x24]: Subtitle: dvdsub
      Stream #0.6[0x25]: Subtitle: dvdsub
      Stream #0.7[0x26]: Subtitle: dvdsub
      Stream #0.8[0x27]: Subtitle: dvdsub
      Stream #0.9[0x81]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
      Stream #0.10[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
  File 'mylongmovie.mkv' already exists. Overwrite ? [y/N] y
  [buffer @ 0xce93c0] w:720 h:480 pixfmt:yuv420p
  Output #0, matroska, to 'mylongmovie.mkv':
    Metadata:
      encoder         : Lavf53.21.1
      Stream #0.0: Video: mpeg4, yuv420p, 720x480 [PAR 8:9 DAR 4:3], q=2-31, 200 kb/s, 1k tbn, 59.94 tbc
      Stream #0.1: Audio: libvorbis, 48000 Hz, 5.1, s16
      Stream #0.2: Subtitle: dvdsub
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (mpeg2video -&gt; mpeg4)
    Stream #0:9 -&gt; #0:1 (ac3 -&gt; libvorbis)
    Stream #0:1 -&gt; #0:2 (copy)
  Press ctrl-c to stop encoding
  [matroska @ 0xce4b40] Application provided invalid, non monotonically increasing dts to muxer in stream 2: 49 &gt;= 49
  av_interleaved_write_frame(): Invalid argument
  </code></pre>