python-ffmpeg-video-streaming icon indicating copy to clipboard operation
python-ffmpeg-video-streaming copied to clipboard

Save to s3 not working

Open theolop opened this issue 1 year ago • 0 comments

Describe the bug I want to use python-ffmpeg-streaming to convert a .mov video from an s3 server to an s3 server. While I can get the file from s3 and convert it to my local machine, I can't save it to s3.

To Reproduce

Here is my code :

s3 = S3(aws_access_key_id='xxx', aws_secret_access_key='xxx', region_name='us-east-005', endpoint_url='https://s3.us-east-005.backblazeb2.com')
video = ffmpeg_streaming2.input(s3, bucket_name="my-bucket", key="A001C001.mov")

_480p  = Representation(Size(854, 480), Bitrate(750 * 1024, 192 * 1024))
_720p  = Representation(Size(1280, 720), Bitrate(2048 * 1024, 320 * 1024))
_1080p = Representation(Size(1920, 1080), Bitrate(4096 * 1024, 320 * 1024))

hls = video.hls(Formats.h264())
hls.representations( _480p, _720p, _1080p)

save_to_s3 = CloudManager().add(s3, bucket_name="my-bucket")

hls.output("./outputs/hls.m3u8", clouds=save_to_s3)`

Expected behavior Normally, this would save the hls files on s3 server. It works when I only save to local storage, with the following code.

hls.output("./outputs/hls.m3u8")

Error

ignored in atexit callback: <bound method HLS.finish_up of <ffmpeg_streaming2._media.HLS object at 0x105c4bbf0>> Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/ffmpeg_streaming2/_media.py", line 244, in finish_up super(HLS, self).finish_up() File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/ffmpeg_streaming2/_media.py", line 53, in finish_up self.clouds.transfer('upload_directory', File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/ffmpeg_streaming2/_clouds.py", line 206, in transfer getattr(cloud[0], method)(path, **cloud[1]) File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/ffmpeg_streaming2/_clouds.py", line 59, in upload_directory self.s3.upload_file(join(directory, file), bucket_name, join( File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/boto3/s3/inject.py", line 145, in upload_file return transfer.upload_file( ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/boto3/s3/transfer.py", line 367, in upload_file future = self._manager.upload( ^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/s3transfer/manager.py", line 335, in upload return self._submit_transfer( ^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/s3transfer/manager.py", line 533, in _submit_transfer self._submission_executor.submit( File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/s3transfer/futures.py", line 474, in submit future = ExecutorFuture(self._executor.submit(task)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/concurrent/futures/thread.py", line 172, in submit raise RuntimeError('cannot schedule new futures after ' RuntimeError: cannot schedule new futures after interpreter shutdown

Local machine

  • OS: macOS 13.6.2
  • FFMpeg N-113169-ge1c1dc8347-tessus
  • Python 3.12.1

theolop avatar Jun 08 '24 21:06 theolop