Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTMP data timestamp not correct #58

Closed
clacladev opened this issue Nov 28, 2022 · 6 comments
Closed

RTMP data timestamp not correct #58

clacladev opened this issue Nov 28, 2022 · 6 comments

Comments

@clacladev
Copy link

I've been using StreamPack on Android via api.video-reactnative-live-stream.
Running on device or simulator the broadcasting service livepeer.studio is not able to show the broadcasted camera content on Android. Even though I am able to see it if I broadcast to a local ffplay -listen 1 -i rtmp://0.0.0.0:1935/s/streamKey.

After talking with a colleague of mine at Livepeer, he debugged the RTMP stream received content. His feedback is:

The RTMP content is completely corrupt:
[124+0] 58 bytes of H264 video keyframe header
[124+0] 4020 bytes of H264 video keyframe NALU
[158+0] 1476 bytes of H264 video iframe NALU
[191+0] 1060 bytes of H264 video iframe NALU
[224+0] 1412 bytes of H264 video iframe NALU
[235+0] 1524 bytes of H264 video iframe NALU
[221+0] 1476 bytes of H264 video iframe NALU
[231+0] 1540 bytes of H264 video iframe NALU
[219+0] 1412 bytes of H264 video iframe NALU
[229+0] 1572 bytes of H264 video iframe NALU
[238+0] 1588 bytes of H264 video iframe NALU
[226+0] 2116 bytes of H264 video iframe NALU
[212+0] 2404 bytes of H264 video iframe NALU
[222+0] 1156 bytes of H264 video iframe NALU
[233+0] 1572 bytes of H264 video iframe NALU
[220+0] 1588 bytes of H264 video iframe NALU
[229+0] 1956 bytes of H264 video iframe NALU
[217+0] 1780 bytes of H264 video iframe NALU
[227+0] 2036 bytes of H264 video iframe NALU
[213+0] 2052 bytes of H264 video iframe NALU
[224+0] 2228 bytes of H264 video iframe NALU
[211+0] 2228 bytes of H264 video iframe NALU
[220+0] 1476 bytes of H264 video iframe NALU
[208+0] 1828 bytes of H264 video iframe NALU
[218+0] 1956 bytes of H264 video iframe NALU
[204+0] 2036 bytes of H264 video iframe NALU
[215+0] 1284 bytes of H264 video iframe NALU
[225+0] 1348 bytes of H264 video iframe NALU
[235+0] 1428 bytes of H264 video iframe NALU
[245+0] 964 bytes of H264 video iframe NALU
[209+0] 868 bytes of H264 video iframe NALU

Numbers in front are timestamps in milliseconds. They're all over the place!

Do you know why this is happening?
Thanks

@ThibaultBee
Copy link
Owner

Hi,
I am quite surprised that video frame timestamp are not in order. I know that audio and video frames are not in order because the audio and the video encoders are executed in separate threads and it is too complicated to synchronize. That is not supported by the RTMP format but most of modern RTMP server support that now (Youtube, ffmpeg,...).
Could you test with video only?

@ThibaultBee
Copy link
Owner

Hi,

I just implemented a way to synchronise audio and video frames for RTMP.
Could you test the sample in the feature/rtmp_av_sync branch?
APK is here: https://github.com/ThibaultBee/StreamPack/suites/10072532349/artifacts/490517994

@clacladev
Copy link
Author

clacladev commented Dec 27, 2022 via email

@clacladev
Copy link
Author

Hey @ThibaultBee I have been able to test the change and it works! Thanks a lot for it

@ThibaultBee
Copy link
Owner

Hi.
Glad to hear that.
Sorry I took my time to find a clean way to do do. Other open source librairies changes the timestamp but there is no way I will implement a machanism that changes timestamps.

Aldo, I might add a static variable to enable/disable this mechanism. Not sure yet

@ThibaultBee
Copy link
Owner

Released in 2.5.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants