How to write into a MP4 container with Cocoa? - macos

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.

Related

Playing video in Qt (on a Mac)

This question arises out of a combination of this being my first time working with video and unfamiliarity with Macs. Basically I'm finding it difficult to figure out how to play a video (within a QWidget, or otherwise) using any standard format, e.g. avi, mpeg, mov, etc. In particular,
QMovie::supportedFormats() gives me only .gif and .mng, but I need to use standard formats. Is there a way to increase the number of supported formats?
Phonon requires the presence of a 'backend' which the user has to implement himself. I looked to see if I could somehow do this with Quicktime, but I couldn't get the application to launch--and anyway I didn't really see how to do that. Also, Phonon looks pretty heavyweight, I'd like to avoid it if I could.
While there are plenty of avi (et al.) players floating around on the web, I think it's probably unlikely I'd be able to use them--I need to start, stop, and change the playback speed of videos programmatically i.e. through my C++ program.
I'm not sure why this should be so hard--working with images in Qt is a snap by comparison. So: What's a good way to play videos from within a C++/Qt program?
Stop what you are doing right now: Phonon is the past, Qt Mobility is the future.
After you download, compile and install Qt Mobility, check the examples: videowidget and videographicsitem, located at: qt-mobility-opensource-src-1.2.0/examples/
They pretty much answer all your questions.

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.

I need to develop a project involving hardware which should also work the same on Windows as well as Macs. Whats the way forward?

Whats the best approach (read painless) that I could take?
Primarily, the application needs to record the webcam video + mic recording on the disk and compress the video using ffmpeg (or something similar).
So there is hardware involved + running a separate process for encoding.
I was seriously considering Adobe AIR - but I read on the Adobe site that it does not have permission to run other applications which can be problematic if I want to encode the video using ffmpeg.
Did you consider developing it in Java? In that case you should take a look at the Eclipse Rich Client platform. I have developed a couple of programs by using Eclipse RCP and I would never develop an app in Java without it. It uses SWT and jFace and provides options for exporting the app to run on OSX, Linux and Windows.
You should give it a try.
If you can develop it under Mono, much of it will work on both platforms.
Qt. Simple as pie.

User-friendly approach for network streaming, playing and seeking of audio files in Mac OS X 10.5

Please advise a combination of server and client technologies, tools and frameworks to implement a solution that meets the following requirements?
File server in the network has a huge library of mp3/aac/aiff/wav music files
Desktop cocoa application accesses audio files using URLs: rtmp, http, rtsp+rtp, ftp — how to make a choice?
Audio content should be streamed and played with seeking (it's crucial) without downloading the entire file: QuckTime, AudioQueue, AudioFile, AudioStream, CFHTTP, All of them? — how to develop a client?
After solid research I've ended up with myriads of options and articles. But it looks like a half of them is quite out-of-date (2001—2005), and the other half is about universal code (pure C) for Mac OS X and iPhone OS.
However the main goal here is to write a Desktop music player for Mac OS 10.5.
I cannot believe that all this raw C-coding is just required.
No wrappers? No handy libraries? No components?
P. S. Research has resulted in the following combination: qt_tools for hinting + DSS for RTSP streaming + QTMovie for playing back + setCurrentTime: for seeking. This selection requires double-space for storing hinted .MOV-versions of every music file but works anyway.
I am not sure, but I believe you can use [QTMovie movieWithURL:url error:err] to stream a movie from a URL, then pass it to a QTMovieView object. QuickTime treats audio like movies, so it may work. Or it may try to load the entire file.
Have a look at the QuickTime streaming Guide
Did you look at VLC as a streaming solution?

Installing just Quicktime libraries on Windows

There's Quicktime SDK for Windows, but any application that uses it needs quicktime runtime libraries to be installed on the system (SDK itself just has headers and library stubs, and not the actual DLLs).
If my application uses Quicktime, I'd like to install the necessary libraries with it's installer, thus not requiring user to install Quicktime separately. What I'm looking for is some sort of "quicktime redistributable".
As of now (quicktime 7.x), I can't find a way to do that. I could bundle whole quicktime installer (about 20 MiB), and launch it with MSI's silent/unattended flag. However, that way it has several side effects:
creates Quicktime player shortcut on desktop and in quick launch bar
hijacks file associations, (e.g. .mov becomes associated with Quicktime Player, even if it was associated with something else before)
installs some service/process (qttask) that presumably watches for Quicktime associations, or handles auto-updates.
installs Quicktime Player, which I don't need in fact.
Of the above, first three are quite bad.
Is there a way to "just install the libraries" for Quicktime?
In my application, I'd use Quicktime to import images, movies and audio files in various formats. If there is no sane way to install Quicktime runtime without side effects (changed file associations, extra icons, ...), then I should be seriously looking at alternative solutions (e.g. FreeImage to load images, perhaps DirectShow for video/audio).
If you need to redistribute QuickTime, see QuickTime Licensing for details. You're not allowed to redistribute any of the QuickTime libraries without a written agreement with Apple. Many CD-replication companies will actually request proof of this agreement before printing large numbers of CDs.
I would definitely not distribute "QuickTime Lite" without consulting with either a lawyer or your Apple licensing representative.
Your best bet, AFAIK, is to use the full QuickTime installer (all 20MB of it), and have your main installer run it with a "silent" flag. That, at least, will allow your users to install QuickTime without a half-dozen dialogs (and without those annoying pictures of surfers in bikinis). The people at Apple's licensing division seemed to think that using the "silent" flag was acceptable, at least when we consulted them.
One warning: If the user already has an older version of QuickTime 6 Pro (or earlier) installed, then installing QuickTime 7 silently will nuke their QuickTime Pro registration and they'll have to repurchase it. We actually detect this situation in our installer and display a warning during the installation process, much like Apple does.
Yes, this is a pain. After 6+ years of working with QuickTime, I'd honestly recommend looking at other video frameworks. We're currently evaluating Ogg Theora.
You could include, with your setup package, a program called Quicktime Lite. It comes with the same libraries as Quicktime uses, but is much, much smaller.
Here"s the link:
Download Quicktime Lite
Quicktime Alternative does what you want, but for the reasons others have stated here, its illegal. Apple probably is not going to let you do what you want.

Resources