2

I would like to hardcode subtitles using FFmpeg, I'm trying to do this using the following command:

ffmpeg -i grdedFinal.mov -vf subtitles=portSbs.srt gradedFinalwithSubs.mov

which returns the following error:

ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'grdedFinal.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2015-02-28 14:04:35
  Duration: 00:18:09.84, start: 0.000000, bitrate: 11270 kb/s
    Stream #0:0(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2015-02-28 14:04:35
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1024x576, 9728 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc (default)
    Metadata:
      creation_time   : 2015-02-28 14:04:35
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
[Parsed_subtitles_0 @ 0x7fbeaa50bca0] Shaper: FriBidi 0.19.7 (SIMPLE) HarfBuzz-ng 1.1.3 (COMPLEX)
[Parsed_subtitles_0 @ 0x7fbeaa50bca0] Unable to open portSbs.srt
[AVFilterGraph @ 0x7fbeaa50ba80] Error initializing filter 'subtitles' with args 'portSbs.srt'
Error opening filters!

I followed those instructions when installing FFmpeg:

brew install ffmpeg --with-fdk-aac --with-ffplay --with-freetype --with-frei0r --with-libass --with-libvo-aacenc --with-libvorbis --with-libvpx --with-opencore-amr --with-openjpeg --with-opus --with-rtmpdump --with-schroedinger --with-speex --with-theora --with-tools

Feedback following comments

1st suggestion

Judging by the error message, it appears that something may be wrong with the SRT file, isn't it?

me-bash-3.2:/Volumes/Duracell$ ffmpeg -i gradedFinal.mov -i portSbs.srt -vf subtitles gradedFinalwithSubs.mov
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'gradedFinal.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 537199360
    compatible_brands: qt
    creation_time   : 2015-02-28 14:04:35
  Duration: 00:18:09.84, start: 0.000000, bitrate: 11267 kb/s
    Stream #0:0(eng): Audio: pcm_s16le (sowt / 0x74776F73), 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      creation_time   : 2015-02-28 14:04:35
      handler_name    : Apple Alias Data Handler
    Stream #0:1(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1024x576, 9728 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc (default)
    Metadata:
      creation_time   : 2015-02-28 14:04:35
      handler_name    : Apple Alias Data Handler
      encoder         : H.264
portSbs.srt: Invalid data found when processing input

Subtitle file

The subtitle file looks like that (extract):

1
00:02:25,000 —> 00:02:29,000
Falei com um homem que me disse que eu estava a usar
demasiada roupa


2
00:02:29,000 –> 00:02:31,000
Que com isso devo querer proteger-me de alguma coisa

File info

me-bash-3.2:/Volumes/Duracell$ file -I portSbs.srt
portSbs.srt: text/plain; charset=utf-8

2nd, checking filter

me-bash-3.2:/Volumes/Duracell$ ffmpeg -help filter=subtitles
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libtheora --enable-libvorbis --enable-libvpx --enable-librtmp --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libass --enable-ffplay --enable-libspeex --enable-libschroedinger --enable-libfdk-aac --enable-libopus --enable-frei0r --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/1.5.2_1/include/openjpeg-1.5 --enable-nonfree --enable-vda
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Filter subtitles
  Render text subtitles onto input video using the libass library.
    Inputs:
       #0: default (video)
    Outputs:
       #0: default (video)
subtitles AVOptions:
  filename          <string>     ..FV.... set the filename of file to read
  f                 <string>     ..FV.... set the filename of file to read
  original_size     <image_size> ..FV.... set the size of the original video (used to scale fonts)
  fontsdir          <string>     ..FV.... set the directory containing the fonts to read
  charenc           <string>     ..FV.... set input character encoding
  stream_index      <int>        ..FV.... set stream index (from -1 to INT_MAX) (default -1)
  si                <int>        ..FV.... set stream index (from -1 to INT_MAX) (default -1)
  force_style       <string>     ..FV.... force subtitle style
  • 1
    It says, "Unable to open portSbs.srt". Recheck the filename, and refer to it with the full path. If that doesn't work, try with another (known good) SRT. – Gyan Jan 31 '16 at 4:53
  • @Mulvya Thanks very much for showing interest, I tried passing the full path /Volumes/Duracell/portSbs.srt but I arrived at the same error message. The file appears to be not damaged, I can open and edit it in a text editor. – Konrad Jan 31 '16 at 8:26
  • 1
    Run ffmpeg -i grdedFinal.mov -i portSbs.srt -vf subtitles gradedFinalwithSubs.mov and paste the console output into your question. – Gyan Jan 31 '16 at 9:01
  • @Mulvya Thanks very much for the helpful comments, I pasted additional output. – Konrad Jan 31 '16 at 10:04
  • 1
    Let's confirm that subtitle filter is compiled in: ffmpeg -help filter=subtitles <-- does that say unknown filter? – Gyan Jan 31 '16 at 11:05
2

It appears that the subtitles file did not have --> but a –> with the corresponding to the en dash that was placed in the file, which was edited by hand externally. It seems like the en dash sign was assigned to typing -- in Mac TextEdit (the functionality can be disabled in preferences).

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.