Any way to get stable/consistent FPS form kinect? - kinect

I am trying to record kinect files in .oni format, that I will later try to synchronize with other sensors. As such, it is very important that I get consistent fps, even if some frames are repeats.
From what I can see now, WaitAndUpdateAll does not guarantee that the frame rate is consistent. I will be recording for several minutes (20+), so I need to make sure there is no drift!
Does anyone know if it's possible to lock down the fps of the recording, and if not, how stable the recording fps of the kinect is? Thanks!
After some investigation of this issue, I put together the following write up on the topic:
http://denislantsman.com/?p=50
Putting it here so interested people can find it and not have to wrestle with this issue.

My guess would be to go with the PCL libary since the developers also work together with the ROS team where they also have to sync sensors a lot. But be warned I wasn't able capture XYZRGB clouds at 30 FPS on windows 7. If you only need XYZ to be captured you should be fine. Worst case you have to time stamp and sync all your data by yourself.

Related

How to playback multiple audio files synchronously in Expo-av?

In my app users record themselves singing over a backing track, and then later playback the recorded audio and this backing track at the same time. I use expo-av for my audio system. The problem is that at the playback stage the audio is often out of sync because expo only really supports asynchronous audio. Does anyone have any advice on how to approach this problem at a high level?
A few of my ideas:
Mix the two audio files into a single file for playback. This almost works except for the fact that the recording and backing track are also out of sync. If I knew exactly how much they were offset, I could just add that amount of silence to one of the files when mixing. However, I haven't found a way to accurately calculate this offset.
Reduce time it takes for recording and playback to start, so that the latency is not noticeable. Some things I've found that help here are recording at lower quality and using smaller audio files. Any other tips here would be appreciated.
Use a different audio library than expo-av. Is there one that comes to mind that better supports synchronous audio? Ideally it would also be supported by Expo or at least React Native.

Can't get a GPS fix on an Acer Liquid Gallant Duo

