Unforgettable
5th May 2024, 19:59
Dear all,
I am currently playing around with Bluray / M2TS to MKV conversion, where I am especially interested in generating MKV files with the help of external timestamp files. To create those timestamp files, I need to extract the PTS for every video and audio frame from the M2TS files.
Accidentally, I used something like the following command to do that:
ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > timestamps1.txt
Then I thought about it and came to the conclusion that I probably did it wrong, because I obviously extracted PACKET timestamps instead of FRAME timestamps, while I actually assumed that a packet may contain more than one frame of the same stream. However, the MKV file that I created using the timestamps in timestamps1.txt was correct in every respect.
Nevertheless, I tried to correct my mistake and used something like the following command:
ffprobe -show_entries frame=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > timestamps2.txt
That is, I now actually extracted the frame PTS instead of the packet PTS.
I then was baffled: Apart from the fact that this took an extremely long time, the timestamps in timestamps2.txt were the same as the timestamps in timestamps1.txt (at least the audio and video timestamps; let's put subtitles aside for now).
I would appreciate help with understanding this. Until now, I was assuming that a M2TS file basically consists of packets, and that a packet basically consists of an arbitrary number of frames that belong to arbitrary streams, and notably, that a packet may contain multiple frames that belong to the same stream.
But obviously, the result described above implies that there is no more than one frame of each stream in a packet. I would be grateful if somebody could explain in simple words whether it is pure random that the M2TS files I have tested so far contain no more than one frame per stream in each packet, or whether this is a general property of a M2TS file.
Thank you very much in advance!
I am currently playing around with Bluray / M2TS to MKV conversion, where I am especially interested in generating MKV files with the help of external timestamp files. To create those timestamp files, I need to extract the PTS for every video and audio frame from the M2TS files.
Accidentally, I used something like the following command to do that:
ffprobe -show_entries packet=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > timestamps1.txt
Then I thought about it and came to the conclusion that I probably did it wrong, because I obviously extracted PACKET timestamps instead of FRAME timestamps, while I actually assumed that a packet may contain more than one frame of the same stream. However, the MKV file that I created using the timestamps in timestamps1.txt was correct in every respect.
Nevertheless, I tried to correct my mistake and used something like the following command:
ffprobe -show_entries frame=stream_index,pts,duration -of compact=p=0:nk=1 input.m2ts > timestamps2.txt
That is, I now actually extracted the frame PTS instead of the packet PTS.
I then was baffled: Apart from the fact that this took an extremely long time, the timestamps in timestamps2.txt were the same as the timestamps in timestamps1.txt (at least the audio and video timestamps; let's put subtitles aside for now).
I would appreciate help with understanding this. Until now, I was assuming that a M2TS file basically consists of packets, and that a packet basically consists of an arbitrary number of frames that belong to arbitrary streams, and notably, that a packet may contain multiple frames that belong to the same stream.
But obviously, the result described above implies that there is no more than one frame of each stream in a packet. I would be grateful if somebody could explain in simple words whether it is pure random that the M2TS files I have tested so far contain no more than one frame per stream in each packet, or whether this is a general property of a M2TS file.
Thank you very much in advance!