title: Video compression using AVAssetWriter
body: <p>I've created a function to compress a video file. It uses <code>AVAssetWriter</code> and adds inputs and outputs for video and audio tracks. When it starts writing I'm getting an error when the <code>AVAssetReader</code> for the audio track starts reading, <code>audioReader.startReading()</code>. Here the error, <code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVAssetReader startReading] cannot be called again after reading has already started'</code>.</p>
  
  <p>The code: <a href="https://gist.github.com/jaumevn/9ba329aaf49c81c57a276fd135f53f20" rel="nofollow">https://gist.github.com/jaumevn/9ba329aaf49c81c57a276fd135f53f20</a></p>
  
  <p>Can anyone see what's the problem here? Thanks!</p>