It's already a long story... I bought my phone sometime in 2013, and found that it's GPS doesn't work, just after the warranty expired. I tired everything to get it function properly without any success, and finally gave up. Up until now I could live without it, but right now I'm really in need of this functionality, and only because of that I'd have to buy a new smartphone now if it can't be fixed.
Here's the issue: I turn on GPS positioning in the OS, and open up some GPS tester application, and this is what happens: After a couple of seconds, it finds the first satellite, and in 1-2 minutes I already have 6-7 or even 8 of them. - So it seems the hardware is OK, the receiver works. But after that, I cannot get a GPS fix. I can wait 10-20-30 minutes, or even waited for an hour...Nothing happens. No position fix, GPS useless. I've tried 10+ GPS apps, the result is always the same. They see the satellites, but never establish a position fix.
What I've done so far: I read on xda-developers that this phone for some reason doesn't have a gps.conf file in system/etc which could cause the problem, so I downloaded one for my country, rooted my phone and pasted it to that folder. Nothing changed. I'm out of ideas, and there's nothing more I could find on the internet. Any ideas here? Or should I get a new phone? It's really annoying because it seems it's not a hardware issue, so it should be able to be fixed somehow...
Btw that's the content of my gps.conf file in system/etc for Austria, the country I live in:
NTP_SERVER=at.pool.ntp.org
XTRA_SERVER_1=http://xtra1.gpsonextra.net/
xtra.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/
xtra.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/
xtra.bin
SUPL_HOST=supl.google.com
SUPL_PORT=7276
(I have no idea what it's for.)
Unassisted GPS in a GPS module which has never been turned on, or has to find a new position solution, can actually 2-4 hours at worse. Adding to this, a single processor Android smart phone such as yours likely throttles severely, and is not likely to schedule much resource for non-essential routines.
Be sure to turn on 'Google Location Services' to enable assisted GPS for a faster position solution. If any factory setting has a toggle for location- assistance, make sure it is enabled. Be sure to move away from buildings so the sensors view of the sky is widest.

Kinect Freezing After a Minute and a Half

I've been messing around with programming the old Kinect for a while, and something I've noticed is that whenever I start a program that uses the Kinect sensor, the Kinect will stop sending inputs after 1:30 minutes, no matter what program it is. For example, my game that I made will still have enemies moving around, but the player's rendered skeleton from the Kinect just freezes. I can't find anything about this anywhere online, so is it just mine? Is there a way to fix this?
This is a bug somewhere between the Microsoft SDK and using a Kinect for XBOX on Windows (didn't try the Kinect for Windows).
The Kinect stream freezes after 1 minute 28 seconds. In the Unity editor, you'll also notice once you reach this freeze, you need to quit and restart Unity to be able to play again. If not, you'll get messages like "Device not genuine", etc.
The only way to solve it that I found is to re-initialize whatever Kinect Manager you are using. For instance, Destroy()ing the gameObject holding the manager and re-Instantiate()ting it.
This will effectively halt your Kinect stream (and any gesture/joint reading) for about 4 seconds and then it will work again, so this is something the user will definitely notice.
Now, this may not work for most games, but if you're working on a casual game and you can keep it under 1:28 or you're able to show the user some sort of screen while you restart the Kinect manager every 1:20, you'll be safe.
If you never exceed the 1:28, you'll be able to stop and play in the Unity editor as many times as you want, and keep it running as many times as you want.
Now, this may not be an actual "answer", but may work for someone.
Let me know if you need any help to make this work. I hope this helps someone.
You can test the Kinect with built in programs in this link.programs to check and see if it works smoothly. If not may be something wrong with your program.
I have the same issue. At first I thought it was something related to Unity3d. But I tested with other programas and it's still happening.
Talking to the guy who developed the plugin he said: " two users complained that Kinect tracking stops after a while"
https://www.assetstore.unity3d.com/en/#!/content/7747
Also, I sent him an email and he told me that more and more people are getting this issue.

QTKit: Analog for VideoContext for the sound

I am writing a simple application for streaming video over the network, using a slightly different from the ordinary "H.264 over RTP" approach (i am using my own codecs).
To achieve this, i need raw frames and raw audio samples that QTMovie, when playing back a movie, implicitly sends to QTMovieView.
The most common way to retrieve raw video frames is to use VisualContext - and then, using a display link callback, i "generate" a CVPixelBufferRef, using this VisualContext. So i am getting frames with some frequency that is synchronized with my current refresh rate (not that i need this synchronization - i only need to have a "stream" of frames that i can transmit over the network - but CoreVideo Programming Guide and most Apple samples related to video promote this approach).
The first problem i have faced with - is when i attach a VisualContext to a QTMovie, the picture can't be rendered onto the QTMovieView anymore. I don't know why does this happen (i guess it's related to the idea of GWorld and the rendering being "detached" from it when i attach VisualContext). Ok, at least i have frames, which i could render onto a simple NSView (though this sounds wrong, and performance-unfriendly. Am i doing it right?)
What about the sound, i have no idea what to do. I need to get raw samples of sound as the movie being played (ideally - something similar to what QTCaptureDecompressedAudioOutput returns in its callback).
I have prepared myself to delving into deprecated Carbon QuickTime APIs, if there is no other way. But I don't know even where to start. Should i use the same CoreVideo Display link and periodically retrieve sound somehow? Should i get QTDataReference and locate the sound frames manually?
I am actually a beginner with programming video and audio services. If you could share some experience i would REALLY appreciate any idea you could share with me :)
Thank you,
James

How to turn off Video Acceleration programmatically

I'm using the Windows Media Player OCX in a program runned on hundreds of computers (dedicated).
I have found out that when video acceleration is turned on to "full", on some computers it will cause the video to fail to play correct, with green squares between movies and so on. Turn the acceleration to "None" and everything is fine.
This program is runned on ~800 computers that will autoupdate my program. So I want to add to the startup to my program that it turns off the video acceleration.
The question is, how do I turn off video Acceleration programmatically?
All computers are running XP and at least the second service pack.
It would take me ages to manually logg in to all those computers and change that setting so thats why I want the program to be able to do it automagically for me.
Using the suggested process of running procmon, and filtering out unnecessary data, I was able to determine the changes in the registry when this value changed:
Full Video Acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\VideoSettings]
"PerformanceSettings"=dword:00000002
"UseVMR"=dword:00000001
"UseVMROverlay"=dword:00000001
"UseRGB"=dword:00000001
"UseYUV"=dword:00000001
"UseFullScrMS"=dword:00000000
"DontUseFrameInterpolation"=dword:00000000
"DVDUseVMR"=dword:00000001
"DVDUseVMROverlay"=dword:00000001
"DVDUseVMRFSMS"=dword:00000001
"DVDUseSWDecoder"=dword:00000001
No Video Acceleration:
[HKEY_CURRENT_USER\Software\Microsoft\MediaPlayer\Preferences\VideoSettings]
"PerformanceSettings"=dword:00000000
"UseVMR"=dword:00000000
"UseVMROverlay"=dword:00000000
"UseRGB"=dword:00000000
"UseYUV"=dword:00000000
"UseFullScrMS"=dword:00000001
"DontUseFrameInterpolation"=dword:00000001
"DVDUseVMR"=dword:00000000
"DVDUseVMROverlay"=dword:00000000
"DVDUseVMRFSMS"=dword:00000000
"DVDUseSWDecoder"=dword:00000000
So, in short, set
PerformanceSettings
UseVMR
UseVMROverlay
UserRGB
UseYUV
DVDUseVMR
DVDUseVMROverlay
DVDUseVMRFSMS
DVDUseSWDecoder
to 0, and set
UseFullScrMS
DontUseFrameInterpolation
to 1.
It seems you're not the only one with this problem. Here's a link to a blog - the author solves his problem by lowering the hardware acceleration level. Tested on Media Player 9, 10 and 11 with REG script to set appropriate settings.
http://thebackroomtech.com/2009/04/15/global-fix-windows-media-player-audio-works-video-does-not/
As well as applying this fix, you might check the affected machines have the latest drivers and codec versions. Finally, if possible, you may consider re-coding the content to a format that doesn't produce the display problems (if the bug is codec related.)
Using hardware acceleration is certainly more energy-efficient - according to this Intel report, almost twice as much energy is used without acceleration, and as there are 800 machines, there's reason to seek out a green solution.