[mythtv-users] Ubunto 18.04 / 0.29 export to mkv

David Engel david at istwok.net
Sun Jan 6 03:29:53 UTC 2019

On Fri, Jan 04, 2019 at 06:40:03PM -0500, Peter Bennett wrote:
> On 1/4/19 12:26 PM, David Engel wrote:
> > On Mon, Dec 17, 2018 at 03:50:49PM -0500, Peter Bennett wrote:
> > > On 12/17/18 3:06 PM, David Engel wrote:
> > > > Peter, have you ever tried and succeeded at getting all ATSC
> > > > subtitles/closed captioning copied during transcoding?  I have several
> > > > movies with English and Spanish subtitles that I want to preserve.
> > > > I've yet to find a way to do that with either handbrake or ffmpeg.  I
> > > > either get no subtitles or I get garbled, unintelligible subtitles.
> > > > 
> > > I don't have a problem with the subtitles. I only select one set of
> > > subtitles, but there is an option you can set to include multiple subtitles.
> > > I have never had them corrupted or lost, although I only look at the
> > > subtitles occasionally.
> > Peter, with some tips from Aman Gupta and a lot of trial and error, I
> > finally found a way to to this.  Those details are below(*).  The
> > problem now is the subtitles work fine on Linux but do not work at all
> > on Android.  This happens with both ffmpeg and mediacodec decoding on
> > Android.  The subtitle options to enable, disable and choose the
> > language are all there but the subtitles never show up on screen on
> > Android.  I can send you a test sample if you like.
> > 
> > (*)Ffmpeg corrupts a53 style captions when scte-20 data/captions are
> > also present.  Ffmpeg also can't pull captions from field 2.  Field 2
> > is where the Spanish captions are in my recordings.  Handbrake has
> > similar issues.  The solution is to dump the captions to .srt files
> > using ccextractor and then mux them with the transcoded video and
> > audio using ffmpeg or handbrake.
> > 
> > On a related note, I also confirmed with Aman that closed captions
> > don't work at all with mediacodec.  The interface has no way to pass
> > that information back.  Aman said there is a possible workaround but
> > it requires unofficial patches to ffmpeg to extract the appropriate
> > data and pass it back separately.
> > 
> > David
> So Handbrake cannot access the second subtitle track? I have never tried
> more than one subtitle track.

I might not have been clear enough.  Handbrake can only handle one,
closed, caption stream (i.e. subtitles embedded in the video stream).
It can handle any number of subtitles in their own streams.

> My idea for solving the problem with mediacodec and other hardware is to
> take ccextractor (the opensource one not the mythccextractor that ships with
> mythtv) and incorporate it into the mythplayer. ccextractor is able to
> extract the captions without decoding the video, so hopefully if you pass in
> the input data to ccextractor while playing the video you could get the
> subtitles back in real time, without too much overhead from ccextractor.

The external ccextractor is what I'm now using.  I didn't even realize
there was a mythccextractor.

Here is what Aman said regarding this:

| The android decoding APIs do not understand caption data so it gets lost.
| There is a patchset for a bitstream filter on ffmpeg-devel which can
| extract userdata including a53cc. It could be adapted for use with the
| mediacodec decoder in the future to extract captions before feeding into
| the android decoder.

You might want to track down that bitstream filter patchset first.

David Engel
david at istwok.net

More information about the mythtv-users mailing list