[FFmpeg-devel] [PATCH] Fixed remuxing of HDMV PGS subtitles
phintuka at gmail.com
Tue Apr 21 13:17:05 CEST 2015
On ma, 2015-04-13 at 09:41 -0700, Philip Langdale wrote:
> On 2015-04-13 03:39, Petri Hintukainen wrote:
> > 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.
> Your patch is equivalent to the first thing I tried and it had no
> effect in so far as how ffmpeg decoded the resulting m2ts file. It still
> marked the subtitle streams as unknown.
I didn't try playing the file, but ffprobe seems to detect PGS streams
correctly from files remuxed with my patch:
$ ffprobe a.m2ts
Input #0, mpegts, from 'a.m2ts':
Duration: 00:03:21.16, start: 13.050667, bitrate: 36372 kb/s
service_name : Service01
Stream #0:0[0x100]: Video: h264 (High) ( / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 90k tbn, 47.95 tbc
Stream #0:1[0x101]: Audio: dts (DTS-HD MA) ( / 0x0082), 48000 Hz, 5.1(side), fltp, 1536 kb/s
Stream #0:2[0x102]: Subtitle: hdmv_pgs_subtitle ( / 0x0090)
> I guess, you don't get any useful
> progress until the whole stream is conforming, and we are
> along way from that.
Current m2ts output mode only adds extra transport header with more
or less incorrect timestamp. So, it is not "real" m2ts but plain
mpeg-ts with an extra header.
I think remuxing m2ts->m2ts should be quite easy to implement:
- Assign proper pids (in m2ts pids are fixed)
- Allow PCR in separate PID, without any stream/payload
- Fix PES headers (at least audio stream PES
headers seem to be incorrect)
- Check if PAT and SI are correctly created
- Check/fix PCR/PAT/SI timings
- Fix generating ATC (or output just plain .ts without ATC)
- Add proper descriptors to PMT
- Pad output file to N*32 packets
There's probably something else too, but those issues were "easy" to
spot from mpegtsenc.c.
What would be the use case for m2ts output ? Authoring / modifying
BluRay discs ?
For BluRay use one should note that also associated metadata files
(.clpi, possibly also .mpls) become invalid and need to be re-created.
More information about the ffmpeg-devel