Skip to main content
deleted 50 characters in body
Source Link
Binarus
  • 1.8k
  • 11
  • 22

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|
 
4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

Finally, I'd like to state that ffprobe in general seems to be an appropriate tool to extract PTS timestamps: The audio and video timestamps that I extract the same way are all correct. It's just the subtitle timestamps that impose a problem.

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|
 
4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

Finally, I'd like to state that ffprobe in general seems to be an appropriate tool to extract PTS timestamps: The audio and video timestamps that I extract the same way are all correct. It's just the subtitle timestamps that impose a problem.

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|
4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

Finally, I'd like to state that ffprobe in general seems to be an appropriate tool to extract PTS timestamps: The audio and video timestamps that I extract the same way are all correct. It's just the subtitle timestamps that impose a problem.

added 248 characters in body
Source Link
Binarus
  • 1.8k
  • 11
  • 22

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|

4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

Finally, I'd like to state that ffprobe in general seems to be an appropriate tool to extract PTS timestamps: The audio and video timestamps that I extract the same way are all correct. It's just the subtitle timestamps that impose a problem.

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|

4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|

4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.

Finally, I'd like to state that ffprobe in general seems to be an appropriate tool to extract PTS timestamps: The audio and video timestamps that I extract the same way are all correct. It's just the subtitle timestamps that impose a problem.

Source Link
Binarus
  • 1.8k
  • 11
  • 22

How to extract subtitle timestamps using ffprobe (not working as expected)?

I am trying to extract subtitle timestamps from a M2TS file using ffprobe. This does not work as expected. The M2TS file is known to contain 1001 subtitles in track 4, but I am getting about 4000 timestamps. Furthermore, those timestamps are related in a weird manner and are unsorted.

The command line I am using:

ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > ts.txt

ts.txt then contain blocks like the following (I have inserted blank lines for readability):

4|57795041|N/A|
4|57795000|N/A|
4|57789168|N/A|
4|57789250|N/A|
4|57789250|N/A|

4|57982728|N/A|
4|57982687|N/A|
4|57982686|N/A|

4|63380621|N/A|
4|63380580|N/A|
4|63374748|N/A|
4|63374830|N/A|
4|63374830|N/A|

... and so on

Each block corresponds with one subtitle. There are between 2 and 5 timestamps per block. The timestamps in a block are not sorted. The last two timestamps in a block are identical or differ by 1 tick at maximum. The timebase is 90000 ticks / s.

I am convinced that my problem is due to my lack of understanding of how ffprobe works and how subtitle timestamps are embedded in a container. Could somebody please shortly explain how to extract subtitle timestamps the correct way? I am only interested in PTS timestamps.

I then have added frame information to the output and have made it print the section and the keys:

ffprobe -show_entries packet=stream_index,pts,duration:frame -of compact input.m2ts > ts.txt

This didn't help; the following shows a sample from the output:

packet|stream_index=4|pts=76826553|duration=N/A|
packet|stream_index=4|pts=76826144|duration=N/A|
packet|stream_index=4|pts=76826143|duration=N/A|
subtitle|

Besides being more verbose, there now are additional subtitle section entries, but they don't contain data. Of course, there now also are additional frame section entries, but I didn't show them since none of them is related to subtitles.