1

I'm using a cygwin64 build of ffmpeg (1, 2) to burn subtitles into a video file as follows:

$ ffmpeg -i file.mp4 -vf subtitles=file.srt file.ts
ffmpeg version 1.2.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Sep 18 2013 01:11:22 with gcc 4.8.1 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/bin --incdir=/usr/include --mandir=/usr/share/man --disable-static --enable-shared --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-pthreads --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcdio --enable-libcelt --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopencv --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libtwolame --disable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --disable-libxavs --enable-openal --enable-x11grab --enable-zlib --disable-debug --disable-optimizations --enable-yasm --disable-stripping
  libavutil      52. 18.100 / 52. 18.100
  libavcodec     54. 92.100 / 54. 92.100
  libavformat    54. 63.104 / 54. 63.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 42.103 /  3. 42.103
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    creation_time   : 2013-07-18 23:29:41
    encoder         : Lavf51.12.1
  Duration: 00:21:59.66, start: 0.000000, bitrate: 5461 kb/s
    Stream #0:0(eng): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 5135 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc
    Metadata:
      creation_time   : 2013-07-19 02:21:28
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 319 kb/s
    Metadata:
      creation_time   : 2013-07-19 02:21:28
      handler_name    : SoundHandler
[srt @ 0x600057e80] Estimating duration from bitrate, this may be inaccurate
Output #0, mpegts, to 'file.ts':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf54.63.104
    Stream #0:0(eng): Video: mpeg2video, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 90k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2013-07-19 02:21:28
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: mp2, 48000 Hz, stereo, s16, 128 kb/s
    Metadata:
      creation_time   : 2013-07-19 02:21:28
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg2video)
  Stream #0:1 -> #0:1 (aac -> mp2)
Press [q] to stop, [?] for help
[Parsed_subtitles_0 @ 0x6000229c0] Neither PlayResX nor PlayResY defined. Assuming 384x288

But the subtitles do not appear in the resulting video stream at all.

The [Parsed_subtitles_0 @ 0x6000229c0] Neither PlayResX nor PlayResY defined. Assuming 384x288 warning is not a part of the problem, as converting the subtitles to .ass via ffmpeg -i file.srt file.ass and specifying the PlayResX and Y values makes the warning disappear without solving the original issue.

I know that the libass library, which provides the subtitles filter to ffmpeg, uses fontconfig, which is known not to work out-of-box under windows. However, the lack of any fontconfig warnings makes me believe that this is not the problem here. Any leads as to what might the cause of the problem be?

EDIT: I have downloaded and compiled ffmpeg myself:

$ git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
$ cd ffmpeg
$ ./configure --enable-static --disable-shared --enable-libass
$ make

The output of the conversion ./ffmpeg -i file.mp4 -vf subtitles=file.srt file.ts is identical except for the fact that no warning messages get printed this time around. I'm looking into whether the fontconfig library configuration could be the culprit.

  • And, your programming question is........ – KevinDTimm Aug 21 '14 at 20:23
  • The question is why that is the case. I'm assuming this isn't a bug, but a result of misconfiguration / lack of command line options. I'd say that qualifies as a programming question? If not, where do you propose I post this inquiry? – Witiko Aug 21 '14 at 20:31
  • do zeranoe builds work? trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo is about all I know about it... – rogerdpack Aug 21 '14 at 20:36
  • The Zeranoe builds suffer from fontconfig misconfiguration plus they aren't native cygwin executables. That's why instead of manually configuring fontconfig (ffmpeg.zeranoe.com/forum/…) I tried this build, which claims to have been statically linked to the libass library. I will try the Zeranoe builds and post the results. – Witiko Aug 21 '14 at 20:54
  • I have posted a solution, changed the title to reflect the more general problem it solves and flagged the question for migration to unix.stackexchange.com – Witiko Aug 22 '14 at 11:36
10

As it turns out, the cygwin fontconfig package does not, by default, inherit the Windows fonts. I have fixed this by symlinking the C:\Windows\Fonts folder to one of the fontconfig folders and updating the font cache as follows:

$ ln -s /cygdrive/c/Windows/Fonts /usr/share/fonts/win-fonts
$ fc-cache

Alternatively, the cygwin ports repository contains numerous font-* X11 packages, which can be installed to a similar end, while keeping the cygwin and Windows fonts separate.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.