Problem with time-lapse

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with time-lapse

Jippo12
  Hi!

I'm trying to automate time-lapse video from still images. I have all sky
camera that captures around 200 images / night. I've managed to do videos
like this
https://drive.google.com/file/d/1yyihZNypBy0r5y_JJiTHgtvc8N1RAZ3e/view?usp=sharing

However what i'm looking for is for smoother video. Is it possible with
ffmpeg?

I've tried to clone every image 30 times etc but still fail to get good
results. I've tried to search ffmpeg man pages and the web but no success.

I use python script to automate the whole process. so below is some option
ive tried

os.system('ffmpeg -i ' + workdir2 + '%d.jpg  -vf '
'"tblend=average,framestep=1,setpts=0.50*PTS,minterpolate"'  + ' -r 30 -b:v
64K -crf 10 -an ' + destinationdir + videofile)
os.system('ffmpeg -r 30 -i ' + workdir2 + '%d.jpg -vcodec mpeg4 -qscale 1
-y -filter:v '" setpts=2.0*PTS"' ' + destinationdir + videofile)

Regards,
Jippo
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem with time-lapse

kumowoon1025
Hi,

> I'm trying to automate time-lapse video from still images. I have all sky
> camera that captures around 200 images / night. I've managed to do videos
> like this
> https://drive.google.com/file/d/1yyihZNypBy0r5y_JJiTHgtvc8N1RAZ3e/view?usp=sharing

Timelapse can be counterintuitive sometimes.

Sometimes you need to slow the framerate down, sometimes you need to raise it.

Sometimes you need less frequent captures (or a step in the middle where you approve/reject the pictures that are going to be your frames), and sometimes, you need to capture at a much higher rate.

> However what i'm looking for is for smoother video. Is it possible with
> ffmpeg?

I think this case it is a matter of not enough captures to make a good timelapse video.

> I've tried to clone every image 30 times etc but still fail to get good
> results. I've tried to search ffmpeg man pages and the web but no success.
Also, maybe interpolating/duplicating frames is actually counterproductive by giving you a less clean starting point? I think the simplest timelapse render looks pretty good, from there maybe you can minterpolate but I'm not sure if the filters before minterpolate help.

https://media.kumowoon1025.com/videos/simple-timelapse-example.mov

> I use python script to automate the whole process. so below is some option
> ive tried
>
> os.system('ffmpeg -i ' + workdir2 + '%d.jpg  -vf '
> '"tblend=average,framestep=1,setpts=0.50*PTS,minterpolate"'  + ' -r 30 -b:v
> 64K -crf 10 -an ' + destinationdir + videofile)
> os.system('ffmpeg -r 30 -i ' + workdir2 + '%d.jpg -vcodec mpeg4 -qscale 1
> -y -filter:v '" setpts=2.0*PTS"' ' + destinationdir + videofile)

This is just a general tip, I can excavate the command from that, but it would be immensely helpful if you put it into a line you can feed into a shell and also attach the output.


Regards,
Ted Park

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem with time-lapse

Jippo12
Hi Ted!

Thanks for your reply and pointing me in the right direction!

Now i use
os.system('ffmpeg -i ' + workdir2 + '%d.jpg -r 120 -vcodec mpeg4 -qscale 1
-y -filter:v '" setpts=0.23*PTS"' ' + destinationdir + videofile)
thats
ffmpeg -i /mnt/ramdisk3g/workdir/%d.jpg -r 120 -vcodec mpeg4 -qsale 1 -y
-filter:v " setpts=0.23*PTS"'' /mnt/ramdisk/mp4/

And the result is this
https://drive.google.com/file/d/1acRm7vWwJAXz1jEU66nuD7Db9mrtPuz-/view?usp=sharing

In workdir i have multiplied every image 6 times with python counter loop
and total number of files are 1374 when there is only 229
Iam pretty happy to results now. Not sure how that minterpolate works but i
will try use that too.

Still images i use are from Raspberry Pi + Meteotux PI program and they are
120s stacked images. You can check more about that from
https://www.meteotuxpi.com

Thanks again!
Jippo



On Wed, 9 Sep 2020 at 00:14, Edward Park <[hidden email]> wrote:

> Hi,
>
> > I'm trying to automate time-lapse video from still images. I have all sky
> > camera that captures around 200 images / night. I've managed to do videos
> > like this
> >
> https://drive.google.com/file/d/1yyihZNypBy0r5y_JJiTHgtvc8N1RAZ3e/view?usp=sharing
>
> Timelapse can be counterintuitive sometimes.
>
> Sometimes you need to slow the framerate down, sometimes you need to raise
> it.
>
> Sometimes you need less frequent captures (or a step in the middle where
> you approve/reject the pictures that are going to be your frames), and
> sometimes, you need to capture at a much higher rate.
>
> > However what i'm looking for is for smoother video. Is it possible with
> > ffmpeg?
>
> I think this case it is a matter of not enough captures to make a good
> timelapse video.
>
> > I've tried to clone every image 30 times etc but still fail to get good
> > results. I've tried to search ffmpeg man pages and the web but no
> success.
> Also, maybe interpolating/duplicating frames is actually counterproductive
> by giving you a less clean starting point? I think the simplest timelapse
> render looks pretty good, from there maybe you can minterpolate but I'm not
> sure if the filters before minterpolate help.
>
> https://media.kumowoon1025.com/videos/simple-timelapse-example.mov
>
> > I use python script to automate the whole process. so below is some
> option
> > ive tried
> >
> > os.system('ffmpeg -i ' + workdir2 + '%d.jpg  -vf '
> > '"tblend=average,framestep=1,setpts=0.50*PTS,minterpolate"'  + ' -r 30
> -b:v
> > 64K -crf 10 -an ' + destinationdir + videofile)
> > os.system('ffmpeg -r 30 -i ' + workdir2 + '%d.jpg -vcodec mpeg4 -qscale 1
> > -y -filter:v '" setpts=2.0*PTS"' ' + destinationdir + videofile)
>
> This is just a general tip, I can excavate the command from that, but it
> would be immensely helpful if you put it into a line you can feed into a
> shell and also attach the output.
>
>
> Regards,
> Ted Park
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem with time-lapse

kumowoon1025
Hi,

> ffmpeg -i /mnt/ramdisk3g/workdir/%d.jpg -r 120 -vcodec mpeg4 -qsale 1 -y
> -filter:v " setpts=0.23*PTS"'' /mnt/ramdisk/mp4/
>
> And the result is this
> https://drive.google.com/file/d/1acRm7vWwJAXz1jEU66nuD7Db9mrtPuz-/view?usp=sharing
>
> In workdir i have multiplied every image 6 times with python counter loop
> and total number of files are 1374 when there is only 229
> Iam pretty happy to results now. Not sure how that minterpolate works but i
> will try use that too.


Glad you got something that works for you, but tbh what I suggested was basically to do nothing, just make a super fast slideshow, essentially.

That example video wasn't even made using FFmpeg, I opened 110 frames from your sample in an image viewer and held down the arrow key to "animate" them, a book-corner doodle flipbook on a computer, if you will.

It's fine as long as it works, but I think you can still eliminate some steps.

For example you said you multiplied each image 6 times, I'm guessing that means you made 6 identical files, so the same frame is on screen 6 times, which makes the video 6× slower.

IIRC, images read in get timestamped as if 25fps by default, but you can change it, instead of actually duplicating the images (-framerate 25/6).

Then the "setpts=0.23*PTS" basically increases the speed by 1/0.23 ≈ 4.3×, around 109fps.

The final framerate is fixed at 120fps with "-r 120" (which I assume is necessary) which duplicates frames to fill 120 from the ~109fps that is available.

I just feel like this is too much stretching and shrinking the "tape" to get an effective 25/6/0.23 fps, or 12.61 seconds if you are adjusting by length. All you need to do is set the rate you want before the input.

https://media.kumowoon1025.com/videos/example/starvideo-deduplication-cf.mp4 <https://media.kumowoon1025.com/videos/example/starvideo-deduplication-cf.mp4>

The "-r" option will duplicate the frames as needed to reach the fps you set. The minterpolate filter will try to improve upon that by interpolating between frames to generate the "in-between" frames to fill in by analyzing the existing ones instead of simply duplicating them. There's not a lot of obvious motion here, so try blend as the mode (I think this may have been what you had in mind with tblend at the start)

https://media.kumowoon1025.com/videos/example/starvideo-minterpolate.mp4 <https://media.kumowoon1025.com/videos/example/starvideo-minterpolate.mp4>

Regards,
Ted Park

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem with time-lapse

Jippo12
Hi!

Yes,  I was confused and didn't realize that ffmpeg can do all this :)
because I first made a python script that creates star trails videos and
they are copied when processing the next step.

But for normal video, i use

ffmpeg -i /mnt/ramdisk3g/workdir/%d.jpg -r 16 -vcodec mpeg4 -qsale 1 -y
-filter:v "framestep=1,setpts=1.0*PTS" /mnt/ramdisk/mp4/

So I left the image multiplying step (from the python side) and Now there
is now only 1 of each image in the workdir. Dropped out tblend because it
makes image blur or something.

https://drive.google.com/file/d/1HfG9WsUtE70DZT62SsqIUeIiZ9ZMwvbR/view?usp=sharing

I'm going to use the above to finish star trails videos later too.

Thanks again Ted!

Regards,

Jippo

On Thu, 10 Sep 2020 at 02:20, Edward Park <[hidden email]> wrote:

> Hi,
>
> > ffmpeg -i /mnt/ramdisk3g/workdir/%d.jpg -r 120 -vcodec mpeg4 -qsale 1 -y
> > -filter:v " setpts=0.23*PTS"'' /mnt/ramdisk/mp4/
> >
> > And the result is this
> >
> https://drive.google.com/file/d/1acRm7vWwJAXz1jEU66nuD7Db9mrtPuz-/view?usp=sharing
> >
> > In workdir i have multiplied every image 6 times with python counter loop
> > and total number of files are 1374 when there is only 229
> > Iam pretty happy to results now. Not sure how that minterpolate works
> but i
> > will try use that too.
>
>
> Glad you got something that works for you, but tbh what I suggested was
> basically to do nothing, just make a super fast slideshow, essentially.
>
> That example video wasn't even made using FFmpeg, I opened 110 frames from
> your sample in an image viewer and held down the arrow key to "animate"
> them, a book-corner doodle flipbook on a computer, if you will.
>
> It's fine as long as it works, but I think you can still eliminate some
> steps.
>
> For example you said you multiplied each image 6 times, I'm guessing that
> means you made 6 identical files, so the same frame is on screen 6 times,
> which makes the video 6× slower.
>
> IIRC, images read in get timestamped as if 25fps by default, but you can
> change it, instead of actually duplicating the images (-framerate 25/6).
>
> Then the "setpts=0.23*PTS" basically increases the speed by 1/0.23 ≈ 4.3×,
> around 109fps.
>
> The final framerate is fixed at 120fps with "-r 120" (which I assume is
> necessary) which duplicates frames to fill 120 from the ~109fps that is
> available.
>
> I just feel like this is too much stretching and shrinking the "tape" to
> get an effective 25/6/0.23 fps, or 12.61 seconds if you are adjusting by
> length. All you need to do is set the rate you want before the input.
>
>
> https://media.kumowoon1025.com/videos/example/starvideo-deduplication-cf.mp4
> <
> https://media.kumowoon1025.com/videos/example/starvideo-deduplication-cf.mp4
> >
>
> The "-r" option will duplicate the frames as needed to reach the fps you
> set. The minterpolate filter will try to improve upon that by interpolating
> between frames to generate the "in-between" frames to fill in by analyzing
> the existing ones instead of simply duplicating them. There's not a lot of
> obvious motion here, so try blend as the mode (I think this may have been
> what you had in mind with tblend at the start)
>
> https://media.kumowoon1025.com/videos/example/starvideo-minterpolate.mp4 <
> https://media.kumowoon1025.com/videos/example/starvideo-minterpolate.mp4>
>
> Regards,
> Ted Park
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> [hidden email] with subject "unsubscribe".
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Problem with time-lapse

Michael Koch
Am 10.09.2020 um 19:10 schrieb Jippo12:

> Hi!
>
> Yes,  I was confused and didn't realize that ffmpeg can do all this :)
> because I first made a python script that creates star trails videos and
> they are copied when processing the next step.
>
> But for normal video, i use
>
> ffmpeg -i /mnt/ramdisk3g/workdir/%d.jpg -r 16 -vcodec mpeg4 -qsale 1 -y
> -filter:v "framestep=1,setpts=1.0*PTS" /mnt/ramdisk/mp4/
>
> So I left the image multiplying step (from the python side) and Now there
> is now only 1 of each image in the workdir. Dropped out tblend because it
> makes image blur or something.
>
> https://drive.google.com/file/d/1HfG9WsUtE70DZT62SsqIUeIiZ9ZMwvbR/view?usp=sharing
>
> I'm going to use the above to finish star trails videos later too.

You can also use the zoompan filter for duplicating the frames and then
the framerate filter for crossfading between successive frames. I've
described that in chapter 2.3 in my book:
http://www.astro-electronic.de/FFmpeg_Book.pdf

Michael

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".