AVAssetExportSession works on iPad, no audio on iPhone - iphone

I have the exact same code running on both the iPad and iPhone versions of my app and the code works fine on the iPad (the video is being exported properly with audio), but the exported video on the iPhone doesn't have any sound. I even ran the iPhone version on the iPad and it worked fine, which means that nothing should be wrong with the code itself.
Any insight on why the iPhone isn't exporting the video with audio would be much appreciated.
I have done some research and somebody mentioned that memory issues could be causing some export problems. The memory and CPU usage are fairly high during the video processing/exporting, but never high enough to receive a memory warning.
Thanks in advance.

You didn't mention if you stepped through the code (line by line) on the iPhone, setting breakpoints, watching each variable to make sure the value is correct, etc. This would be the first step.

Related

low framerate when running iframeextractor on iphone device

Would like to ask if anyone has encounter low framerate when running iframeextractor on iphone device. When i running it on simulator the video is fine but when code is run on iphone device, the framerate became slow. Do anyone know whats the cause? Thanks in advance.
The iphone processor is much slower than your desktop mac, and has less resources. rgb image conversion is slow.

Adobe Air + iphone microphone problem: low volume after SampleDataEvent.SAMPLE_DATA event

I am developing and iPhone app with Adobe Air 2.6 using Flash CS 5.5. I am trying to capture microphone input and then playback an mp3 file. The problem is now, that once I capture the microphone data with the SampleDataEvent.SAMPLE_DATA event, the volume of the playback mechanism seems to be decreased significantly.
To reproduce:
playback a (remote) mp3 file and the volume is ok
get the microphone and add the event listener (see code below), the listener function does not even need any code for this problem to occur.
same as step 1 (playback remote mp3) and the volume is very low.
// add the event listener
_microphone.addEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
private function onSampleData(event:SampleDataEvent):void
{
//while(event.data.bytesAvailable > 0) {
// _buffer.writeFloat(event.data.readFloat());
//}
}
// call this before playing back the mp3
_microphone.removeEventListener(SampleDataEvent.SAMPLE_DATA, onSampleData);
When testing with the Flash IDE, the problem does NOT occur and everything works as expected. Tested on iPhone 3GS with iOS 4.3.3.
If anybody experienced this problem I would greatly appreciate your insights.
UPDATE:
I think it is not an AIR problem per se. After using the iOS Microphone the whole app almost mutes itself, that is also the case for the typing on the virtual keyboard (which does not come from AIR). Doesn't really help me but maybe somebody knows how to shut down the microphone in an app so that speaker levels get back to normal?
UPDATE 2:
Here you can see a running example from Adobe http://tv.adobe.com/watch/adc-presents/developing-for-ios-with-air-for-mobile-26/, note that the speaker volume of the iphone in the live demo is really low too. So that must be a pretty huge bug then, making the microphone on the iPhone unusable.
download and use AIR 3 sdk
then set
SoundMixer.useSpeakerphoneForVoice = true;
SoundMixer.audioPlaybackMode = AudioPlaybackMode.MEDIA;
and your problem should be solved

AVAssetWriter startWriting Problem

AVAssetWriter startWriting is returning BOOL False value when i'm writing movie on 2G device, but for all other devices its returning TRUE value and working fine.Anyone faced this problem or do you have any clue why its happening,help me please
I am receiving false on startWriting on an iPad, when it works on both my iPhone3 and 4 (all have iOS 4.2). The status of the writer is failed, with the NSError as: "The operation couldn't be completed. (AVFoundationErrorDomain error -11800)."
Creation of the writer yielded no error when creating with file type: AVFileTypeQuickTimeMovie, and the file did NOT already exist. I've also tried using different pixel buffer pixel formats to no avail. Lastly, I've tried changing the video type to MPEG4 and M4V...again, to no avail.
I'm posting this here instead of creating a new problem, as they both are the same result and is not addressed. I need to have this resolved w/in a few days, so if I learn anything, I'll post what I find.
The most likely cause is that the specific iOS device you are running on does not include the hardware H264 encoder. I think that versions of iPhone earlier than 3GS have no hardware, but I am not sure if the iPad 1 has H264 encoding hardware. I know iPad 2 does have this hardware.

AVAssetExportSession missing audio track when exporting on device

I run the export on the simulator and everything works great. I run it on the device and the video gets exported but there's no audio. This leads me to believe that I must be using an audio format that the device doesn't support but OS X does, as the simulator uses what OS X uses. I've tried m4a, aiff, and aifc and have had no luck! Any ideas??
I have a very similar problem. It does not seem to do with codecs, as I made a separate test case that runs fine with the same video. There’s a related question that says the problem might be in playing the same assets using MPMoviePlayerController. That got me on the right track (sort of).
In my case the trouble stem from using the assets in an AVPlayer during the export. I was not able to find the exact combination that causes the export to drop the audio track – in the separate test project the export runs fine even though the asset plays in AVPlayer at the same time. After several hours of trying to find the exact cause I gave up and simply popped the asset out of the player using replaceCurrentItemWithPlayerItem:nil during export. It’s a hack, but it works.
AVFoundation is a very powerful framework, but God I wish it wasn’t so finicky or at least logged more errors instead of silently producing garbage.

Use images form camera without taking a photo

Is it possible to analyze the images without taking a foto on the iPhone ?
I want to analyze some matrix codes, without taking any foto. I saw this on some Nokia models and it's quite impressive: really fast!
On the iPhone, I've seen analyzing codes after taking a snapshot (or photo), and it's slower.
Also the iPhone camera is not good as some other mobile cameras.
I'm refering to iPhone 3G/3GS.
thanks,
r.
Yes.
Under iOS 4.x, you can use the new AVFoundation Framework to access camera pixel buffers on the 3G and 3GS, as well as the newer iPhone 4, without taking a photo/snapshot. The newer devices have higher resolution camera's.
I don't know if it's possible. But I think you should take a look at the AVCamDemo Apple's Code from de WWDC 2010. I think it could help you even if I didn't read a lot of code (juste compiled tje xCode project and tried it)
(Sorry but I can't find back the link)
You should be able to find the code in your emails if you are registred as an iPhone Developer. Or maybe on the developer.apple.com/iphone/ website.
By the way, don't think doing it on iPhone 3G (impossible I think). The iPhone 3GS should be fast enough for this kind of app.
Good Luck !