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

Save to Amazon S3 #6

Closed
karpitsky opened this issue Jan 29, 2014 · 13 comments
Closed

Save to Amazon S3 #6

karpitsky opened this issue Jan 29, 2014 · 13 comments
Labels
enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. wont-fix Beyond the scope of this project or not of interest.

Comments

@karpitsky
Copy link

Hi,

I want to save my final video to Amazon S3 (or other network storage), but with current to_videofile I cannot.

Code from example:

# write the result to a file in any format
final_clip.to_videofile("myHolidays_edited.avi",fps=25, codec='mpeg4')

Can you use buffer instead of filename? Or other suggestions how can I do it.

@Zulko
Copy link
Owner

Zulko commented Jan 29, 2014

I am not familiar with Amazon S3. Could you give (a lot) more details on what you are trying to do ? Like, cannot you write to a file and then upload to Amazon ?

It is an interesting question (writing the output to a buffer), could be useful for web streaming too, but I am not sure how easy it will be, I will see.

@karpitsky
Copy link
Author

For example, I want to store my videos on a remote host

  • with filename I need to save it to a temp file, upload and delete the temp file
  • with buffer I need to upload a buffer.

I use django-storages (Amazon S3: https://github.com/iserko/django-storages/blob/master/storages/backends/s3.py) and with image files I can:

from django.core.files.storage import default_storage as s3_storage

my_file = s3_storage.open(image_file.name, 'rw')  # download a file
img = Image.open(my_file)
img.save(my_file, 'JPEG', quality=80)
my_file.close()  # upload a file

@deplorableword
Copy link

s3cmd is a great library for doing command line saves to s3, perhaps you could pipe the output from moviepy into s3cmd?

@michaelwills
Copy link

There is also the python AWS interface boto.

@hgillh
Copy link

hgillh commented Oct 8, 2015

Hi @Zulko ,
I have similar situation as well.
I want to edit a video (mp4) with Moviepy. Need to add 3 images and edit it's audio as well and Finally I want to show it on a web Page.
So, is there any possibility ?

Also, I have one more question Please.
My video is bit long (8 minutes) and when I call write_videofile method to save edited video. It takes very very long. Can you please suggest me to improve it's performance ?

I shall be thankful

Thanks
Harpreet Gill

@mbeacom
Copy link
Collaborator

mbeacom commented Feb 16, 2017

I think we should keep this functionality out of the package, since it can be easily achieved on your own with boto.
Thoughts? @Zulko @Earney @Gloin1313

ghost pushed a commit that referenced this issue Feb 20, 2017
pull from zulko/moviepy
ghost pushed a commit that referenced this issue Feb 23, 2017
@mbeacom mbeacom added the wont-fix Beyond the scope of this project or not of interest. label Feb 25, 2017
@mbeacom
Copy link
Collaborator

mbeacom commented Feb 25, 2017

Closing this. You can achieve a similar upload to s3 using boto3 s3 (pip install boto3) something like:

from boto3.s3.transfer import S3Transfer
import boto3

... video/audio manipulations via moviepy ...

# Define the S3 client with access and secret keys, if necessary.
client = boto3.client('s3', aws_access_key_id=access_key,aws_secret_access_key=secret_key)
# Define the S3Transfer instance.
transfer = S3Transfer(client)
# Upload the file to S3
transfer.upload_file(final_clip_path, aws_bucket, file_path_in_bucket)

Thank you!

@mbeacom mbeacom closed this as completed Feb 25, 2017
@davidhariri
Copy link

While I think folding in native S3 support is not necessary, it would be good to have examples of how MoviePy works without writing to disk (is that possible)? I want to perform my conversions in the context of the request and in memory before uploading the result to S3 (from memory).

tburrows13 added a commit that referenced this issue Feb 12, 2018
@sandeepbalagopal09
Copy link

Hi @Zulko ,
I have similar situation as well.
I want to edit a video (mp4) with Moviepy. Need to add 3 images and edit it's audio as well and Finally I want to show it on a web Page.
So, is there any possibility ?

Also, I have one more question Please.
My video is bit long (8 minutes) and when I call write_videofile method to save edited video. It takes very very long. Can you please suggest me to improve it's performance ?

I shall be thankful

Thanks
Harpreet Gill

Did you pull this out ? were you able to show video in webpage ?

@parampal290
Copy link

how to directly write video on s3

@parampal290
Copy link

Closing this. You can achieve a similar upload to s3 using boto3 s3 (pip install boto3) something like:

from boto3.s3.transfer import S3Transfer
import boto3

... video/audio manipulations via moviepy ...

# Define the S3 client with access and secret keys, if necessary.
client = boto3.client('s3', aws_access_key_id=access_key,aws_secret_access_key=secret_key)
# Define the S3Transfer instance.
transfer = S3Transfer(client)
# Upload the file to S3
transfer.upload_file(final_clip_path, aws_bucket, file_path_in_bucket)

Thank you!

in this solution
I think you try to tell first write video on website storage and later upload on AWS
any other solution
like directly write on aws s3
or
first, upload video in s3 bucket
after that rewrite video
if you have any idea please tell me

@innayatullah
Copy link

Closing this. You can achieve a similar upload to s3 using boto3 s3 (pip install boto3) something like:

from boto3.s3.transfer import S3Transfer
import boto3

... video/audio manipulations via moviepy ...

# Define the S3 client with access and secret keys, if necessary.
client = boto3.client('s3', aws_access_key_id=access_key,aws_secret_access_key=secret_key)
# Define the S3Transfer instance.
transfer = S3Transfer(client)
# Upload the file to S3
transfer.upload_file(final_clip_path, aws_bucket, file_path_in_bucket)

Thank you!

in this solution
I think you try to tell first write video on website storage and later upload on AWS
any other solution
like directly write on aws s3
or
first, upload video in s3 bucket
after that rewrite video
if you have any idea please tell me

I think direct writing on S3 using multipart upload is a good solution. It will upload quickly and the process will be fast. As of now we are saving the output video on a local file and then that file is uploaded to S3 which takes time (1. video rendering 2. uploading 3. Deleting the video) and then respond to the client.

@AO-AO
Copy link

AO-AO commented May 27, 2022

Same issue. Need a solution to keep the video in memory but not on disk, for saving to disk taking a long time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Positive change that does not change the API, i.e. improved performance, using less memory etc. wont-fix Beyond the scope of this project or not of interest.
Projects
None yet
Development

No branches or pull requests