chipturner / rtsp-timelapse-scripts

Some scripts I made for creating a timelapse from an RTSP stream
Apache License 2.0
17 stars 3 forks source link

Help w/ sample argument #1

Open johntdyer opened 3 years ago

johntdyer commented 3 years ago

Can you please provide some clarification on sample parameter in filter-timelapse-frames.py?

$ ./filter-timelapse-frames.py /path/to/pile --sample 10 > /tmp/filelist

I am running the capture command every minute, and have about 50GB of images saved so far...

chipturner commented 3 years ago

Sure. Here's an example:

$ ./filter-timelapse-frames.py --sample 100 /path/to/files > /tmp/files
$ ffmpeg -r 30 -f concat -safe 0 -i <(sed 's/^/file /' /tmp/files) -c:v libx264rgb -preset veryslow -crf 21 -vf fps=30 ~/tmp/pycam1.mp4

The key idea is you have to munge the list of files to make ffmpeg happy (it wants a "script" which basically is a list of the files with file prefixed to each line).

johntdyer commented 3 years ago

yea, but what is the sample argument actually doing ? If I have the capture script running every 5 mins , so does that mean I would want to set sample to 300 ?

chipturner commented 3 years ago

It means "only print every 300th file." You need to decide how long you want your output video to be at the specified fps (30 in the example command I did). This means considering how many total images you have. If you have 10,000 images and use every one, you get a 333 second video. If you only want a 60 second video then you'd use sample of ~6 (10,000 images become ~1,666 images if you only output every 6th, then at 30fps you get a 55s video).