[FFmpeg-user] Export raw (binary) subtitle data

Moritz Barsnick barsnick at gmx.net
Mon Jun 5 22:31:33 EEST 2017

On Mon, Jun 05, 2017 at 19:35:34 +0200, Johannes Bauer wrote:
> Oh, I thought it maybe was the actual length of the word that it
> complained about.

I'm not sure, I didn't look into the source code generating that

> Hmmm, yes, unfortunate. I was hoping to get that information as well,
> but I think that every line corresponds to one occurence -- so I can put
> everything back together.
> Thanks so much for your help. I'm really curious to see if I can figure
> this out.
> One thing made me wonder, however: What if the binary data contained
> '\n'? Then it probably would cause me some grief, wouldn't it? Some
> binary dump format (e.g. timestamp duration base64-encoded) would be
> ideal to avoid this. But I'm happy with what I have now :-)

Yes, if you rely on "one line is one geo-position", your logic gets
borked by additional pseudo-EOL.

Another thing came to mind, since you asked: There was a patch on
ffmpeg-devel for a "textdata" muxer (and demuxer), which would be able
to represent arbitrary data in base64, and also support timestamps:

That patch apparently never even got reviewed, or it was obsoleted by
one of Stefano's other patches. I still build my ffmpeg with it. It
does the trick quite niftily:

$ ffmpeg -i test.mov -map 0:s -c copy -f fftextdata -

That's your raw mov_text in base64, with timestamps, and actually quite
parsable! (It looks like there are some extra bytes in the output,
perhaps those markers from the raw mov_text.)

You could have probably also requested your SRT output not to use ASS
tags. I'm not sure SRT is willing to carry arbitrary binary data
though, that's why base64 is better.

But please keep in mind that when going from subtitle to something
else, you are most likely losing some properties - most notably the
duration. In your case - using the assumption that it's actually a
geo-position correlated with the timestamps - that seems tolerable.


P.S.: I owe you at least two beers if you figure out from which movie
that is. ;-) (I mapped that movie's SRT arbitrarily into a MOV file
with mov_text, for testing.)

More information about the ffmpeg-user mailing list