Open Matgoeth opened 2 years ago
Hiya, @mbattista !
Best, Mati
server.properties.sample
example as player-demo. If you serve the zip file unchanged the player will try to play a stream named first
.Okay I briefly tested this but it doesn't seem player is better at this (furthermore, it does seem to stop sometimes for no reason but it may be due to my poor configuration). Generally right now I do have this situation: after couple of minutes watching the stream video is behind by a few seconds. I was thinking if making any video would be helpful but it'll look just like I desynced them in some video edit soft.
Theoretically I can duplicate my tabs to hear the desync even clearer but then let's say one tab would get behind it would blur the results, so I won't make assumptions. However video is clearly "behind" the audio after a few minutes.
Of course I am happy to test/send anything to help.
Best, Mati
Improving the demo player is something I wanted to do. But since calling the Video stream works so flawlessly I never prioritised it.
Can you call the stream (/consume/[...]
URL) with Firefox or VLC and check if it desyncs there too?
I opened a Bug Report for chromium 86 last year because the ffmpeg which was shipped with this version threw a demuxer error. ( https://bugs.chromium.org/p/chromium/issues/detail?id=1147209#c6 ).
So perhaps chromium 96 has a out of sync bug this time?
You can also try to look at the media pane
in the chrome dev-tools if you see anything that could explain the out of sync.
Sure, this may be the case also, I can also try other browsers. But I was thinking you guys can first verify it's not only for me? (cause it may be my misconfigured stream still, then stream-m is okay and it's my fault)
Hi, thanks for all the info you guys collected, I'm trying to reproduce this issue and have one candidate. In my case OBS encodes a 48k audio stream, but in the metadata is reports 44k. This can cause timing issues because I re-calculate the timestamps (instead of trusting the client - which in this case would be better).
I found this issue by looking at a Wireshark dump (using 1935 as rtmp.port
will help Wireshark guess the right protocol).
Now I want to parse sample rate out of the AudioDecoderConfig section.
I'm not saying this is the same issue manifesting in your system, but cleaning up the timing code could not hurt.
A quick update: timing looks OK, I tried two different methods, both have the same effect. Although I am experiencing a different audio-issue from what @Matgoeth describes (audio starts stuttering for me after some time, maybe the same issue just my slightly older i5-4590 manifests it differently).
Now I'm looking into mp4 generation, there are a lot of combination of mp4 features you can use or not use. MPEG-DASH defines some of these, but as I see nobody truly implements it. - So now I'll fire up ISOViewer and check out a few chunks youtube is sending, and maybe I can come up with an mp4 that Chrome likes.
Thanks @vbence ! Do you think it's chrome that generates an issue then? As said, I strongly recommend having two or more viewers, I believe it can be even just two different tabs/windows of same browser.
Ofc I am happy to help if there's something not too deep with streaming/encoding (therefore my knowledge will be sufficient :) )
Hi I created a new branch, audio-retiming
where I added exact audio timestamp calculation, this is an improvement by itself, so it can't hurt. Also added two new debug messages.
The first, diffMs
will give you the time difference (milliseconds) between the new keyframe and the last audio "frame". Values smaller than 1024 audio samples are hidden. which is normal. This is 23ms for 44100 Hz audio and 21ms for 48kHz.
I added a second one, AAC timing diff
you can see it if the timestamps sent by OBS drift away from the recalculated timestamps (based on the actual audio data). This message is only displayed if it is ever greater than 1 ms.
I would ask you to help with two experiments; first you can do everything as you did in the original report, the two questions:
And in the second scenario I'd like you to try to reproduce the issue but using a "Media Source" in OBS (instead of capturing audio/video). As media file you can use the same one I am testing with: https://download.blender.org/demo/movies/BBB/bbb_sunflower_1080p_30fps_normal.mp4
Does the issue manifest in this schenario?
Edit: small diffMs
values are now hidden, only suspicious ones show up.
Hi @vbence , good work here!
Sorry for not replying for some time, it's not easy to find some time between years end and another beginning right now. I didn't have the chance to gather more people so I was not able to test it out properly in the same manner but in order not to stop issue I've recompiled branch you've mentioned and simply streamed for about 20 mins to my other device (android smartphone) and...
As for now I am looking for a chance to test it out a little more (and hopefully with wider audience). Anyone else willing to try, please do so.
I've managed to gather someone else on stream too and... here are logs
Generally:
Basically I don't know what the problem is unfortunately :(
Hello, vbence! First of all: thanks for this project, even though it's prototype it certainly works wonders!
However, once I start streaming after some time audio and video does desync: I believe audio gets behind the video, but I may need to test this a bit more. As for now I'd like to highlight this issue with somewhat vague info, but I am happy to help if there's need for any specific info (I glanced through the code myself but it seemed like "pieces" of videos [MovieFragments in your class nomenclature] do contain all the data and they are not separated streams but I didn't spend too much time on this).
Anyway: Receiving end were PCs/laptops with Google Chrome v 96.0.4664.110 (yeah, I didn't check other browsers, just me and my "testers/watchers") - for most of the time refreshing the stream resolved problem for them for next 10 minutes or so.I verified this is also the case for me and refreshing did seem to help.
I was streaming using OBS using rtmp protocol, CBR 5000kbps 1080p with 30 frames (keyframe interval was set to 2, PC is rather hi-end with i9-9900k, so fully capable of streaming such content with very rare frame drops). I was streaming to localhost (so basically there's no latency between OBS sender and stream-m receiver) and I was having 3 people watching which shouldn't be an issue having 20mbps upload (saying "shouldn't", I didn't do any fancy stats.
Of course I am happy to help/log anything more if it's needed: I do have quite good java knowledge, just almost zero knowledge when it comes to encoding/streaming (I mostly do around other types of apps)
Once again, thanks a lot for your app!