1

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?

d3pd
  • 3,791

2 Answers2

2

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 \
       out.avi

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...

References:

andrew.46
  • 39,359
0

for me it worked very well using this command:

ffmpeg -i in.mp4 \
   -filter_complex "[0:v]setpts=0.50*PTS[v];[0:a]atempo=2.00[a]" \
   -map "[v]" -map "[a]" out.mp4

Note: setpts=0.50 == 2x and the atempo must be 1/setpts == 2.0. Another example would be:

# 1.25x
ffmpeg -i in.mp4 \
   -filter_complex "[0:v]setpts=0.80*PTS[v];[0:a]atempo=1.25[a]" \
   -map "[v]" -map "[a]" out.mp4