Answers.Body: <p>Use the <a href="https://ffmpeg.org/ffmpeg-filters.html#subtitles-1" rel="nofollow"><code>subtitles</code></a> filter to create hardsubs ("burnt-in" subtitles):</p>
  
  <pre><code>ffmpeg -i input.mp4 -vf subtitles=subs.srt -target pal-dvd output.mpg
  </code></pre>
  
  <ul>
  <li><p><code>-target pal-dvd</code> will make the output have a frame rate of 25 and a frame size of 720x576. If you want NTSC output instead for a frame rate of 30000/1001 and frame size of 720x480, then use <code>-target ntsc-dvd</code>. For a frame rate of 24000/1001 and 720x480 frame size use <code>-target film-dvd</code>.</p></li>
  <li><p>The old, so-called "<code>ffmpeg</code>" version 0.8.16 in the repo is a counterfeit from a fork that lacks the <code>subtitles</code> filter. If you need the real thing you can simply <a href="https://ffmpeg.org/download.html" rel="nofollow">download a static build</a>.</p></li>
  <li><p>I do not believe <code>ffmpeg</code> can convert the text-based SRT to the bitmap-based dvdsub/vobsub, but there are probably other tools that can do so. This will allow you to use standard DVD subtitles which can be turned on or off by the viewer.</p></li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-01T22:32:41.250Z
Answers.Text: Thank you. That is very comprehensive. By "counterfeit"   I assume you mean that unfortunate fork? I think that the "7:2.5.1-1" is the real thing, correct? Would the result of `-target film-dvd` work on a regular DVD player?
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-01T22:33:44.790Z
Answers.Text: @FaheemMitha I assume it is. If you run `ffmpeg`, the first line in the console output will tell you who developed it. If it displays `FFmpeg Developers` it is the real thing.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-01T22:43:22.533Z
Answers.Text: Also, is `mencoder` not a suitable tool for such a task? It seems to be widely recommended for doing such things on the net.
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-01T23:00:11.207Z
Answers.Text: @FaheemMitha I believe development of `mencoder` has basically ceased some time ago, but if it works for you and you prefer it, go ahead and use it.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-02T07:40:54.223Z
Answers.Text: I'd certainly prefer to use something supported, but isn't mencoder part of mplayer? Why do you think mencoder development has ceased?
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-02T20:04:29.343Z
Answers.Text: @FaheemMitha Looks like there has been ~14 commits to `mplayer.c` since 2012. Last commit was 2014-05-20. Not a perfect means of measurement, but that will give a good idea of activity. Looks like there have been ~7023 commits to FFmpeg since 2014-05-20. Also not a perfect measurement because that includes all commits to the whole project.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T00:16:32.133Z
Answers.Text: Do you mean `mencoder.c`, perhaps? I don't see an `mplayer.c` there. I cloned mplayer from svn. `svn info` gives "Repository Root: svn://svn.mplayerhq.hu/mplayer". And `mencoder.c` has 10 commits since the beginning of 2013.
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T00:27:21.443Z
Answers.Text: @FaheemMitha Yes, that was a typo. Should have been `mencoder.c`, but the numbers remain the same.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T00:33:36.320Z
Answers.Text: We must be using different repositories. I have `2014-05-21` as the last commit, and it's definitely 10 commits since the beginning of 2013. But it doesn't really matter - I get your point.
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T00:38:38.220Z
Answers.Text: @FaheemMitha Same repository. 10 commits since 2013 + 4 more since 2012 = 14.
Answers.UserDisplayName: llogan
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-03T00:41:18.557Z
Answers.Text: Oh, you were talking about commits since the beginning of 2012. That was not clear to me. Then, yes, 14 commits since 1st January 2012. And yes, that isn't a lot of activity. Those maybe the software is mature/stable now. Dunno.
Answers.UserDisplayName: Faheem Mitha
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-03-01T21:43:05.457Z
Answers.LastActivityDate: 2015-03-01T21:43:05.457Z
Answers.UserDisplayName: llogan
Body: <p>Suppose I have two files called <code>foo.mp4</code> and <code>foo.srt</code>. The mp4 file doesn't have subtitles, and I want to add subtitles from the <code>foo.srt</code> file. </p>
  
  <p>The utility <code>mencoder</code> is frequently recommended in this context. I tried using, for example:</p>
  
  <pre><code>mencoder foo.mp4 -sub foo.srt -ovc lavc -oac copy -o foo.mpg
  </code></pre>
  
  <p>This worked for me before. However, here I get</p>
  
  <pre><code>Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.
  </code></pre>
  
  <p>I don't know what this means. Running <code>mediainfo</code> on this file gives the following information for the <code>audio</code> stream.</p>
  
  <pre><code>Audio
  ID                                       : 2
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : LC
  Codec ID                                 : 40
  Duration                                 : 1h 47mn
  Bit rate mode                            : Variable
  Bit rate                                 : 93.7 Kbps
  Maximum bit rate                         : 110 Kbps
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz
  Compression mode                         : Lossy
  Stream size                              : 71.8 MiB (9%)
  Language                                 : English
  Encoded date                             : UTC 2014-11-19 03:58:38
  Tagged date                              : UTC 2014-11-19 03:58:40
  </code></pre>
  
  <p>Trying</p>
  
  <pre><code>mencoder foo.mp4 -sub foo.srt -ovc lavc -oac pcm -o foo.mpg
  </code></pre>
  
  <p>works, but produces a video that is visibly worse with regard to quality.</p>
  
  <p>I suppose <code>ffmpeg</code> could also be an option, but I've not figured out how to use it to do this.</p>
  
  <p>I'm using Debian wheezy. The versions of <code>mencoder</code> and <code>ffmpeg</code> that ship with wheezy are:</p>
  
  <p>2:1.0~rc4.dfsg1+svn34540-1+deb7u1 (mencoder)</p>
  
  <p>6:0.8.16-1 (ffmpeg)</p>
  
  <p>However, I managed to backport a newer version of <code>ffmpeg</code> from unstable,
  namely: <code>7:2.5.1-1</code>.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-01T18:33:42.620Z
Comments.Text: What output format do you want exactly? I see you used the AVI container in the question, but that doesn't tell me your desired video and audio formats.
Comments.UserDisplayName: llogan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-03-01T20:38:40.237Z
Comments.Text: @LordNeckbeard Hi. The `avi` was a typo. The answer is, whatever I can eventually create a DVD with. This usually involves creating a DVD structure, and then an ISO from that. The first step involves creating a file from the original video file using `ffmpeg`, and I give this a `mpg` extension for reasons I'm not clear. After that this file is processed by `dvdauthor` to produce a directory structure, and then converted into an iso with `genisoimage`. So, I suppose that answer is, whatever formats work.
Comments.UserDisplayName: Faheem Mitha
Tags: <ffmpeg><subtitles>
Title: Merging mp4 video stream with subtitles for use in creating DVD
UserDisplayName: Faheem Mitha
ThreadText: # Merging mp4 video stream with subtitles for use in creating DVD
  
  (Asked by: username_0 on 2015-03-01)
  
  Suppose I have two files called `foo.mp4` and `foo.srt`. The mp4 file doesn't have subtitles, and I want to add subtitles from the `foo.srt` file.
  
  The utility `mencoder` is frequently recommended in this context. I tried using, for example:
  
  ```
  mencoder foo.mp4 -sub foo.srt -ovc lavc -oac copy -o foo.mpg
  
  ```
  
  This worked for me before. However, here I get
  
  ```
  Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.
  
  ```
  
  I don't know what this means. Running `mediainfo` on this file gives the following information for the `audio` stream.
  
  ```
  Audio
  ID                                       : 2
  Format                                   : AAC
  Format/Info                              : Advanced Audio Codec
  Format profile                           : LC
  Codec ID                                 : 40
  Duration                                 : 1h 47mn
  Bit rate mode                            : Variable
  Bit rate                                 : 93.7 Kbps
  Maximum bit rate                         : 110 Kbps
  Channel(s)                               : 2 channels
  Channel positions                        : Front: L R
  Sampling rate                            : 48.0 KHz
  Compression mode                         : Lossy
  Stream size                              : 71.8 MiB (9%)
  Language                                 : English
  Encoded date                             : UTC 2014-11-19 03:58:38
  Tagged date                              : UTC 2014-11-19 03:58:40
  
  ```
  
  Trying
  
  ```
  mencoder foo.mp4 -sub foo.srt -ovc lavc -oac pcm -o foo.mpg
  
  ```
  
  works, but produces a video that is visibly worse with regard to quality.
  
  I suppose `ffmpeg` could also be an option, but I've not figured out how to use it to do this.
  
  I'm using Debian wheezy. The versions of `mencoder` and `ffmpeg` that ship with wheezy are:
  
  2:1.0~rc4.dfsg1+svn34540-1+deb7u1 (mencoder)
  
  6:0.8.16-1 (ffmpeg)
  
  However, I managed to backport a newer version of `ffmpeg` from unstable,
  namely: `7:2.5.1-1`.
  
  **Tags:** ffmpeg, subtitles
  
  > **Comments:**
  > **username_1**: What output format do you want exactly? I see you used the AVI container in the question, but that doesn't tell me your desired video and audio formats.  
  > **username_0**: @LordNeckbeard Hi. The `avi` was a typo. The answer is, whatever I can eventually create a DVD with. This usually involves creating a DVD structure, and then an ISO from that. The first step involves creating a file from the original video file using `ffmpeg`, and I give this a `mpg` extension for reasons I'm not clear. After that this file is processed by `dvdauthor` to produce a directory structure, and then converted into an iso with `genisoimage`. So, I suppose that answer is, whatever formats work.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-03-01. Score: 2
  
  Use the [`subtitles`](https://ffmpeg.org/ffmpeg-filters.html#subtitles-1) filter to create hardsubs ("burnt-in" subtitles):
  
  ```
  ffmpeg -i input.mp4 -vf subtitles=subs.srt -target pal-dvd output.mpg
  
  ```
  
  * `-target pal-dvd` will make the output have a frame rate of 25 and a frame size of 720x576. If you want NTSC output instead for a frame rate of 30000/1001 and frame size of 720x480, then use `-target ntsc-dvd`. For a frame rate of 24000/1001 and 720x480 frame size use `-target film-dvd`.
  * The old, so-called "`ffmpeg`" version 0.8.16 in the repo is a counterfeit from a fork that lacks the `subtitles` filter. If you need the real thing you can simply [download a static build](https://ffmpeg.org/download.html).
  * I do not believe `ffmpeg` can convert the text-based SRT to the bitmap-based dvdsub/vobsub, but there are probably other tools that can do so. This will allow you to use standard DVD subtitles which can be turned on or off by the viewer.
  
  > **Comments:**
  > **username_0**: Thank you. That is very comprehensive. By "counterfeit"   I assume you mean that unfortunate fork? I think that the "7:2.5.1-1" is the real thing, correct? Would the result of `-target film-dvd` work on a regular DVD player?  
  > **username_1**: @username_0 I assume it is. If you run `ffmpeg`, the first line in the console output will tell you who developed it. If it displays `FFmpeg Developers` it is the real thing.  
  > **username_0**: Also, is `mencoder` not a suitable tool for such a task? It seems to be widely recommended for doing such things on the net.  
  > **username_1**: @username_0 I believe development of `mencoder` has basically ceased some time ago, but if it works for you and you prefer it, go ahead and use it.  
  > **username_0**: I'd certainly prefer to use something supported, but isn't mencoder part of mplayer? Why do you think mencoder development has ceased?  
  > **username_1**: @username_0 Looks like there has been ~14 commits to `mplayer.c` since 2012. Last commit was 2014-05-20. Not a perfect means of measurement, but that will give a good idea of activity. Looks like there have been ~7023 commits to FFmpeg since 2014-05-20. Also not a perfect measurement because that includes all commits to the whole project.  
  > **username_0**: Do you mean `mencoder.c`, perhaps? I don't see an `mplayer.c` there. I cloned mplayer from svn. `svn info` gives "Repository Root: svn://svn.mplayerhq.hu/mplayer". And `mencoder.c` has 10 commits since the beginning of 2013.  
  > **username_1**: @username_0 Yes, that was a typo. Should have been `mencoder.c`, but the numbers remain the same.  
  > **username_0**: We must be using different repositories. I have `2014-05-21` as the last commit, and it's definitely 10 commits since the beginning of 2013. But it doesn't really matter - I get your point.  
  > **username_1**: @username_0 Same repository. 10 commits since 2013 + 4 more since 2012 = 14.  
  > **username_0**: Oh, you were talking about commits since the beginning of 2012. That was not clear to me. Then, yes, 14 commits since 1st January 2012. And yes, that isn't a lot of activity. Those maybe the software is mature/stable now. Dunno.  
  
  ---
  
  