Insert frames from still image into video?

Hi,


I need to insert some frames from a still image into a video that I'm building with AVMutableComposition.


I already have code that adds a watermark image on top of a video track, so I know how to do that. I figured I could do the same thing except have the video track be empty and the watermark image be the entire image I want to insert, but it isn't working.


To create the empty video track I did this:

compositionStillImageTrack = [mixComposition addMutableTrackWithMediaType:AVMediaTypeVideo preferredTrackID:kCMPersistentTrackI     ;
  [com
positionStillImageTrack insertEmptyTimeRange:CMTimeRangeMake(kCMTimeZero, duration)];

Later I created an AVMutableVideoCompositionLayerInstruction using that track.


The error message I'm seeing says "This media format is not supported."


Am I barking up the right tree here, or trying to do something that will never work?


Thanks,

Frank