Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mismatch in container and video duration for MPEG-TS #2087

Open
plondino opened this issue Apr 15, 2022 · 2 comments
Open

Mismatch in container and video duration for MPEG-TS #2087

plondino opened this issue Apr 15, 2022 · 2 comments
Labels

Comments

@plondino
Copy link

I have an MPEG TS file that has a mismatch in the container and video duration:

General
Commercial name                          : MPEG-TS
Frame count                              : 961
Duration                                 : 32032.000000
Duration                                 : 32 s 32 ms
Duration                                 : 32 s 32 ms
Duration                                 : 32 s 32 ms
Duration                                 : 00:00:32.032
Duration                                 : 00:00:32;01
Duration                                 : 00:00:32.032 (00:00:32;01)

The video reports:

Video
Commercial name                          : MPEG-2 Video
Frame count                              : 961
Duration                                 : 32065
Duration                                 : 32 s 65 ms
Duration                                 : 32 s 65 ms
Duration                                 : 32 s 65 ms
Duration                                 : 00:00:32.065
Duration                                 : 00:00:32;01
Duration                                 : 00:00:32.065 (00:00:32;01)

A duration of 961 frames at 30000/1001 should be ~32.65s so not clear why the general section reports the duration as 32.32s.

I can provide a sample file if necessary.

@JeromeMartinez
Copy link
Member

not clear why the general section reports the duration as 32.32s.

The General section uses the PCR values, but without adding the duration of the last frame associated with stream transporting the PCR, I guess that we need to add it there for having something which is greater than the duration of the longer stream in the file.

@JeromeMartinez
Copy link
Member

@plondino I implemented in #2073 what was buggy from my point of view but I am not sure that it is what you expect.

General duration is now coherent with file size and overall bit rate (duration = file size * 8 / overall bit rate), it is the duration of the content transmission as indicated by the TS stream. It is not based on the duration of any A/V stream.
Sometimes general duration is smaller than other duration due to a burst in the content transmission, sometimes it is larger due to I-frame not at the beginning of the transmission, sometimes same if all is well synchronized.

When you say:

A duration of 961 frames at 30000/1001 should be ~32.65s so not clear why the general section reports the duration as 32.32s.

I don't consider as an issue directly, because the transmission duration could be 32.32s due to some small p/b frames at the end, no need of 32.65s for transmitting 32.65s of content.

What is your idea behind this ticket? What do you expect from General duration not in other parts of MediaInfo?

With an example, could you say what value you expect?
A caricatural but possible example:
2 TS programs
Program 1 has V1 and A1, PCR1 on V1
Program 2 has V2 and A2, PCR2 on V2
PCR1 has start 0.50s and end 1.5s
V1 has start 1.00s and end 2.10s
A1 has start 0.98s and end 1.99s
PCR2 has start 0.45s and end 1.45s
V2 has start 0.70s and end 1.60s
A2 has start 0.60s and end 1.80s

Currently MI has:
General duration 1.00s (based on end PCRx - start PCRx, both PCR should be same in a coherent TS)
V1 duration 1.10s (end V1 - start V1)
V2 duration 0.90s (end V2 - start V2)
A1 duration 1.01s (end A1 - start A1)
A2 duration 1.20s (end A2 - start A2)

General duration is less than any stream in this example because the transmission was faster than any content. If something else is expected, is it max (A/V ends) - min (A/V starts) = 1.50s, max (max(A/V end per program) - min(A/V start per program)) = 1.20s, something else?


You can test the latest dev snapshots knowing that this is maybe not as you expect due to a different idea we have of general duration field.

@JeromeMartinez JeromeMartinez transferred this issue from MediaArea/MediaInfo Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants