avconv: split the code for processing input packets out of transcode()