[FFmpeg-devel] [PATCH] Fixed remuxing of HDMV PGS subtitles
Petri Hintukainen
phintuka at gmail.com
Mon Apr 13 12:39:23 CEST 2015
On su, 2015-04-12 at 16:40 -0700, Philip Langdale wrote:
> On Sun, 12 Apr 2015 08:13:39 +0000 (UTC)
> Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> >
> > I tested with samples from the following directories:
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket598/
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket1722/
> > http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket3820/
> >
> > None of them work for me with the patch. It seems I am
> > doing something wrong, could you explain how I should
> > test?
>
> OK.
>
> I used:
>
> http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket598/00002_nosubs_detected.m2ts
>
> Then I did:
>
> ffmpeg -i 00002_nosubs_detected.m2ts -map 0 -c:v copy -c:a copy -c:s \
> copy remux.m2ts
>
> and I played remux.m2ts successfully in mplayer with working subtitles.
>
> Now, the ffmpeg probe output will not look the same as the original
> file. You'll see:
>
> Stream #0:7[0x107], 0, 1/90000: Unknown: none ([144][0][0][0] / 0x0090)
> Stream #0:8[0x108], 0, 1/90000: Unknown: none ([144][0][0][0] / 0x0090)
> Stream #0:9[0x109], 0, 1/90000: Unknown: none ([144][0][0][0] / 0x0090)
> Stream #0:10[0x10a], 0, 1/90000: Unknown: none ([144][0][0][0] / 0x0090)
> Stream #0:11[0x10b], 0, 1/90000: Unknown: none ([144][0][0][0] / 0x0090)
0x90 stream type is not detected as PGS because of there's no HDMV
registration descriptor in the program. Without it HDMV stream types are
not "valid", and most demuxers (ffmpeg, vlc, ...) ignore those.
> This change makes sure the 0x0090 type ID at the end is carried over
> during the copy operation. There is a bunch of separate metadata which
> needs to be copied for the 'Unknown' to be replaced by the right info
> for the pgs subtitles, but that's a separate lower level problem in the
> muxer - it doesn't appear to copy that info correctly in a whole class
> of types, where pgs is just one example.
>
> It does have implications. You can remux from a proper bluray m2ts and
> get a working file, but if you try and remux that output into a new
> file, everything fails because ffmpeg can't identify the subtitle
> tracks any more.
>
> So, this change is not a complete fix, but it's one of the necessary
> steps.
I don't know if it is a good idea to use HDMV stream types without HDMV
program registration descriptor. If this is fixed incrementally, fixing
should be started from the opposite direction:
- Using HDMV stream type requires HDMV registration descriptor
- using HDMV registration descriptor requires HDMV conforming stream
I've attached a simple patch to add HDMV registration descriptor to the
program. With it streams are correctly detected with ffmpeg. But, I
don't think the patch should be applied: using HDMV registration
descriptor in a stream that is not HDMV conforming is a really bad
idea.
> --phil
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hdmv.diff
Type: text/x-patch
Size: 1340 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150413/1039a5fe/attachment.bin>
More information about the ffmpeg-devel
mailing list