drfence
drfence

Reputation: 1567

EXC_BAD_ACCESS with AVAssetExportSession and AVMutableComposition

I'm recording audio separately from building an MPEG4 video on an iphone app. I'm trying to combine these using AVAssetExportSession.

Audio session is using 1 channel, kAudioFormatAppleLossless and AVAudioQualityMax. The video is AVVideoCodecH264, using pixel format type kCVPixelFormatType_32ARGB. This video without audio plays fine on my iphone via the photo library.

The exporter is telling me these are the supported presets, I'm using AVAssetExportPresetHighestQuality:

(
    AVAssetExportPresetAppleM4A,
    AVAssetExportPresetLowQuality,
    AVAssetExportPresetHighestQuality,
    AVAssetExportPreset640x480,
    AVAssetExportPresetMediumQuality
)

and it's telling me this is the supported file type:

(
    "com.apple.quicktime-movie"
)

if I switch to AVAssetExportPresetPassthrough I get file types of

(
    "com.apple.quicktime-movie",
    "com.apple.m4a-audio",
    "public.mpeg-4",
    "com.apple.m4v-video",
    "public.3gpp",
    "org.3gpp.adaptive-multi-rate-audio",
    "com.microsoft.waveform-audio",
    "public.aiff-audio",
    "public.aifc-audio"
)

I have tried quicktime movie and mpeg 4 as outputFileType and still get the same results.

EDIT: May 10th

Crash was due to a pretty silly error. I have audio and video now ... sweet!

Key is .mp4 extension, exportSession setOutputFileType:AVFileTypeQuickTimeMovie, presetName:AVAssetExportPresetPassthrough

Upvotes: 3

Views: 2433

Answers (1)

drfence
drfence

Reputation: 1567

My crash was a simple issue. The bigger problem I had was using the wrong filename extension. I'm now using .mp4, AVFileTypeQuickTimeMovie and AVAssetExportPresetPassthrough.

Upvotes: 3

Related Questions