title: GPUImageMovieWriter and avfiletypempeg4 filetype
body: <p>First of all I would like congratulate Brad for the amazing work on GPUImage.</p>
  
  <p>I'm trying to apply a rotation to a given video file and obtain an mpeg4 (AVFileTypeMPEG4) file as output.</p>
  
  <p>When doing this I obtain the following message :</p>
  
  <p><em><strong></em>* -[AVAssetWriterInput appendSampleBuffer:] Input buffer must be in an uncompressed format when outputSettings is not nil</strong></p>
  
  <p>This problem occurs when using the following init method of GPUImageMovieWriter with filetype set to AVFileTypeMPEG4 :</p>
  
  <pre><code>- (id)initWithMovieURL:(NSURL *)newMovieURL size:(CGSize)newSize fileType:(NSString *)newFileType outputSettings:(NSMutableDictionary *)outputSettings;
  </code></pre>
  
  <p>However it works for the another init method which in fact generate quicktime movie (AVFileTypeQuickTimeMovie is set by default).</p>
  
  <pre><code>- (id)initWithMovieURL:(NSURL *)newMovieURL size:(CGSize)newSize;
  </code></pre>
  
  <p>Please can anybody say me if GPUImageWriter is capable from now to output mpeg4 movie file.</p>
  
  <p>After many investigation and tries you can see below one of the several code I made.</p>
  
  <pre><code>movieFile = [[GPUImageMovie alloc] initWithURL:inputUrl];
  movieFilter = [[GPUImageBrightnessFilter alloc] init];
  [movieFilter setInputRotation:videoRotationMode atIndex:0];
  [movieFile addTarget:movieFilter];
  unlink([[outputUrl path] UTF8String]); // If a file already exists, AVAssetWriter won't let you record new frames, so delete the old movie
  
  NSMutableDictionary *videoSettings = [[NSMutableDictionary alloc] init];;
  [videoSettings setObject:AVVideoCodecH264 forKey:AVVideoCodecKey];
  [videoSettings setObject:[NSNumber numberWithInteger:width] forKey:AVVideoWidthKey];
  [videoSettings setObject:[NSNumber numberWithInteger:height] forKey:AVVideoHeightKey];
  
  
  
  AudioChannelLayout channelLayout;
  memset(&amp;channelLayout, 0, sizeof(AudioChannelLayout));
  channelLayout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;
  
  NSDictionary *audioSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                  [ NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,
                                  [ NSNumber numberWithInt: 2 ], AVNumberOfChannelsKey,
                                  [ NSNumber numberWithFloat: 16000.0 ], AVSampleRateKey,
                                  [ NSData dataWithBytes:&amp;channelLayout length: sizeof( AudioChannelLayout ) ], AVChannelLayoutKey,
                                  [ NSNumber numberWithInt: 32000 ], AVEncoderBitRateKey,
                                  nil];
  
  
  
  // Will create quicktime file
  movieWriter = [[GPUImageMovieWriter alloc] initWithMovieURL:outputUrl size:CGSizeMake(640.0, 480.0) fileType:AVFileTypeMPEG4 outputSettings:videoSettings];
  
  
  [movieFilter addTarget:movieWriter];
  // Configure this for video from the movie file, where we want to preserve all video frames and audio samples
  movieWriter.shouldPassthroughAudio = NO; // default YES
  [movieWriter setHasAudioTrack:TRUE audioSettings:audioSettings];
  movieFile.audioEncodingTarget = movieWriter;
  [movieFile enableSynchronizedEncodingUsingMovieWriter:movieWriter];
  
  [movieWriter setDelegate:self];
  [movieWriter startRecording];
  [movieFile startProcessing];
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>PS : I'm using iOS6</p>