I want to change the speed of an AVI video file such that it takes twice as long to play as it did originally. I have attempted to do this with ffmpeg, but this results in a very low quality video:

ffmpeg -i in.avi -filter:v "setpts=2.0*PTS" out.avi

How should this be done on Ubuntu 15.10 without this loss of quality?

  • Does your video clip have audio as well? I uspect the issue is that you are at the mercy of the FFmpeg defaults with the avi container and should modify these. Can you pastebin your command and full terminal output? – andrew.46 Apr 6 '16 at 10:17

I suspect that your copy of FFmpeg is also re-encoding using the defaults for the avi container, which can be a little unforgiving. Try running the following simple additions to your commandline:

ffmpeg -i in.avi \
       -filter:v "setpts=2.0*PTS" \
       -c:v mpeg4 -q:v 2 \
       -an \

The driving part of this commandline is the 'quality' setting: -q:v 2 which can be set from 1-31 with the highest quality being 1 and the lowest being 31. Note as well that I have used -an to bar use of the audio stream.

If this effectively increases the quality of your output video you could consider adding the following flags to your video line:

-vtag XVID -f avi -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 300

I routinely use these flags when encoding for an older device and they do produce a significantly better result...


  • This is a great answer. – NBCKLY Jun 22 '18 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.