Video capture on MacOS - macos

I'm wrtiting a C++ application with Trolltech QT Library and I need to capture video stream from a camera and some medical instrumentations.
What kind of hardware can I use to do this? I've tried with OpenCV but it doesn't recognize my EyeTV 250.
Can I use Pinnacle Video capture for Mac?
thanks,
Andrea

I believe that Qt delegates to QuickTime for media on OS X. I'd therefore expect that any hardware supported by QuickTime is in play. If you're willing to be locked to OS X, using the native API will likely be much easier. QTKit, the Objective-C API for QuickTime is new with Leopard (OS X 10.5) and is very good. You'll likely want to start with QTKit's Capture API. Since you're working with C++, you'll also want to learn about Objective-C++ for building the connection between QTKit and your code.

Try openCV, there is a good project here : http://code.google.com/p/opencv-cocoa/ there are c++ class.

Related

How to write into a MP4 container with Cocoa?

I need to export an MP4 file containing several streams of audio. There is no video at all at this point in time, though this might be requested sometimes in the future.
All this is on the Mac running a decently recent version of Mac OS X. QT Kit is not an option. Portability to iOS would be a bonus.
Where should I look? A very casual look at AV Foundation suggests this might be a way, but doesn't look simple at all.
Or should I rather look for a third party library? ffmpeg? mp4v2?
Thanks for any suggestion.

QT movie processing on GPU

I'm working on a QTKit project in cocoa where the QT movie is taking up ~70% of the CPU load. I would like to move some of the processing load onto the GPU, if possible. Does anyone know if that is possible?
On Snow Leopard, use initWithAttributes:error: to create the QTMovie object, and include the QTMovieOpenForPlaybackAttribute attribute with a value of YES. This will use QuickTime X to decode/play the movie, which, if possible, will play it with GPU acceleration.
Be aware that this locks out a lot of functionality. You really do need to only be using the movie for playback. The QuickTime Kit Application Programming Guide has more information.
Install a GPU QuickTime codec for the movie format you want to support ? Apparently such things exist, e.g. CoreAVC.

Can I use OSX AUGraph from monomac?

I have an mp3 playing application written in C# which I would like to port to OSX.
As it uses DirectShow to play mp3 I realise that I will need to recode the audio playback part. I found Apple's playfile sample which uses AUGraph.
The Binding Cocoa section of http://www.mono-project.com/MonoMac mentions the "much simpler AudioToolBox API".
Can anyone point me at sample code for using the AudioToolBox from C# or preferably using AUGraph from C#.
Is porting my code to monomac the best approach or would I be better taking the plunge and recoding in Objective C.
These are some samples of using AudioUnit using the same API that MonoMac has, except that these samples target the iPhone using MonoTouch:
https://github.com/migueldeicaza/MonoTouch.AudioUnit
Setting AudioUnit up is a little cumbersome, if all you want is to play MP3 files without doing any low-level processing or applying effects, you can use the MonoMac.AppKit.NSSound API instead.
The page you linked does say that AudioToolbox (i.e. CoreAudio) is fully bound. I don't know of any samples but it shouldn't be hard to port C code.
Alternatively you could go onto the mono-osx mailing list and request a binding of QTKit, or even do this binding yourself. I hear that the MonoMac binding generator makes it quite easy to bind Objective-C APIs.
It's going to be much quicker and easier to use your existing C# code and knowledge, even if you do have to do some bindings yourself.
AUGraph is part of Core Audio. It is used to assemble a graph of Audio units and can be used for audio playback. Core Audio is a low level framework that has a C API.
Maybe you can use QTKit (a cocoa wrapper around QuickTime) from Mono.
In my opinion it is always the best approach to work with a platforms "native" technology. (Which would be Objective-C and Cocoa for Mac OS X).
Apple has a nice sample that shows how to create a media player using QTKit:
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/QTKitApplicationTutorial/Introduction/Introduction.html%23//apple_ref/doc/uid/TP40008155-CH1-SW1

Streaming from webcam on OS X - what technology to use?

I'm building a videoconferencing application in OS X.
What technology would be best to use for real-time streaming video/audio captured from webcam/microphone in OS X?
So far I was unsuccessful with these methods:
using QTKit I captured the media, but there isn't a way to stream it (without using the QTSS which is too bloaty and hard to control programmatically).
using QT Java I got everything (almost) working, but the library is deprecated, it crashes every once in a while, signals memory leaking and there isn't a way to save preferences from a settings dialog
I installed gstreamer using Macports, but there isn't a working osxvideosrc (or audio for that matter)
My next target is VLC because it can access the webcam in OS X, but I'm not sure will it give me what I need - can I control it fully over an API and can I display the stream inside a Cocoa application (using QTKit's player)?
Could of points:
Consider Flex/Flash and possible Adobe Air. Many people have written videoconferencing applications this way.
QT for Java is dated and not going anywhere.
VLC is a solid option. Stable, well known, powerful, and very mature.

Are there any API to turn on DXVA in Mac OSX

I wrote a video playback application based on Carbon in MAC OSX, are there any API to turn on the DXVA feature which support by Graphic Card? Does it support in QuickTime SDK or Carbon API?
DirectX is part of Windows. It doesn't exist in Mac OS X.
If you're doing hardware-accelerated video playback: Why are you worrying about it? If the hardware supports it, chances are, the APIs will use it. So just play your movie and let the library take care of doing it through the graphics card or not.
If you're doing video capture: Core Video will let you do that through the graphics card.
I believe that on very-recent hardware only, QuickTime will use hardware video acceleration for the decoding of some types of video stream.
Note that this is NOT specifically related to the capabilities of the graphics card, for example the 8800GT PureVideo feature works fine under Windows but is unused in OS X.

Resources