no more quicktime and AVFoundation is incomplete, how to read RTSP?

Hi Folks,

I’m in the process of revamping an older app that among other things records from RTSP streams from IP video cams. In the distant past I used the MBS plugins to create a QTKit movie and exporter to get individual frames out and this worked just fine. Now recompiling it with a more recent Xojo version I find I can no longer do this because we’ve removed quicktime support from Xojo in 2014? OK, so I go to learn something about AVFoundation which is it’s replacement evidently, however it seems that AVFoundation is a poor replacement for quicktime as it supports far fewer protocols, RTSP being one that is no longer supported. The same camera streams that worked fine with QTKit no longer work with AVFoundation.

It’s interesting to note that the QTKitMovie still plays fine in Xojo, I just can’t capture frames from it which strikes me as capricious and cruel :wink:

So what other options are out there? I have experimented with the VLC plugin from MBS and it will indeed play the stream and let me capture stills from it, however it leaks memory like a sieve. Not the MBS part, but the libraries themselves as I’ve tested it in the VLC app and it’s the same. Just beyond the acrobatics that would be necessary to include a GPL3’ed library in the app (separate download or finding it in the VLC app in the applications folder, ugh) I can’t tell people that the app can only watch the stream for a few hours before their Mac will hang up due to memory swapping.

There is a wonderful wrapper for OpenCV by, I think, François Jouen that does amazing things but doesn’t seem to do any streaming that I can see. I may use it for other things though, very interested to do some more work with that, but thats besides the point.

Is there a viable solution for receiving an RTSP stream that doesn’t involve my writing my own input/receiver function for AVFoundation? I believe that ffmpeg can receive them, but again including a GPL’ed helper or library with the app isn’t my first choice and there doesn’t appear to be a wrapper for xojo written by anyone I can find yet so I’d have to start there first.

At the moment I’m just going to go back to compiling this app with xojo 2013 and see if I can get it working in the meantime, but this is not a long term solution. I refuse to believe that Apple is going to remove quicktime completely before AVFoundation can actually take it’s place. Why was it removed from Xojo so long before AVFoundation was working properly? Why can the QTKit still play the movie stream fine in xojo, but won’t let me have access to the QTExporter stuff? I am very frustrated by this the last 2 days.

http://blog.xojo.com/2014/01/23/the_end_of_quicktime/

ah, but I’m not using a movie player, the movie is loaded without a player via the MBS plugins and isn’t even a xojo movie object. It is never displayed in it’s live form, but only via individual frames captured with an MBS plugin class. how can the fact that you no longer use quicktime for the movie player and movie classes affect what the plugin is doing with a QTMovieMBS class and not a movie class? It’s very strange, the stream loads just fine into the QTKitMovie movie and returns all the proper codes to say it’s streaming and playing. I can even hear the sound though I’m not viewing it. When I go to create the frame grabber I get an unsupported operation exception.

I’ve rebuilt the app in xojo 2013r4.1 and it does work there again, but only every OTHER time I launch it. Every other time the app launches I get an out of memory error trying to create the frame grabber. How is it possible that something lives from one launch of the app to another? It’s going to be a very long day here isn’t it.

The frameworks do not include ANYTHING from QuickTime - not just the movie player

Depending on what OS you’re running on Quicktime may have different issues or unresolved bugs
I have no idea if Apple is still fixing issues in it for 32 bit apps or not but I would suspect not

Hi James. Yes this is frustrating. I too use Xojo 2013 for one of my apps due to this reason.

I have found a way to reliably record tsp streams to disc using VLC, without including VLC in my app.
My app runs a shell command that tells VLC cli to record the rtsp video to disc, works pretty good actually (once you finally get all the vlc shell command parameters right and wrap it in nohup … > /dev/null 2>&1 &).
https://wiki.videolan.org/Documentation:Streaming_HowTo/Receive_and_Save_a_Stream/

I’ve got the 2013 version working again. It was the example streaming server that was causing it to crash every other time :slight_smile: to a real server it works fine. I’ll do that for this maintenance release and then I will probably use a helper app dynamically linked against the vlc libraries to read those kinds of streams and send them up to the main app through a socket or pipe or something. Can you still do shared memory between 2 apps? I’m infuriated that Apple has made everyone ditch QuickTime while not providing an alternative yet that works properly. And continue to be confused that I can continue to use the qtkit stuff for creating movies of any type I want but it fails when wanting to extract individual frames from one. I’m also confused that xojo doesn’t do anything differently with quick time and yet the exporter plugin fails on 2016 bit works on 2013? Alas. I will get it working but jeeze what a pain.

Removal of quicktime was predicated on the demand to put apps in the app store - which meant NO QUICKTIME
Thats the article I linked to

Not sure if this is related… I use the deprecated EditableMovie class in 2013 to read and write frames but the app has to be Carbon. A Cocoa build can create an EditableMovie but most uses of it will crash or return nils.

At some point between 2013 and 2016 the OS version linked against was updated. Could that be it?

Norman, yes I understand that. But I’m still using the QTKitMBS classes to create movies on disk and add frames to them and that is still working perfectly. I can still create an RTSP stream and I can even play it! But when I try to create a frame grabber then I get an unsupported operation exception. This is with the exact same code, the exact same project opened in 2013 vs 2016 with the exact same plugins. What is different about post 2014 versions of xojo that make the plugins unable to create a frame grabber while still being able to create QTKitMovies and saving them and exporting them and absolutely everything works for me except the frameGrabber. Thats the mystery that I am pursuing :wink:

Compiled with 2013 with the same project and plugin files I can create movies and frame grabbers no problem. The exact same setup with the exact same plugins with the exact same project compiled with 2016 (or 2014r1) will create movies with QTKit and even play the same movie via a QTKitMovie object from MBS, but the creation of a frame grabber fails. Nothing else is different. I’m stymied by that. If the framework is using quick time or not for it’s movies shouldn’t impact that should it?

Will, I”m running on and compiling on 10.11.4. I can play the stream with the QTKit stuff from MBS, but the exact same project compiled with 2013 can export individual frames where the version compiled with anything since 2014r1 will not.

This is not really a complaint or a big report. I understand that Xojo can’t link to the quick time libs, but why does that keep the MBS plugins from using them for the grabber, but not for anything else?

This next release I need to get out with some bug fixes and a few new features I’m going to compile with 2013 as that seems to work, and then I will begin transitioning to using VLC libraries in a helper app so that when it’s memory has leaked to some extent I can kill it and restart it and recover the memory. The memory leaks in VLC when connecting to streams are really quite awful. It works fine from files, but from streams there are some serious bugs in there still.

this is quite likely relevant - but I’ll admit I’m not sure