Wowza Community

Publishing real-time captured video to Wowza from Obective-C Mac app

I have a use case that is conceptually pretty simple: I need to programmatically capture video from a webcam, and stream it to a Wowza server. The devil’s always in the details, here are mine:

  1. I am capturing video from a webcam (or internal MacBook Pro camera) in a Mac OS X app (read Objective-C) using QTKit (already works, no problem there).

  2. I need to publish the video frames captured in 1 in real-time to Wowza. Ideally I want to use RTMP, as we already have Wowza in production receiving RTMP-published streams and serving Flash-based streams, so this is a clean integration that doesn’t tip over any existing infrastructure.

*NOTE: Flash/Flex components may not be used in the app in any way. This needs to be facilitated using native Objective-C and/or existing C/C++ libraries.

One would think this would be fairly straightforward. However, it is anything but. Notes/what I’ve searched/what’s been tried:

  • Cocoa / foundation / QTKit do not (to my knowledge) expose APIs to deal with FLV video format/transcoding, or outbound streaming of video using RTMP, RTSP, etc. I actually spoke directly with Apple video-engineers on this topic, and they confirmed this. Apple APIs generally support video consumption, not publishing.

  • I’ve spent quite a bit of time working with FFmpeg. While I have accomplished the transcoding of a h.264 video file to flv and RTMP transmission to Wowza successfully using the FFmpeg binary, I have not been able to successfully facilitate this programmatically (using their libraries), and I also have not been able to determine how this can be done with a real-time frame-by-frame video using a stream as input. I have attempted asking various questions on their libav-user list to no avail. The FFmpeg documentation isn’t a good roadmap either, and it appears that accomplishing this with a stream is either wonky/questionable anyway.

  • LIVE555 I’ve used in the past, and to my knowledge, it won’t handle the transcoding needs, only transport. I’d like to avoid it if at all possible.

  • I’ve looked at Perian. It is apparently end-of-lifed.

  • I’ve attempted contacting the Livu developer for information on their API. Still awaiting a response. But the last blog post of theirs was early in 2012, and it doesn’t appear that RTMP ever made it into their API.

  • I’ve searched all threads I can think of on the Wowza forums relating to Mac OS X, Objective-C, RTMP publishing from Mac / iOS, etc. It would appear that the most common forum posts pertain to mobile / iOS, but in general, those could be summed up by saying that there’s some success on the Android side using Java code, but there does not appear to be a definitive solution on the Mac / iOS side.

  • Without rehashing all the leads/dead-ends/etc., I’ve spent hours upon hours Googling, with no clear solution available.

Bottom line is this, if there is a clear solution for native Objective-C / (or external library) that can do the aforementioned video transcoding and outbound publishing / transport, I haven’t found it. It is clear from forum posts, posts on StackOverflow, etc. that this is appears to be a fairly common need in general, as there are quite a few people wanting to do this, but responses aren’t very informative for the most part, usually directing folks to other resources which don’t answer the problem either. It is also clear that quite a few of those wanting to publish video are attempting to do so specifically to Wowza. So the need is not only a general one, but Wowza customers have apparently been after this solution for a while (going back several years at least). Hopefully there’s been progress by someone somewhere in solving this problem.

What I am looking for here (and I would greatly appreciate any guidance from Wowza engineers), is (in order of preference):

  1. An existing Objective-C or C/C++ library that will take captured video frames and RTMP publish (or even RTSP publish) to Wowza, for use in a Mac app. Put simply, publishing programmatically from Mac appears to be a huge void in the development toolchain for those that want to build apps for use with Wowza. (I understand that FFmpeg is presently the closest thing to this, but with no clear documentation or sample on how to accomplish the specifics, it still is kind of a mystery if and how this can be done).

  2. In lieu of no existing library being available, I’d appreciate the best / most efficient / preferred approach recommended by the Wowza engineers / those who have gone before on how to approach this, and the ideal protocol / publishing scenario for integration with Wowza. If I have to build this by hand, I’d like to know the solution was targeted at the ideal, rather than a secondary or less preferred approach.

The client which I am producing this solution for is already heavily vested in video streaming with Wowza, and the need for a solution is immediate, so any expedient reply is greatly appreciated.

Thanks in advance for any help you can lend.

Regards,

Brad