From charlesreid1

Notes

Naming Files

For notes on the quirky hoops you have to jump through to name files properly for Ffmpeg, see Ffmpeg or Timelapse/Processing pages.

Running ffmpeg

Running ffmpeg with "stock" settings for high quality and normal output format (mp4):

$ ffmpeg -i 20160730_%04d.jpg -q:v 1 -vcodec mpeg4 movie1.mp4

This did give me some funny output, showing a frames per second of 56 or 58 (normal should be 26):

$ ffmpeg -i 20160730_%04d.jpg -q:v 1 -vcodec mpeg4 movie1.mp4
[...]
frame= 3670 fps= 58 q=1.0 size=   32379kB time=00:02:26.80 bitrate=1806.9kbits/s speed=2.31x
frame= 4906 fps= 58 q=1.0 size=   42788kB time=00:03:16.24 bitrate=1786.2kbits/s speed=2.32x
frame= 6611 fps= 56 q=1.0 size=   70847kB time=00:04:24.44 bitrate=2194.8kbits/s speed=2.2
frame= 6639 fps= 56 q=1.0 size=   71354kB time=00:04:25.56 bitrate=2201.1kbits/s speed=2.2

This didn't make much sense to me... 56 frames per second?

However, the videos is 5:32, or 332 seconds long, and 332 seconds * 26 frames per second gives 8632 frames. That's much closer to the actual count of photos in the directory. So, the video looks like it is actually 26 fps.

Stock ffmpeg

The "stock" or baseline ffmpeg command I started with was:

$ ffmpeg -i 20160730_%04d.jpg -q:v 1 -vcodec mpeg4 movie1.mp4

This resulted in the movie below:

Raspberry Pi Timelapse: Midnight to Mid-Morning from charlesreid1 on Vimeo.

Slower Framerate/Stop Motion

Next I tried a different frame rate, 15 fps, with the -r 15 flag. This gives it much more of a stop-motion look - I'm not sure how it's filling in all the frames, but it moves at the same rate. In other words, halving the frame rate will not double the length of your video. Frames are simply removed from the original video. (It may be as crude as showing 15 frames, then stopping for 15 frames.)

$ ffmpeg -i 20160730_%04d.jpg -r 15 -q:v 1 -vcodec mpeg4 movie1.mp4

The slower framerate requires a faster capture rate as well - it's great for stop motion, but if people are running across the screen in 4 or 5 frames, you don't get much of a stop motion effect. Much better is to calibrate the frame rate to the height of the camera and the subject matter. A 15th floor camera above a city street can have a slower frame rate due to its wider field of vision and the slower scale of motion from the 15th floor. On the other hand, a 4th floor view of construction workers at a construction site may be closer to the movement, have a narrower range of view, and therefore require a faster frame rate to capture the relative scale of motion.

Proof the timing is exactly the same in both videos: here's a screenshot from both videos of 3:17, when the street lamp is on:

Lamp1.png Lamp2.png
26 fps 15 fps

then of 3:18, when the street lamp turns off:

Lamp3.png Lamp4.png
26 fps 15 fps

Capturing 1 frame every 2 seconds, and setting to 15 fps, almost looked right for stop motion, but everything was too fast by a factor of about 2.

Raspberry Pi Timelapse: Midnight to Mid-Morning (15 fps) from charlesreid1 on Vimeo.


Flags