[FFmpeg-user] Subtitle questions...

Mason Loring Bliss mason at blisses.org
Tue Jan 5 23:21:46 EET 2021

Hi all. I've asked a couple times on Freenode, but I think my timing is
bad, so I'll ask some questions here instead.

My ultimate goal is to keep my DVD collection in digital form, with the
actual disks sitting in a box in the cellar, but I want to preserve as much
quality as possible, so I've been generally just storing the entire image,
gathered via vobcopy.

I have two special use cases that have me interested in ffmpeg. 1) I want
to be able to break out titles for disks with several videos (episodes) per
disk, and 2) I have some disks that seems to have copy protection where the
result from vobcopy is absolutely enormous, so I just want to pull out
specific titles.

I could use HandBrake for both these cases, but I'd rather not transcode,
so instead I've been pulling out specific titles with mplayer, and then,
because timestamps are often incoherent after this, pushing the result
through ffmpeg.

An example:

mplayer -dumpstream -dumpfile foo.vob dvd://3 -dvd-device foo/

ffmpeg -fflags +genpts -fflags +igndts -i foo.vob \
    -loglevel warning -stats \
    -map 0:v -c:v copy \
    -map 0:a:1 -map 0:a:3 -map 0:a:5 -c:a copy \
    -metadata:s:a:0 language=eng \
    -metadata:s:a:1 language=eng \
    -metadata:s:a:2 language=fra \
    -map 0:s:2 -map 0:s:6 -map 0:s:10 -c:s copy -disposition:s 0 \
    -metadata:s:s:0 language=eng \
    -metadata:s:s:1 language=fra \
    -metadata:s:s:2 language=spa \

Here's my first question. Using VLC in every case, when I play the original
media, subtitles are disabled by default. If I run the process I just noted
but emit an mp4 instead of an mkv, subtitles behave as expected. However,
if I run the process and emit an mkv, the last subtitle is on by default.
I'm not sure why this would vary based on output format, especially since a
simpler case preserves the desired subtitle behaviour for mkv. This was
recommended on Freenode #ffmpeg:

    ffmpeg -i input -map 0 -c copy -disposition:s 0 out

...and that works regardless of whether I'm emitting mp4 or mkv. But when
I start selecting tracks with -map, the behaviour changes for mkv, and
rather than subtitles being disabled, the last subtitle stream is on by
default. Is this expected behaviour, and if it is, what's happening?

My second question... It seemed worth trying cropdetect to save some space
on letterboxing, but when I use the cropdetect filter rather than copy, it
seems that I'm also transcoding to h.264, rather than copying the vob data,
which I believe is MPEG-1/2. Here's where my knowledge falls short. If
MPEG-1/2 is already a lossy format, isn't going to h.264 transcoding from
lossy to lossy and hence something I want to avoid? Is there a way to
cropdetect without losing any more data than was lost when the video was
encoded to DVD in the first place?

In a paper I found, it seemed that quality level 17 was the lowest-quality
setting in the "indistinguishable from source" range. However, if this is
still strictly lossy compression, is there a way to specify to ffmpeg that
I want it to simply accept the original material's choices about what can
safely be discarded and instead put more time into compression or somesuch?
(Related, can all of this be invoked when I'm specifying use of the
cropdetect filter?)

In case it matters, for all of this I'm using ffmpeg 7:4.1.6-1~deb10u1. I'm
not opposed to snagging more recent source and doing a local build, if
there's stuff I want that's only in newer code.

Mason Loring Bliss             mason at blisses.org            Ewige Blumenkraft!
(if awake 'sleep (aref #(sleep dream) (random 2))) -- Hamlet, Act III, Scene I
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210105/a8c963b5/attachment.sig>

More information about the ffmpeg-user mailing list