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

Timelapse update #591

Merged
merged 4 commits into from
Sep 15, 2018
Merged

Timelapse update #591

merged 4 commits into from
Sep 15, 2018

Conversation

wtgee
Copy link
Member

@wtgee 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.
Copy link
Contributor

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?

Copy link
Member Author

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 Show resolved Hide resolved
overwrite=False,
timeout=60,
verbose=False,
**kwargs):
"""Create a timelapse

A timelapse is created from all the jpg images in a given `directory`
Copy link
Contributor

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.

Copy link
Member Author

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.

Copy link
Member Author

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.

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))
Copy link
Contributor

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?

Copy link
Member Author

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.

if verbose:
print(outs)
print(errs)
fn_out = None
Copy link
Contributor

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
@wtgee wtgee merged commit aa226be into panoptes:develop Sep 15, 2018
@wtgee wtgee deleted the remove-ffmpy branch September 15, 2018 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants