[FFmpeg-user] make mpeg2 file with hardcoded subs from .srt file

gepebril compuvision.sr at gmail.com
Thu Jul 11 19:04:18 CEST 2013


Ok,

Still not clear though. I see that the gui removes all previous text from
the former mail. So that is probably not-top posting.

Anyway, after some hours of testing and wandering around the Net. I managed
to get it working on Windows with ffmpeg. Although it seems possible to
generate all kinds of different fonts using .srt, there is no actual working
sample off it on the Net, which I found.
That left me to a working solution, thanks to this  this
<http://forum.serviio.org/viewtopic.php?f=3&t=8255>   webpage. Basically the
trick is:
1) convert your .srt to .ass file (with ffmpeg)
2) Use Windows 
3) Follow the instruction on the website 
4) Render.

In commands it looks like this (create .ass file from .srt):
ffmpeg.exe -i subtitle_file.srt -y -scodec ass subtitle_file.ass


Make sure you have the local variables set right
set FC_CONFIG_DIR=E:\temp\Subtitles
set FONTCONFIG_FILE=fonts.xml
set FONTCONFIG_PATH=E:\temp\Subtitles

And use the related example of fonts.xml
<?xml version="1.0"?>
<fontconfig>

<dir>C:\WINDOWS\Fonts</dir>

<match target="pattern">
   <test qual="any" name="family"><string>mono</string></test>
   <edit name="family" mode="assign"><string>monospace</string></edit>
</match>

<match target="pattern">
   <test qual="all" name="family"
mode="not_eq"><string>sans-serif</string></test>
   <test qual="all" name="family"
mode="not_eq"><string>serif</string></test>
   <test qual="all" name="family"
mode="not_eq"><string>monospace</string></test>
   <edit name="family" mode="append_last"><string>sans-serif</string></edit>
</match>

<alias>
   <family>Times</family>
   <prefer><family>Times New Roman</family></prefer>
   <default><family>serif</family></default>
</alias>
<alias>
   <family>Helvetica</family>
   <prefer><family>Arial</family></prefer>
   <default><family>sans</family></default>
</alias>
<alias>
   <family>Courier</family>
   <prefer><family>Courier New</family></prefer>
   <default><family>monospace</family></default>
</alias>
<alias>
   <family>serif</family>
   <prefer><family>Times New Roman</family></prefer>
</alias>
<alias>
   <family>sans</family>
   <prefer><family>Arial</family></prefer>
</alias>
<alias>
   <family>monospace</family>
   <prefer><family>Andale Mono</family></prefer>
</alias>
<match target="pattern">
   <test name="family" mode="eq">
      <string>Courier New</string>
   </test>
   <edit name="family" mode="prepend">
      <string>monospace</string>
   </edit>
</match>
<match target="pattern">
   <test name="family" mode="eq">
      <string>Courier</string>
   </test>
   <edit name="family" mode="prepend">
      <string>monospace</string>
   </edit>
</match>

</fontconfig>

Create your video file with burned in subs
ffmpeg.exe -y -i "src.mkv"  -f dvd -target ntsc-dvd -r 29.97 -vf
scale=720:480 -vf "ass=subtitle_file.ass" -aspect 16:9 -b:v 8000k -g 12 -mbd
rd -trellis 1 -flags +mv0 -cmp 0 -subcmp 2 e:\dst.mpg


Note: make sure that the .ass file is in the same path as where are, as I
haven't managed to get a path reference working with ass 



--
View this message in context: http://ffmpeg-users.933282.n4.nabble.com/make-mpeg2-file-with-hardcoded-subs-from-srt-file-tp4659902p4659934.html
Sent from the FFmpeg-users mailing list archive at Nabble.com.


More information about the ffmpeg-user mailing list