-
Notifications
You must be signed in to change notification settings - Fork 49
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
Timelapse update #591
Timelapse update #591
Conversation
wtgee
commented
Sep 13, 2018
- Removing ffmpy requirement
- Can overwrite timelapse
- Default timelapse goes into same directory as observation
* Removing ffmpy requirement * Can overwrite timelapse * Default timelapse goes into same directory as observation
@@ -211,6 +216,9 @@ def create_timelapse(directory, fn_out=None, file_type='jpg', **kwargs): | |||
fn_out (str, optional): Full path to output file name, if not provided, | |||
defaults to `directory` basename. | |||
file_type (str, optional): Type of file to search for, default 'jpg'. | |||
overwrite (bool, optional): Overwrite timelapse if exists, default False. | |||
timeout (int): Timeout for making movie, default 60 seconds. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious, how long does this take on the RPi?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I haven't tried. I changed it slightly so on PAN008 the observation directories are moved off the Pi, mostly for storage size issues. I'll try it out tonight when I still have an image sequence on the Pi.
i actually thought it might be better to do this as a Cloud Function that responds the the PubSub notifications when images are uploaded. Then it could just make a movie and post it to youtube.
pocs/utils/images/__init__.py
Outdated
overwrite=False, | ||
timeout=60, | ||
verbose=False, | ||
**kwargs): | ||
"""Create a timelapse | ||
|
||
A timelapse is created from all the jpg images in a given `directory` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jpg is the default type of file, but we allow for others. What other types would ffmpeg support? Probably gif and png. Speaking of which, I've wondered about using png in place of jpg to avoid lossy artifacts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jpgs come directly out of the CR2 without us having to create/convert anything so it's the easiest. Would be open to another solution if practical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated docs to not be jpg specific.
pocs/utils/images/__init__.py
Outdated
if os.path.exists(fn_out) and not overwrite: | ||
raise FileExistsError("Timelapse exists. Set overwrite=True if needed") | ||
|
||
ffmpeg = shutil.which('ffmpeg') | ||
inputs_glob = os.path.join(directory, '*.{}'.format(file_type)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is it that orders the files added to the video? Just the lexical order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ffmpeg is intelligent about ordering them but worth checking on. I usually sort after the glob but here we're just passing the glob.
pocs/utils/images/__init__.py
Outdated
if verbose: | ||
print(outs) | ||
print(errs) | ||
fn_out = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this belongs in the except block above, along with the proc.kill()
. Otherwise fn_out is always None when returning.
* Catch errors in calling function
* Only reset fn_out if file does not exist