Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Animated GIF and Video MP4 commands to aid debugging #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions timelapse.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def capture_image():
set_camera_options(camera)

# Capture a picture.
print '\nCapture picture: ' + str(image_number) + '\n'
camera.capture(dir + '/image{0:05d}.jpg'.format(image_number))
camera.close()

Expand All @@ -93,10 +94,12 @@ def capture_image():
# TODO: These may not get called after the end of the threading process...
# Create an animated gif (Requires ImageMagick).
if config['create_gif']:
print '\nCreating animated gif.\n'
os.system('convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif') # noqa
command = 'convert -delay 10 -loop 0 ' + dir + '/image*.jpg ' + dir + '-timelapse.gif' # noqa
print '\nCreating animated gif: ' + command + '\n'
os.system(command)

# Create a video (Requires avconv - which is basically ffmpeg).
if config['create_video']:
print '\nCreating video.\n'
os.system('avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4') # noqa
command = 'avconv -framerate 20 -i ' + dir + '/image%05d.jpg -vf format=yuv420p ' + dir + '/timelapse.mp4' # noqa
print '\nCreating video: ' + command + '\n'
os.system(command)