-
Notifications
You must be signed in to change notification settings - Fork 28
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
NDI source stalls since timestamp changes #79
Comments
Can you get a debug log with |
Also please try different |
I already tried all timestamp modes to no avail, I'll try and create a log file. |
Heres the log, it's quite long, I let it run for a short while: |
I was wrong about the timestamp mode, it does "work" when I set the autosink to |
Thanks, I'll take a look through the log later. |
Well, it doesn't - it only works with mode 2 - maybe thats a hint? Thanks for looking into it! |
How does your pipeline look like? Maybe a full |
Its a gst-launch pipeline exactly as in the README. |
Heres a full log, 16MB.. |
In your full log you shouldn't have seen any video at all and also heard no audio. You need to increase the queue sizes here or otherwise this won't work. The first audio arrives at 0.65s, the first video at 1.94s, but the queues only hold up to 1s in your case. Try configuring both queues with |
Correct, I didn't see or hear anything - these logs are from the exact Increasing the |
Funnily, in a different context (obs-gstreamer plugin) the queue seems to work when using However I noticed that the pipeline doesn't seem to react when setting an overall latency on the pipeline - this usually works for USB and RTSP sources to delay/sync them. The NDI pipeline always comes in with the same latency, no matter what I set for the latency, like this:
|
Right, that's the situation I would be interested in having logs for :) If you set timestamp mode to
That's a bad idea unless you know that the pipeline's latency is going to be lower than what you're configuring on it. This API should only be used if you want to do inter-device / inter-pipeline synchronization. |
Sure, as you explained in your great presentation :) However I should be getting an error/warning from the pipeline if thats not the case, right? I am using this to sync up multiple live camera sources (RTSP, USB, NDI) in OBS and it works a treat - except for NDI. |
Heres a log with |
Heres a full log with |
If the For the problem at hand here, can you confirm that setting |
I am syncing the cameras visually by filming the same metronome - when I change the pipeline latency value in a USB or RTSP pipeline the visual result is as expected - the camera comes in later or sooner. Except for the NDI pipeline which even with 10 seconds set as latency doesn't change its "real world" latency in the pipe. When setting a pipeline latency that is too low on the RTSP, USB or NDI sources I immediately get a
Yes, the problem persists with |
As said, check the appsink/clock logs :) This is a different problem to what this issue is about though.
If you send me an iOS device, sure ;) I was testing with the NDI HX Camera app on Android with Linux as a receiver and that seems to be working correctly here. I'll check if there's something useful in your logs later. |
Heres a level 6 log of OBS running with only one Gst-NDI source, I can't find any hints that setting the latency to 250ms fails, still its not applied in reality: |
Like I said, everything's arriving too late in the sink
Means that this frame arrived 7.3s too late. As such, they will just be rendered immediately. That might be a hint to the underlying problem here. Wrong timestamps in some sense. |
Well yes, all frames have a PTS of 0. |
But wheres that time difference coming from? Its by far not coming in 7 seconds late in reality. I can see the video, it's not 7 seconds late. |
Wrong timestamping. |
Okay, so based on the fact that I only get video from the "NDI HX Camera" when using Its certainly not the first time that I see clock/sync issues with NDI, even before I added gstreamer to the mix, so I won't rule out that this is an issue with the NDI runtime (using the latest V5 SDK on both windows and mac). But I only ever saw these extreme time differences when using gstreamer with it. With the gst-launch pipeline with 10s buffer I actually saw/heard the 7 seconds time difference between audio and video in some cases - in some not. |
If you check the logs, all the If you select a timestamp or receive time based mode then it should work though. Can you give me a log for |
Heres two logs, one with mode 0 and one with mode 4, neither yield an image in OBS, the previous was with mode 2, the only one that works somewhat. |
Thanks, I meant mode 1 (timestamp-vs...) and not 0 (timecode-vs...) though, can you also attach that? 0 is also useful however. Mode 2 can't really work if the NDI sender is passing 0 for all timecodes. And generally (unless you really know what you're doing), you want either mode 0, 1 or 4 :) |
Right, sorry. Well if mode 2 is the only one that yields an image expect me to use that ;) |
You didn't configure the queues to be large enough again. First audio arrived at 6.96s, first video at 8.31s and the queue in front of the audio sink ran full after 7s. Can you get a new set of those 3 logs with big enough queues? |
Okay, I don't get how thats necessary for internal receive times but here goes.. |
It's necessary so that both sinks actually receive data, consume it continuously and so I can see how the timestamps are in relation to the pipeline clock. The mode 4 log (the first one), you still don't get any video/audio out of there? All video/audio frames arrive in time at the sinks there and it looks all ok. At least starting around 8.3s into the log, before that frames are too late and then slowly catching up. Which seems to be related to audio being available much before video. Needs some more analysis. Mode 1 log should behave approximately the same. Mode 0 log is a bit strange and needs some more analysis but it looks like data is arriving in approximately 1s batches, so a higher latency would be necessary to configure here. I'll take another look in the next days, this needs some time. |
Sorry, forgot to mention that yes, I do get an image with all of these settings, audio is a bit choppy at times and it is quite late (not 7 seconds though), As I am really only interested in the video from the cameras (the microphones come in via a mixing desk) - are you saying I can avoid the issues by only using the video part of the demuxer pipeline (as there would be no syncing up)? |
I finally got to look at these logs and trying to look into fixing the whole situation. I'll take your logs as one of my testcases for a more robust algorithm for the timestamps. One thing that seems problematic in your log is
|
Okay, cool. The Sender is the official NDI HX Camera app for iOS in case it matters. |
Yeah I heard a few times already that it is apparently broken. The Android version of the app is behaving correctly. |
I guess it might also be a matter with the NDI core libraries on the "darwin" platforms.. I also get strange behavior when I try to display a NDI screen grab from an iMac. |
- NDI HX Camera Android in the past used 1ns instead of 100ns as unit for timecodes/timestamps. - NDI HX Camera iOS uses 0 for all timecodes and the same non-zero value for all audio timestamps Detect such situations and try to compensate for them. Also add a new "auto" timestamping mode that prefers to use timecodes and otherwise falls back to timestamps or receive times. Fixes teltek#79
This should be fixed by #102 with the default settings now |
Cool, it'll be some time until I can check but I'll report back! |
So, coming back to testing this and on sources that have no audio the latest version works a treat. For sources with audio not so much, I couldn't get it to work with actual NDI hardware, or the NDI HX iPhone app or with the new NDICam App or even with a screen capture session. It always gets stuck at 00:00:00 and seems to drop pretty much all frames. Heres a log with the new NDICam App: Edit: Also, I get errors when I don't grab the audio from the demuxer. I didn't know this kind of behavior from gstreamer, usually when I don't connect an audio sink the audio frames simply get dropped (e.g. RTSP). |
D'oh, I just realized your PR wasn't merged yet, checked out your branch now and it works great, thanks a lot! |
Thanks for testing :) |
- NDI HX Camera Android in the past used 1ns instead of 100ns as unit for timecodes/timestamps. - NDI HX Camera iOS uses 0 for all timecodes and the same non-zero value for all audio timestamps Detect such situations and try to compensate for them. Also add a new "auto" timestamping mode that prefers to use timecodes and otherwise falls back to timestamps or receive times. Fixes teltek/gst-plugin-ndi#79
I've integrated the fix here now: https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/tree/main/net/ndi |
Hmmm.. It looks like I have to come back to this. With the latest version from the gst-plugins-rs I still get the described issues. Every time audio gets in the mix the stream stalls. When I have a source without audio everything works fine. One issue is that I can't drop the audio packets in a pipeline that has audio, I have to pick up the audio pad or I get a pipeline error. Usually in gstreamer I don't have to do that? Also I get mixed up with all the versions.. It seems all versions that have the |
Can you report that over there with the exact pipeline you're using and a |
Hi,
Issue description:
When using a
ndisrc
as described in the README. the pipeline starts up but remains on time 0:00:00:000 forever, stalling the pipeline. In some random, rare cases, with uncompressed (non-HX) sources the pipeline starts to run.After fighting with these stalling issues in the latest version for a while (both on MacOS and Windows) I found that the problem seems to exist since c98b626 - versions up to 7c3e50c seem to be working as expected.
Thanks for this plugin,
Normen
The text was updated successfully, but these errors were encountered: