1

I have a 5 fps video with keyint 120 2.5 hours long that I want to speed up 6 times, making its fps=30

I did it with this command that I found somewhere on this website

ffmpeg -i "...local_Record.mkv"  -filter:v "fps=30, setpts=PTS/6" "...output1.mkv"

The output came laggy, its playing for 3-5 seconds and then freezes. If I jump back or forward it unfreezes for another 3-5 seconds and then freezes again. After uploading it on youtube I found that its not lagging there, however youtube shows its length as original 2.5 hours. It also shows that its processing percent is 95% for 12+ hours already (which means that this video is 100% bugged and wont ever be processed, since its 90 mb and 20 min long, and youtube can process videos that 5 gb and hour long in 10 minutes)

Then I tried to re-encode the video I got with this command

ffmpeg -i "...mkv" -c:v libx264 -crf 18 -preset veryfast -max_muxing_queue_size 1024 output.mp4

Which gave me 133 mb result that is also shows on youtube as 2.5 hours long and never finishes processing (can be played, but its invisible, in video manager both videos say its 95% processed)

How to do it correctly, so that video would not lag and youtube could correctly get its length?

edit - I found what was the problem - there was some sound in container even though there werent supposed to be any sound at all (I recorded it with obs with no sound enabled). So after I removed that sound with mmg, mpc opened it correctly showing that its 26 minutes long and youtube successfully processed it in couple minutes

2

The order should be reversed,

ffmpeg -i in -filter:v "setpts=PTS/6,fps=30" out

With the fps filter first, ffmpeg will insert 25 duplicate frames each second in order to convert 5 fps to 30, and then speed it up 6x. With the correct order, ffmpeg compresses the stream to have 30 source frames per second, and then all the fps filter ends up doing* is change the stream metadata to 30 fps.

*assuming constant frame-rate source.

Also note that YT re-encodes all videos, so your encoded keyint is not carried over by YT.

If you have audio, you'll need to that speed that up as well,

ffmpeg -i in -vf "setpts=PTS/6,fps=30" -af "atempo=6" out

Note that atempo till recently had a limit of 2, so for older versions of ffmpeg, you would use

ffmpeg -i in -vf "setpts=PTS/6,fps=30" -af "atempo=2,atempo=2,atempo=1.5" out
  • Unfortunately I had to delete 6 gb of source videos so I cant test your command at the moment, but will do it for future attempts. I updated my question with an attempts to fix this already speed up video. I found some command to re-encode video in hope to fix this endless youtube processing bug that I noticed, but it didnt worked. Do you know a way to 'fix' that video, maybe some other way to re-encode it so that youtube will be able to finish video processing, and maybe even realize that its not 2.5 hours but only 26 minutes? – jstq Sep 3 '18 at 2:54
  • nevermind I found what was the problem - there was some sound in container even though there werent supposed to be any sound at all (I recorded it with obs with no sound enabled). So after I removed that sound with mmg, mpc realized that its 26 minutes and youtube successfully processed it in couple minutes – jstq Sep 3 '18 at 3:57
  • doing this your way (setpts first) gives me this warning after encoding finished: 100000 buffers queued in out_0_0, something may be wrong. and its there for hours loading all my cpu cores for 100% doing nothing. If I cancel it, video is unplayable – jstq Sep 12 '18 at 21:32
  • Share full log. – Gyan Sep 13 '18 at 4:50

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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