I am trying to make iso bmff from raw h264 byte stream for playing through javascript. I am getting data through custom transport container (Not any standard HLS or rtsp packet) where each packet contain a relative timestamp. For example:
chunk1:
Packet1 -- timestamp:100, payload: H264 raw data [Usually single NAL unit]
Packet2 -- timestamp:120, payload: h264 raw data
chunk1:
Packet1 -- timestamp:140, payload: H264 raw data
Packet2 -- timestamp:160, payload: h264 raw data
Since packet timestamp is the relative time in milliseconds so I am considering time scale value is 1000 and calculating DTS from difference of first packet and consecutive packet. For example,
DTS for 1st chunk: 0 [ 100 - 100]
DTS for 2nd chunk: 40 [140 - 100]
But problem is that it is working fine in firefox but chrome just got stuck after first frame.
What cause could be? Am I doing wrong with DTS or time scale?
Noted that I don't have any B frame, so my DTS and PTS value is same
At last I was able to solve my problem. Basically there was nothing wrong with DTS value. I was using a modified version of mp4 generator that was the problem where duration part from trun box was removed.
I have got clue about this issue from my another post where szatmary mentioned about trun box duration.
Finally, I just copied mp4-generator from hls repository and it solved my issue. Now it is playing in chrome and safari as well.