Seba Niepodam
Seba Niepodam

Reputation: 37

'Cannot Decode' error when trying to save file using AVAssetExportSession when using Xamarin

I ported this example: of overlaping video to Xamarin.

When i use this AVMutableComposition in AVPlayer i can watch edited video. But when i try to save it using AVAssetExportSession i always get 'Cannot Decode' error. I tried every preset and every file type and it doesn't help.

I also tried to use official monotouch example of AVCompositionDebugVieweriOS and i get same error.

public AVAssetExportSession AssetExportSession (string presetName)
{
    var session = new AVAssetExportSession (Composition, presetName);
    session.VideoComposition = VideoComposition;
    session.AudioMix = AudioMix;
    return session;
}

When i leave session.VideoComposition as null:

public AVAssetExportSession AssetExportSession (string presetName)
{
    var session = new AVAssetExportSession (Composition, presetName);
    //session.VideoComposition = VideoComposition;
    session.AudioMix = AudioMix;
    return session;
}

The file saves without problem (but without overlay i need to have).

Anybody knows why when i use AVAssetExportSession.VideoComposition then i have 'Cannot Decode' error? Is this Xamarain/MonoTouch problem?

Upvotes: 1

Views: 500

Answers (1)

Seba Niepodam
Seba Niepodam

Reputation: 37

Ok I resolve this issue. It appears that the problem was ONLY when i use iPhone simulator. When i deploy my app to device it works fine.

Maybe this will help someone: If you have 'Cannot Decode' error in simulator, check if code runs on the device.

Upvotes: 2

Related Questions