# OBS Timelapse recording?



## testgcd (Jul 23, 2020)

I want to record an hour of video with OBS.

Afterwards I want to compress that hour into 10 seconds via for example Adobe Premiere.

However, the whole process takes too much time and Premiere can only compress it to lets say around 1 minute, and it takes a long time to compress it, and the quality is not good after post processing.

Is there a guide about calculating how to set up OBS to directly record only what is needed over the hour that it is recording?


----------



## koala (Jul 23, 2020)

You want to record one hour and timelapse this into 10 seconds.
I suppose you want the timelapse video have 60 fps.

So 10 seconds with 60 fps are 10 * 60 = 600 frames.
And you want a speedup factor of 3600 seconds / 10 seconds = 360

That means you need to record 600 frames into your one hour source video. If you record more, the additional frames would be dropped, so you don't need to record more in the first place.
So 600 frames within 3600 seconds. This is 600 frames / 3600 seconds = 1/6 fps. One frame every 6 seconds.

You can enter this fps in OBS as "fractional fps value" in Settings->Video. Set Numerator to 1 and Denominator to 6.

A video recorded with these settings will play normally (1 hour) in any media player and look like a slideshow with changing the image every 6 seconds. The file itself will be rather small, since it will contain only 600 frames.

Be aware that if you press the "stop recording" button while recording with 1/6 fps, it may take a few minutes until the recording actually stops, because OBS can only stop about every 20 frames. If it needs to record another 19 frames, it takes up to 19*6 = 114 seconds or almost 2 minutes until the recording stops gracefully. If you press stop again to force stop, you might lose some of the last frames.

Also be aware the the preview of OBS also works at 1/6 fps if you enter this fps value. 1 image every 6 seconds. Setting up a source also is slideshow-like and saving changes of seource properties may take up to 6 seconds - it is synchronized to the fps.
It may be better to set up everything with 10 fps in Settings->Video and as final steop after everything is ready you change the fps to 1/6.

After recording you need a video editor that is able to change the fps of a video and at the same time reduce the length. I don't know how to do this in Adobe Premiere, but I know how to do this with ffmpeg:

`ffmpeg -i "input.mkv" -filter:v "setpts=PTS/360" -an -r 60 timelapse.mkv`

With the setpts filter, you "patch" the presentation timestamp (pts) of every frame to 1/360, thus playing the video 360 times faster - our speedup factor.
With the -an option you drop the (now meaningless) audio track.
with the -r 60 option you define the output fps 60
The resulting test.mkv will be 10 s long, if the original input.mkv was 3600 s long.

If you find 1/6 fps silly, record with 1 fps. The source file will be larger, but the OBS GUI will respond faster. In this case, ffmpeg will drop the additional frames, but the timelapse result will be the same.

You can optimize the quality within the OBS recording settings, because your encoder has plenty of time to encode one frame. It has 6 seconds for every frame. Proposal for OBS settings:


----------



## koala (Jul 24, 2020)

ps. the only real thing in my previous post is the ffmpeg command line. You can feed it any video, regardless the fps. It will speed it up by a factor of 360 and create an output fps of 60. If you need a different speedup factor or destination fps, just change it.
The computing of the fps and number of frames in the source video is only to make the original recording as lightweight as possible.


----------



## testgcd (Jul 24, 2020)

Works like a charm, thank you.

New problem:
the 10sec version is of significantly less quality than the 1 hour version - more blocky. Why is this the case? Shouldn't it be the exact same quality, since it just takes the same certain frames from the original, and just skips others?

(I used the exact same settings for OBS, with the only difference being 1fps instead of 1/6, and recorded a 70min video)


----------



## testgcd (Jul 24, 2020)

How it looks:  https://i.imgur.com/2pXtKG9.jpg


----------



## Tomasz Góral (Jul 24, 2020)

did you use ffmpeg?
If so, bitrate information is missing there
ffmpeg -i "input.mkv" -filter:v "setpts=PTS/360" -an -r 60 -b:v 8000k  timelapse.mkv

 -b:v 8000k - bitrate video stream


----------



## testgcd (Jul 24, 2020)

yes I used ffmpeg.

I tried the  -b:v 8000k, I assume that directs it to do an 8000 Kbps video. It actually looks less blocky than the previous attempt, thanks.

How do I know what bitrate to set it  btw? When I go to Properties of the original  70min video it says bitrate 0kbps.  Also, when I go to Properties of the 10sec video generated by the  -b:v 8000k command, it also says bitrate 0kbps, which I thought was weird - shouldn't it say 8000kbps?

What is the approximate obs CRF 10 setting equivalent to bitrate? Why not put  "-b:v 120000k" for example?


----------



## Tomasz Góral (Jul 24, 2020)

0 is the only mode variable (np.VBR, CQP), a CBR Constant BitRate.
You can provide any value, but it doesn't make sense as much as in the original file.
There are programs available to check the bitrate of the file (like MediaInfo)


----------



## testgcd (Jul 24, 2020)

I used mediainfo to check the bitrate of the original 70min file, and it says "Overal bitrate 6 669kb/s". 
Is this accurate? I thought the obs "CRF 10" setting was for quite high quality? How can it be so high quality with such a small bitrate?


----------



## Tomasz Góral (Jul 24, 2020)

what preset did you set in ffmpeg?
same as in OBS you need to set in ffmpeg.


----------



## testgcd (Jul 24, 2020)

oh sorry, I was not aware of this.

I've never used ffmpeg before - when i double click the application it doesn't open something asking you to input presets, and the youtube tutorial I watched said you just input the commands directly to cmd, so I just set the folder and pasted the commands that were mentioned in this thread without having changed anything else. I assumed it would scan and match the source vid automatically :)

Is there a quick way of setting all the obs parameters mentioned in the second post of this thread? or do I need to watch hours of tutorials to figure it out?


----------



## koala (Jul 24, 2020)

Sorry I did not set any quality in my post above. I just wanted to develop the timelapse-related options. Ffmpeg uses some internal encoder default if you don't give anything.

If you use crf=10 in OBS and record with a very low fps, the resulting bitrate is not very high, because not many frames are being saved in the original video. That's not true for the timelapsed video, of course, because you condense the frames.
If you want the same quality with the timelapse video (crf=10), you can use this:

`ffmpeg -i input.mkv -filter:v "setpts=PTS/360" -an -r 60 -c:v libx264 -preset slow -crf 10 timelapse.mkv`

The added parameters -c:v libx264 -preset slow -crf 10 order ffmpeg to encode with x264 with the slow preset and crf=10, just as the original recording with OBS.
Ffmpeg is the swiss army knife of video processing, but it is a command line tool.
If you need a *.mp4 file for further processing, just change the output file to timelapse.mp4. Ffmpeg will automatically create an mp4 container instead of a mkv container.


----------

