none
Save Kinect color frames to a video file. RRS feed

  • Question

  • Hi,

    Let me go straight to the point here.  I put together an app to extract Kinect color frames and turns them into bitmap images (after reducing their resolution). Now I want to save these bitmaps to a video file and I'm trying to use this library (see link)

    http://www.codeproject.com/Articles/7388/A-Simple-C-Wrapper-for-the-AviFile-Library

    The issue is that, all of my Kinect applications are compiled for 64bit applications (this is a requirement for many libraries) and the above AvFile libraries only work in 32bit applications. 

    I know that everything works otherwise, because when I tried to stick with 32bit, I get the video files that I want, but then the Kinect side of things crashes. When I move everything to 64bit, then the AviFile libraries don't work. 

    I tried to build those AviFile libraries as 32bit dlls, then add the reference to them, from a 64bit application, but this solution does not even start.

    Is there any alternative to this problem? All I need to do is to save video files from bitmaps, or more generally from an image sequence... I thought this should be an easy thing, but apparently I was wrong.

    Thanks,

    Tuesday, November 15, 2016 7:19 PM

Answers

  • I am also one of those guys that don't like spawning processes if I can integrate some middleware SDK but video encoding is not a light procedure and it depends on your runtime. If it's just a small app that only does that, try to find some API and do it like you said(without the hassle of writing to disk first) but if the video encoding is just part of an application that does other perf sensitive stuff, I strongly recommend the outer process. ffmpeg is a well established project and probably gpu accelerated. So it will be as fast as possible after saving the image files. That's how I'd see it. I also have a friend at work who used that in a separate project and they also used the external process approach. It was fast enough. I guess it's a trade-off that relies on your context and also your preferences.
    Wednesday, November 16, 2016 4:42 PM

All replies

  • Have you tried ffmpeg?
    Actually I don't know whether you can integrate the library in your case, but at the very least, you can save the bitmaps to disk and then call the process with the correct command line args and it can work.
    Tuesday, November 15, 2016 8:09 PM
  • Yes, but ffmpeg API does not seem to work with .NET 4.5 or above.
    Tuesday, November 15, 2016 8:12 PM
  • Well it certainly works as a separate process. And if anything might be better to call that as a separate process to avoid any hangs in yours due to heavy work. At least you got a fallback. Unless for some reason its unacceptable for your use case.

    Tuesday, November 15, 2016 8:23 PM
  • Thanks for your feedback. I thought about going that way. It does work as a separate process, but I wanted to avoid saving the image sequence to image files and then turning them into a video file using ffmpeg. By the way I'm sure there are better ways to do that. Which approach would you recommend?

    Thanks

    Wednesday, November 16, 2016 3:52 PM
  • I am also one of those guys that don't like spawning processes if I can integrate some middleware SDK but video encoding is not a light procedure and it depends on your runtime. If it's just a small app that only does that, try to find some API and do it like you said(without the hassle of writing to disk first) but if the video encoding is just part of an application that does other perf sensitive stuff, I strongly recommend the outer process. ffmpeg is a well established project and probably gpu accelerated. So it will be as fast as possible after saving the image files. That's how I'd see it. I also have a friend at work who used that in a separate project and they also used the external process approach. It was fast enough. I guess it's a trade-off that relies on your context and also your preferences.
    Wednesday, November 16, 2016 4:42 PM
  • Thank you so much for your help. I'll go with ffmpeg and let you know how it goes.

    Thanks again.

    Wednesday, November 16, 2016 4:49 PM
  • Good luck!! :)
    Wednesday, November 16, 2016 5:41 PM