3

I have an MKV that I am using to create a DVD using DeVeDe

The MKV has embedded subtitles in vobsub format, which DeVeDe does not support (or bugged, not sure)

I decided to burn the subtitles to the output using the extra ffmpeg parameters option, which I took from here:

https://trac.ffmpeg.org/wiki/How%20to%20burn%20subtitles%20into%20the%20video

So I've updated to the latest ffmpeg and added the following extra parameters:

-filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a

So the complete command is:

ffmpeg -i ~/Input.mkv -vf scale=720:412,fifo,pad=720:576:0:82:0x000000 -y -target pal-dvd -sn -acodec copy -g 12 -t 60.0 -ac 2 -s 720x576 -threads 3 -trellis 1 -mbd 2 -b 2616000 -aspect 16:9 /var/tmp/previewfile_01_01.mpg -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a

But out of DeVeDe I get:

[AVFilterGraph @ 0xa744ca0] No such filter: '"'

Running it in a shell gets:

Output pad "default" with type video of the filter instance "Parsed_overlay_0" of overlay not connected to any destination

The documentation for the filter is here: http://ffmpeg.org/ffmpeg-filters.html#overlay-1

But I can't make head or tail of it. The -map parameters a mystery as well.

Here's the details the streams:

Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m), 720x336 [SAR 21845:18873 DAR 109225:44037], SAR 199:172 DAR 2985:1204, 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
Stream #0:2(eng): Subtitle: dvd_subtitle, 720x480

Complete output from devede:

Launching program:  ffmpeg -i ~/input.mkv -vf scale=720:412,fifo,pad=720:576:0:82:0x000000 -y -target pal-dvd -sn -acodec copy -g 12 -t 60.0 -ac 2 -s 720x576 -threads 3 -trellis 1 -mbd 2 -b 2616000 -aspect 16:9 /var/tmp/previewfile_01_01.mpg -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a
elemento:  /usr/bin
ffmpeg version N-59114-gcc0e2ba Copyright (c) 2000-2013 the FFmpeg developers
Input #0, matroska,webm, from '~/input.mkv':
  Duration: 03:03:11.13, start: 0.000000, bitrate: 898 kb/s
    Chapter #0.0: start 0.000000, end 232.982856
    Metadata:
      title           : Chapter 1
    Chapter #0.1: start 232.982856, end 479.729356
    Metadata:
      title           : Chapter 2
    Chapter #0.2: start 479.729356, end 573.322856
    Metadata:
      title           : Chapter 3
    Chapter #0.3: start 573.322856, end 1007.089522
    Metadata:
      title           : Chapter 4
    Chapter #0.4: start 1007.089522, end 1375.590989
    Metadata:
      title           : Chapter 5
    Chapter #0.5: start 1375.590989, end 2044.258989
    Metadata:
      title           : Chapter 6
    Chapter #0.6: start 2044.258989, end 2395.443156
    Metadata:
      title           : Chapter 7
    Chapter #0.7: start 2395.443156, end 2863.110356
    Metadata:
      title           : Chapter 8
    Chapter #0.8: start 2863.110356, end 3193.657244
    Metadata:
      title           : Chapter 9
    Chapter #0.9: start 3193.657244, end 3327.290744
    Metadata:
      title           : Chapter 10
    Chapter #0.10: start 3327.290744, end 3801.214189
    Metadata:
      title           : Chapter 11
    Chapter #0.11: start 3801.214189, end 4209.622189
    Metadata:
      title           : Chapter 12
    Chapter #0.12: start 4209.622189, end 4484.897189
    Metadata:
      title           : Chapter 13
    Chapter #0.13: start 4484.897189, end 4971.299778
    Metadata:
      title           : Chapter 14
    Chapter #0.14: start 4971.299778, end 5710.371444
    Metadata:
      title           : Chapter 15
    Chapter #0.15: start 5710.371444, end 5999.627078
    Metadata:
      title           : Chapter 16
    Chapter #0.16: start 5999.627078, end 6423.417111
    Metadata:
      title           : Chapter 17
    Chapter #0.17: start 6423.417111, end 6593.470322
    Metadata:
      title           : Chapter 18
    Chapter #0.18: start 6593.470322, end 7171.923244
    Metadata:
      title           : Chapter 19
    Chapter #0.19: start 7171.923244, end 7462.630322
    Metadata:
      title           : Chapter 20
    Chapter #0.20: start 7462.630322, end 8388.505278
    Metadata:
      title           : Chapter 21
    Chapter #0.21: start 8388.505278, end 8734.233989
    Metadata:
      title           : Chapter 22
    Chapter #0.22: start 8734.233989, end 9171.087078
    Metadata:
      title           : Chapter 23
    Chapter #0.23: start 9171.087078, end 9439.688744
    Metadata:
      title           : Chapter 24
    Chapter #0.24: start 9439.688744, end 9770.936322
    Metadata:
      title           : Chapter 25
    Chapter #0.25: start 9770.936322, end 10253.918822
    Metadata:
      title           : Chapter 26
    Chapter #0.26: start 10253.918822, end 10732.396822
    Metadata:
      title           : Chapter 27
    Chapter #0.27: start 10732.396822, end 10991.130000
    Metadata:
      title           : Chapter 28
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m), 720x336 [SAR 21845:18873 DAR 109225:44037], SAR 199:172 DAR 2985:1204, 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
    Stream #0:2(eng): Subtitle: dvd_subtitle, 720x480
