Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#7842 closed defect (duplicate)

M2TS muxer doesn't generate valid Blu-Ray files

Reported by: Anton Torp Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I analyzed the sample bluray file:
https://samples.ffmpeg.org/bluray/dts-starts-later-than-ac3.m2ts

And I check it with the basic specification:
https://lists.libav.org/pipermail/ffmpeg-devel/2010-July/092559.html

And 9 years after, the FFmpeg M2TS muxer still doesn't generate conformant bluray files. Just simple M2TS container support!

How to reproduce:

% ffmpeg -i "https://samples.ffmpeg.org/bluray/dts-starts-later-than-ac3.m2ts" -f mpegts -mpegts_m2ts_mode 1 bluray-test.m2ts"

Summary of (some) non-conformant specs:

  • Fixed PIDS: Current numbers doesn't correspond to correct values: 0x0100 PMT, 0x1011 primary video, etc.
  • SIT table: Now is missing, instead it's present one SDT table.
  • PCR stream: It's required to be in PID 0x1001 and not in the video stream.
  • Program info: Not contains the correct descriptor of "HDMV".
  • And some other minor constraints.

I hope someone can enhance the current support.
Regards.

Change History (8)

comment:1 by Carl Eugen Hoyos, 3 years ago

Component: avcodecundetermined
Keywords: m2ts bdav bluray removed
Resolution: duplicate
Status: newclosed
Type: enhancementdefect

See #2622.

in reply to:  1 comment:2 by Anton Torp, 3 years ago

Resolution: duplicate
Status: closedreopened

Replying to cehoyos:

See #2622.

I've checked it.
However, that ticket (and related posts) doesn't target the problem. Only just one part is addressed (the HDMV PGS subtitles streams).

In order to generate conformant Bluray files with the mpegts muxer (in M2TS mode), it's required to:

  • Use Fixed PIDS.
  • Generate a SIT table.
  • Put the PCR in the PID 0x1001, that's an empty PID.
  • Add the "HDMV" descriptor.

And all of this is at time an open issue.
Regards.

comment:3 by Carl Eugen Hoyos, 3 years ago

Resolution: duplicate
Status: reopenedclosed

Of course!

in reply to:  3 comment:4 by Anton Torp, 3 years ago

Replying to cehoyos:

Of course!

Sorry, cehoyos... where is this description in the ticket #2622 ?
In any case this #7842 supersedes #2622.

comment:5 by Carl Eugen Hoyos, 3 years ago

The reason that FFmpeg does not support muxing pgs in mpegts is that FFmpeg does not support writing m2ts files - I believe you support his view, no? So how could a patch that fixes ticket #2622 not implement m2ts muxing support?
If you feel that anybody able to fix #2622 would not find all necessary information there, please don't let me stop you from adding it there (although I doubt that anybody who is able to fix #2622 would not know all the information you shared here).
As said elsewhere, the attitude of why isn't this fixed yet is unlikely to get a ticket fixed.

comment:6 by rhazor, 2 years ago

why isn't this fixed yet

comment:7 by mkver, 2 years ago

Because no one has done it yet. Patches are welcome.
(Of course, any comments on this should actually be posted in ticket #2622.)

comment:8 by Andrew-R, 2 years ago

I think I should add to this bug reference to Cinelerra-GG (linux-only non-linear video editor). It uses ffmpeg (4.2+ few patches), and can use ffmpeg.git . I was looking at failing patch inside source tree and apparently exactly patch failing to apply should add more accurate Blu-Ray muxing.

https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=tree;f=cinelerra-5.1/thirdparty/src;h=5bfd7e92d793c3100827dd216bb81fb6f56eff54;hb=HEAD

see ffmpeg-4.2.patch2 and ffmpeg.git.patch2 . Well, git one fails to apply after recent (aug/sept 2019) round of fixes in mpegts muxer. Without it some udf file is generated, I can even play/seek it with mplayer, but I'm sure real player will choke on it - some errors detected on seeking.

Compilation (of CinGG) relatively simple, I run it on Slackware 32-bit often. You can use pre-build packages from https://www.cinelerra-gg.org/downloads/#packages but obviously for your own changes you want source.

There is item in main menu called Create BD, it will prompt you to choose type (size, framerate, interlacing) of project, and some empty space to run encoding and muxing. You don't need all 25 or 50 Gb - just load small (2 min for example) file, change project settings to something more like Blu-Ray spec/profile, and fire it. Note: Cinelerra will quit with few console messages after muxing step is finished, this is normal. But run it from terminal {xterm, konsole ..} so those messages will be seen, or any errors, too.

There are option files controlling muxing/encoding, you can see them online https://git.cinelerra-gg.org/git/?p=goodguy/cinelerra.git;a=tree;f=cinelerra-5.1/ffmpeg;h=3d53bdac732998d97a25abfe904ce97bea8c5bec;hb=HEAD or in your Cinelerra-GG installation (for me they live in /usr/share/cin, but this is configurable).

Note: See TracTickets for help on using tickets.