[sudo-discuss] how to speed up a video file and reduce its size?

Sean Greenslade sean at seangreenslade.com
Thu Oct 8 08:59:51 PDT 2020


On Wed, Oct 07, 2020 at 11:19:36PM -0700, Carl Gorringe wrote:
> Hi Jake,
> 
> According to my notes...
> 
> To double the speed of a video:
> $ ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS” output.mp4
> 
> Use -an to disable audio:
> $ ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4
> 
> Use 0.333 instead of 0.5 for 3x speed. 0.05 for 20x.
> 
> cheers
> -Carl

Some other tricks to squash file size:

If you don't need to do any seeking during playback and the scene is
mostly static, you can extend the keyframe interval with encoder
parameters. You can also tweak the quality target with crf (0 to 63,
higher is lower quality):

$ ffmpeg -i input.mp4 -an -filter:v "setpts=0.125*PTS" -c:v libx264 -x264-params "keyint=1000:crf=27" out.mkv

And if the contents of the video have truly static portions (like a
screencast, for example), you can use the "-tune animation" option.

For encoding speed, I think the libx264 encoder uses all threads by
default, but there is a -threads N option if it doesn't.

--Sean



More information about the sudo-discuss mailing list