title: how to add fade in/out effect in avassetwriter (img to video) in iphone
body: <p>I'm creating a .mov from the array of images with audio using avassetwriter and i want to add the fade in/out effect in the creating video, have anyone used any code? Thanks in advance for any help!</p>
  
  <p><pre>
  <code>...
  for(UIImage * img in imageArray)
      {
          //UIImage * img = frm._imageFrame;
          buffer = [self pixelBufferFromCGImage:[img CGImage]];</p>
  
  <code>    BOOL append_ok = NO;
      int j = 0;
      while (!append_ok &amp;&amp; j &lt; 30) {
          if (adaptor.assetWriterInput.readyForMoreMediaData)  {
              //print out status:
              NSLog(@"Processing video frame (%d,%d)",frameCount,[imageArray count]);
  
              CMTime frameTime = CMTimeMake(frameCount*frameDuration,(int32_t) fps);
              append_ok = [adaptor appendPixelBuffer:buffer withPresentationTime:frameTime];
              if(!append_ok){
                  NSError *error = videoWriter.error;
                  if(error!=nil) {
                      NSLog(@"Unresolved error %@,%@.", error, [error userInfo]);
                  }
              }
          }
          else {
              printf("adaptor not ready %d, %d\n", frameCount, j);
              [NSThread sleepForTimeInterval:0.1];
          }
          j++;
      }
      if (!append_ok) {
          printf("error appending image %d times %d\n, with error.", frameCount, j);
      }
      frameCount++;
  }...
  </code></pre>
  
  <p>
  </code></p>