Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se |
|
|
#1 | Link |
|
Registered User
Join Date: Oct 2021
Posts: 2
|
How to concat m2ts according to mpls?
I want to know how to correctly concatenate m2ts segments according to Intime/Outime specified in mpls playlist. I feel the Intime/Outtime fields in the mpls playitems might have unit in packets number, then how to seek to these package number in ffmpeg?
For example, I parsed the playlist in a mpls file into json below: Code:
{
"Length": 306,
"NumberOfPlayItems": 2,
"NumberOfSubPaths": 1,
"PlayItems": [
{
"Length": 128,
"ClipInformationFileName": "00002",
"ClipCodecIdentifier": "M2TS",
"MiscFlags1": 1,
"IsMultiAngle": false,
"RefToSTCID": 0,
"INTime": 188955000,
"OUTTime": 308939865,
"UOMaskTable": 0,
"MiscFlags2": 0,
"StillMode": 0,
"STNTable": {
"Length": 94,
"NumberOfPrimaryVideoStreamEntries": 1,
"NumberOfPrimaryAudioStreamEntries": 2,
"NumberOfPrimaryPGStreamEntries": 1,
"NumberOfPrimaryIGStreamEntries": 1,
"NumberOfSecondaryAudioStreamEntries": 0,
"NumberOfSecondaryVideoStreamEntries": 0,
"NumberOfSecondaryPGStreamEntries": 0,
"PrimaryVideoStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1011"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 27,
"VideoFormat+FrameRate": 97
}
}
],
"PrimaryAudioStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1100"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 131,
"AudioFormat+SampleRate": 97,
"LanguageCode": "jpn"
}
},
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1101"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 128,
"AudioFormat+SampleRate": 49,
"LanguageCode": "jpn"
}
}
],
"PrimaryPGStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1200"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 144,
"LanguageCode": "jpn"
}
}
],
"SecondaryPGStreamEntries": [],
"PrimaryIGStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 2,
"RefToSubPathID": 0,
"RefToSubClipID": 0,
"RefToStreamPID": "0x1400"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 145,
"LanguageCode": "jpn"
}
}
],
"SecondaryAudioStreamEntries": [],
"SecondaryVideoStreamEntries": []
}
},
{
"Length": 128,
"ClipInformationFileName": "00003",
"ClipCodecIdentifier": "M2TS",
"MiscFlags1": 1,
"IsMultiAngle": false,
"RefToSTCID": 0,
"INTime": 189000000,
"OUTTime": 189585585,
"UOMaskTable": 582090251837636608,
"MiscFlags2": 0,
"StillMode": 0,
"STNTable": {
"Length": 94,
"NumberOfPrimaryVideoStreamEntries": 1,
"NumberOfPrimaryAudioStreamEntries": 2,
"NumberOfPrimaryPGStreamEntries": 1,
"NumberOfPrimaryIGStreamEntries": 1,
"NumberOfSecondaryAudioStreamEntries": 0,
"NumberOfSecondaryVideoStreamEntries": 0,
"NumberOfSecondaryPGStreamEntries": 0,
"PrimaryVideoStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1011"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 27,
"VideoFormat+FrameRate": 97
}
}
],
"PrimaryAudioStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1100"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 131,
"AudioFormat+SampleRate": 97,
"LanguageCode": "jpn"
}
},
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1101"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 128,
"AudioFormat+SampleRate": 49,
"LanguageCode": "jpn"
}
}
],
"PrimaryPGStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 1,
"RefToStreamPID": "0x1200"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 144,
"LanguageCode": "jpn"
}
}
],
"SecondaryPGStreamEntries": [],
"PrimaryIGStreamEntries": [
{
"StreamEntry": {
"Length": 9,
"StreamType": 2,
"RefToSubPathID": 0,
"RefToSubClipID": 0,
"RefToStreamPID": "0x1400"
},
"StreamAttributes": {
"Length": 5,
"StreamCodingType": 145,
"LanguageCode": "jpn"
}
}
],
"SecondaryAudioStreamEntries": [],
"SecondaryVideoStreamEntries": []
}
}
],
"SubPaths": [
{
"Length": 36,
"SubPathType": 3,
"MiscFlags1": 0,
"NumberOfSubPlayItems": 0,
"SubPlayItems": []
}
]
- 00002.m2ts from 188955000 to 308939865 - 00003.m2ts from 189000000 to 189585585 I would like to know what these integers mean, and how to concatenate these two segments into one m2ts (perhaps using ffmpeg or other tools). Appreciate your help! Edit: I have to work with Linux(debian) cli tools, not tools with gui. Last edited by GabriellaChaos; 19th January 2025 at 05:02. Reason: misspelling |
|
|
|
|
|
#2 | Link |
|
Registered User
Join Date: Oct 2021
Posts: 2
|
I still have no idea about the unit. It seems like (308939865 - 188955000) / 45000 matches the duration of the 00002.m2ts in seconds. Maybe there is some kind of timebase information in the m2ts file?
Also, I mentioned that the IGStream with PID #0x1400 referenced in the mpls file does not exists in the list provided by ffprobe. What is IGStream? Why is it not in the m2ts file? |
|
|
|
![]() |
| Tags |
| bdmv, concatenate, ffmpeg, m2ts, mpls |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|