Please use -b:a or -b:v, -b is ambiguous
[AVFilterGraph @ 0x9c18ca0] No such filter: '"'
Error configuring filters.
Creating window /usr/share/devede/werror_dialog.ui

If I copy that command to a shell the output is different:

    $ ffmpeg -i ~/input.mkv -vf scale=720:412,fifo,pad=720:576:0:82:0x000000 -y -target pal-dvd -sn -acodec copy -g 12 -t 60.0 -ac 2 -s 720x576 -threads 3 -trellis 1 -mbd 2 -b 2616000 -aspect 16:9 /var/tmp/previewfile_01_01.mpg -filter_complex "[0:v][0:s]overlay[v]" -map [v] -map 0:a
    ffmpeg version N-59114-gcc0e2ba Copyright (c) 2000-2013 the FFmpeg developers
      built on Dec 15 2013 05:22:20 with gcc 4.6 (Debian 4.6.3-1)
      configuration: --prefix=/root/ffmpeg-static/32bit --arch=x86_32 --extra-cflags='-m32 -I/root/ffmpeg-static/32bit/include -static' --extra-ldflags='-m32 -L/root/ffmpeg-static/32bit/lib -static' --extra-libs='-lxml2 -lexpat -lfreetype' --enable-static --disable-shared --disable-ffserver --disable-doc --enable-bzlib --enable-zlib --enable-postproc --enable-runtime-cpudetect --enable-libx264 --enable-gpl --enable-libtheora --enable-libvorbis --enable-libmp3lame --enable-gray --enable-libass --enable-libfreetype --enable-libopenjpeg --enable-libspeex --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-version3 --enable-libvpx
      libavutil      52. 58.100 / 52. 58.100
      libavcodec     55. 45.101 / 55. 45.101
      libavformat    55. 22.100 / 55. 22.100
      libavdevice    55.  5.102 / 55.  5.102
      libavfilter     3. 92.100 /  3. 92.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
      libpostproc    52.  3.100 / 52.  3.100
    Trailing options were found on the commandline.
    Input #0, matroska,webm, from '~/input.mkv':
      Duration: 03:03:11.13, start: 0.000000, bitrate: 898 kb/s
        Chapter #0.0: start 0.000000, end 232.982856
        Metadata:
          title           : Chapter 1
        Chapter #0.1: start 232.982856, end 479.729356
        Metadata:
          title           : Chapter 2
        Chapter #0.2: start 479.729356, end 573.322856
        Metadata:
          title           : Chapter 3
        Chapter #0.3: start 573.322856, end 1007.089522
        Metadata:
          title           : Chapter 4
        Chapter #0.4: start 1007.089522, end 1375.590989
        Metadata:
          title           : Chapter 5
        Chapter #0.5: start 1375.590989, end 2044.258989
        Metadata:
          title           : Chapter 6
        Chapter #0.6: start 2044.258989, end 2395.443156
        Metadata:
          title           : Chapter 7
        Chapter #0.7: start 2395.443156, end 2863.110356
        Metadata:
          title           : Chapter 8
        Chapter #0.8: start 2863.110356, end 3193.657244
        Metadata:
          title           : Chapter 9
        Chapter #0.9: start 3193.657244, end 3327.290744
        Metadata:
          title           : Chapter 10
        Chapter #0.10: start 3327.290744, end 3801.214189
        Metadata:
          title           : Chapter 11
        Chapter #0.11: start 3801.214189, end 4209.622189
        Metadata:
          title           : Chapter 12
        Chapter #0.12: start 4209.622189, end 4484.897189
        Metadata:
          title           : Chapter 13
        Chapter #0.13: start 4484.897189, end 4971.299778
        Metadata:
          title           : Chapter 14
        Chapter #0.14: start 4971.299778, end 5710.371444
        Metadata:
          title           : Chapter 15
        Chapter #0.15: start 5710.371444, end 5999.627078
        Metadata:
          title           : Chapter 16
        Chapter #0.16: start 5999.627078, end 6423.417111
        Metadata:
          title           : Chapter 17
        Chapter #0.17: start 6423.417111, end 6593.470322
        Metadata:
          title           : Chapter 18
        Chapter #0.18: start 6593.470322, end 7171.923244
        Metadata:
          title           : Chapter 19
        Chapter #0.19: start 7171.923244, end 7462.630322
        Metadata:
          title           : Chapter 20
        Chapter #0.20: start 7462.630322, end 8388.505278
        Metadata:
          title           : Chapter 21
        Chapter #0.21: start 8388.505278, end 8734.233989
        Metadata:
          title           : Chapter 22
        Chapter #0.22: start 8734.233989, end 9171.087078
        Metadata:
          title           : Chapter 23
        Chapter #0.23: start 9171.087078, end 9439.688744
        Metadata:
          title           : Chapter 24
        Chapter #0.24: start 9439.688744, end 9770.936322
        Metadata:
          title           : Chapter 25
        Chapter #0.25: start 9770.936322, end 10253.918822
        Metadata:
          title           : Chapter 26
        Chapter #0.26: start 10253.918822, end 10732.396822
        Metadata:
          title           : Chapter 27
        Chapter #0.27: start 10732.396822, end 10991.130000
        Metadata:
          title           : Chapter 28
        Stream #0:0(eng): Video: h264 (High), yuv420p(tv, smpte170m), 720x336 [SAR 21845:18873 DAR 109225:44037], SAR 199:172 DAR 2985:1204, 23.98 fps, 23.98 tbr, 1k tbn, 180k tbc (default)
        Stream #0:1(eng): Audio: ac3, 48000 Hz, stereo, fltp, 192 kb/s (default)
        Stream #0:2(eng): Subtitle: dvd_subtitle, 720x480
    Please use -b:a or -b:v, -b is ambiguous
    Output pad "default" with type video of the filter instance "Parsed_overlay_0" of overlay not connected to any destination

How to I burn that subtitle stream to the output video?

2
  • Please include your complete ffmpeg console output.
    – llogan
    Dec 15, 2013 at 18:23
  • Added more info as requested.
    – RoboJ1M
    Dec 17, 2013 at 19:22

3 Answers 3

5

The problems

I see several issues with your command:

  • All filtering should be within one filtergraph.

  • You have many contradicting commands: for example you use the scale video filter, then you use -target which will scale, and you use -s which will also scale. You use -acodec copy to stream copy the audio, but you also include -ac 2 to force stereo. These are mutually exclusive so something is being ignored.

  • You placed options after the output. I'm not sure how ffmpeg will interpret that. Option placement matters.

Example

Who's a good pig?

ffmpeg -y -i input.mkv -filter_complex "[0:v:0][0:s:0]overlay[vid]" -map "[vid]" -map 0:a \
-target pal-dvd -acodec copy -t 60 output.mpg

Note

Your video is 720x336, but your subtitles are 720x480. You may have to use crop on the subtitles before using overlay:

[0:s:0]crop=iw:336[s1];[0:v:0][s1]overlay[vid]

Or alternatively you could use a negative value on the y coordinate in overlay:

[0:v:0][0:s:0]overlay=0:H-h[vid]
5

Assume your input files are infile.mp4, infile.idx and infile.sub, and you wish to combine them all into outfile.mkv, the following is what you need:

ffmpeg -i infile.mp4 -i infile.idx -i infile.sub -map 0:v -map 0:a -c copy -map 1 -c:s:1 dvd_subtitle -metadata:s:s:1 language=fre outfile.mkv
3
  • this works brilliantly, and should be the accepted answer
    – evandrix
    Jul 17, 2019 at 17:27
  • I agree with @evandrix Apr 3, 2020 at 20:09
  • I don't think this burns the subtitle. Sep 6, 2020 at 14:11
1
ffmpeg -i the_equalizer3.mpg -i the_equalizer3.sub -i the_equalizer3.idx -filter_complex "[0:v][2:s]overlay" -vcodec mpeg4 -vb 6000000 -r 59.94 -aspect 16:9 -acodec libmp3lame -async 48000 -vol 1250 the_equalizer-captioned2.mp4

The -filter complex stuff is the important part, above - input 0 is video, input 2 is subtitles, for the overlay.

If you have separate vobsub file and idx file, I had some degree of success with above command (using a recent static git release of ffmpeg). The interesting thing was that I had to specify the .idx file for the overlay not the .sub file. Perhaps extracting the sub title stream, and then import the extracted files when encoding might work?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .