xevojapan / h264-converter

MIT License
59 stars 14 forks source link

Is it possible make stepDTS dynamic? #1

Closed samirkumardas closed 6 years ago

samirkumardas commented 7 years ago

Hi

This is the minimalistic version for playing h264 streaming using javascript. Thanks for great work.

I saw you have always considered stepDTS 60 that implies there should be a fixed frame rate.

Is it possible to make StepDTS based on the relative time ( for example, first frame 0, then second frame 30 i.e the time difference from first frame in ms which is not fixed) of the frame?

Actually I am getting streams from livecam and frame rate is not static. I tried to make stepDTS dynamic from the time difference of each frames but it got stuck after first time.

Any clue?

Thanks Samir

horiuchi commented 7 years ago

Sure, this project supports only the fixed frame rate of h254 streaming.

If StepDTS is changed dynamically, you serve as a useful reference at the project: https://github.com/Streamedian/html5_rtsp_player

samirkumardas commented 7 years ago

Thank you for replying.

I did required changes to make stepDTS dynamic although it does not work in chrome or safari but works fine in Mozilla

I have also looked at html5_rtsp_player and seems will get same result.

Basically I am getting data from live streaming and FPS is not static. Also my SPS have timing_info_present_flag is 0 that means there is no timescale and other timing information. I get a relative timestamp in ms with each packet from server. So I am considering timescale 1000 and calculating DTS based on timestamp.

It seems chrome found gap in buffer ranges and it shows "Buffer_have_nothing" in media debug after playing first few frames.

Can you help on one thing? How does player calculate frame duration if SPS has timing_info_present_flag is 0

For example, for the first 30 frames - I provide DTS is 0: So I got following video duration depending on timescale

timescale ----- Duration 1000 ----- 1 800 ----- 2 500 ----- 3

These result for the same first 30 frames. My question how does player calculate duration from timescale?