Speed up video x1.5 but keep all frames

2

So I'm trying to speed up all my tv episodes (because some of them are really slow paced). The source is 30fps. And if already tried to do this with the following command:(I'm doing x1.6 because that's easier to make the setpts value (otherwise it would be 0.66666666666...)

ffmpeg -i VideoOriginal.mkv -r 48 -filter:v "setpts=0.625*PTS" VideoSpeedup.mkv

But the filesize here is WAY lower (maybe I should also use a preset for the quality?) Either way. The file is 40 minutes long and pretty much is broken after 10 minutes (VLC starts to misinterpreted timestamps and the player is pretty much F*cked).

Also the audio isn't speedup with this method.

Any tips on how to make this better?

(Reason why I want to 'keep all frames'. Is because since I'm going x1.6 I can just do 48fps meaning that I don't actually lose or have to generate new frames.)

EDIT: just realised that my original file's fps is 23.97612 .... I guess that does make things more complicated...?

Thibault Molleman

Posted 2017-09-05T07:20:18.493

Reputation: 25

Answers

5

When changing the video speed, you usually do not have to set -r, but just let ffmpeg change the timestamps of the frames. This might lead to frame drops, which can of course be avoided by setting the proper framerate as you tried, but you have to set it after the input specification.

To speed up both video and audio:

ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.625*PTS[v];[0:a]atempo=1.6[a]" -map "[v]" -map "[a]" output.mkv

Audio tempo is the inverse of the factor modifying frame timestamps. And with the framerate change:

ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.625*PTS[v];[0:a]atempo=1.6[a]" -r 48 -map "[v]" -map "[a]" output.mkv

But the filesize here is WAY lower

That's because everything is re-encoded. Usually, libx264 is used for video encoding. The default quality should be good, but you can change it by using the -crf option, for example. See the H.264 encoding guide for more.

You could also just tell VLC to speed up playback from the Playback menu. This avoids unnecessary conversion and hardcoding of the speed change.

slhck

Posted 2017-09-05T07:20:18.493

Reputation: 182 472

Thanks! Trying it out right now. Just wanted to say that with my previous command I was getting ' Starting new cluster due to timestamp'. But now with your command I'm getting 'Past duration 0.994987 too large' pretty frequently... Is that something I should worry about, or just ignore? – Thibault Molleman – 2017-09-05T13:12:06.977

I tried it out and seems like it converted it to a 23.97612 file instead of a 48fps file which makes everything look very choppy now. Any idea why that is? – Thibault Molleman – 2017-09-05T13:57:26.673

Making it 48fps is not automatically going to make it any smoother. Can you post the entire command-line log? – slhck – 2017-09-05T17:25:12.223

It will right? Because right now it's cramming 48frames into 23,.... which results in more choppy video. Here's my log: https://pastebin.com/LAqctUK7

– Thibault Molleman – 2017-09-05T21:37:53.520

Hm, you can try with -r 48 to avoid dropping frames, but it still should not look choppy. Perhaps try with a newer version of ffmpeg? Yours is from 2015. http://ffmpeg.org/download.html

– slhck – 2017-09-06T06:37:54.867

1Didn't even realise that I was on old version (nice spotting!) I updated to the newest stable version. Your original suggestion still gives me something that looks equally choppy. But If I add the -r 48 after my input (like on my original command) then the results is PERFECT! Exactly what I was looking for. (Maybe EDIT the answer to include the '-r 48' and I'll mark is as the answer! (thank you so much btw!) – Thibault Molleman – 2017-09-08T08:57:21.150

Great, thanks for letting me know! Answer updated. – slhck – 2017-09-08T09:27:50.413

2

(Because you mentioned VLC in your question ...)

In VLC, go to the Playback menu, select Speed/Faster or Speed/Faster (fine).

Edit: and @slhck agrees, so I must be right :-)

mcalex

Posted 2017-09-05T07:20:18.493

Reputation: 2 315

Yeah I know VLC has that built in. But I'm converting them so I can put them in Plex and stream them to my ipad/smartphone. But thanks though! – Thibault Molleman – 2017-09-05T13:09:11.610