My code is to add watermark on video and upload that video directly to s3. I am able to do add the watermark on video. Upload that video Directly to s3 need to be done.
import moviepy.editor as mp
import boto3
AWS_ACCESS_KEY_ID="aws_key_id"
AWS_SECRET_ACCESS_KEY="aws_secret_access_key"
s3_resource = boto3.resource("s3")
BUCKET = "bucket_name"
video = mp.VideoFileClip('path_of_ video_file_stored')
logo = (mp.ImageClip('logo_file_stored')
.set_duration(video.duration))
final = mp.CompositeVideoClip([video,logo])
final.subclip(0).write_videofile('localpath/filename.mp4')
Instead of writing to local from final.subclip(0).write_videofile(localpath/filename.mp4) I need to write file directly on s3 instead of first writing on local and then uploading to s3. May I know how to write to s3 directly with code solution of above.