You are not logged in.

#1 2014-04-26 16:52:04

teckk
Member
Registered: 2013-02-21
Posts: 519

How to overlay bitmap dvd_subs with ffmpeg.

For anyone who is interested, or needs help with this.
Overlaying bitmap dvd_subs onto an output video with ffmpeg.

Another words, making a video from a DVD, selecting a subtitle stream, overlaying the
subtitles onto the video without having to convert the subs to another format and then
doing OCR on them.

If you can't find the sub streams with ffmpeg -i or ffprobe it's probably
because the sub stream starts later in the video than ffmpeg has probed. You can solve
that with

ffmpeg -probesize 1000000000 -analyzeduration 100000000 -i video.vob

Then determine what sub, video and audio stream you want.

These examples will be for a disk that has video stream 0:0, 1st audio stream 0:1,
2nd audio stream 0:2, 1st sub stream 0:3, 2nd sub stream 0:4. Use your own
options to encode the audio-video.

In the first example:
Overlay dvd_subs onto video (1st vid stream 0:0, 2nd audio stream 0:2, 2nd sub stream 0:4).

ffmpeg -probesize 1000000000 -analyzeduration 100000000 -i movie.vob \
-filter_complex "[0:0][0:4]overlay[0]" -map [0] -map 0:2 -c:a copy \
-c:v libx264 -b:v 2500k movie.avi

In the second example:
Do the same thing a little differently. Stream one is 0, stream two is 1 etc.

ffmpeg -probesize 1000000000 -analyzeduration 100000000 -i movie.vob \
-filter_complex "[0:v][0:s:1]overlay[v]" -map [v] -map 0:a:1 -c:a copy \
-c:v libx264 -b:v 2500k movie.avi

Third example:
Overlay dvd_subs onto video with video cropping and subtitles scaled to fit
the video.
Video cropped=a, Subs scaled=b, Overlay(b over a)=c

ffmpeg -probesize 1000000000 -analyzeduration 100000000 -i movie.vob \
-filter_complex "[0:0]crop=706:362:8:56[a];[0:4]scale=706:362[b];[a][b]overlay[c]" \
-map [c] -map 0:2 -c:a copy -c:v libx264 -b:v 2500k movie.avi

Offline

Board footer

Powered by FluxBB