Comments (8)
Ok I will try to find a solution for this feature request.
from python-ffmpeg-video-streaming.
Thank you so much @aminyazdanpanah
from python-ffmpeg-video-streaming.
@hiteshgarg14 you're welcome
Unfortunately, I do not have access to an AWS account. Please test the following code and if you get any error, post it here.
import sys
import ffmpeg_streaming
from ffmpeg_streaming import S3, CloudManager, Formats
def monitor(ffmpeg, duration, time_):
per = round(time_ / duration * 100)
sys.stdout.write("\rTranscoding...(%s%%) [%s%s]" % (per, '#' * per, '-' * (100 - per)))
sys.stdout.flush()
s3 = S3(aws_access_key_id='YOUR_KEY_ID', aws_secret_access_key='YOUR_KEY_SECRET', region_name='YOUR_REGION')
video = ffmpeg_streaming.input(s3, bucket_name="bucket-name", key="folder1/folder2/../video.mp4")
# you can also open a file from a local path
# video = ffmpeg_streaming.input("/var/media/video.mp4")
hls = video.hls(Formats.h264())
hls.auto_generate_representations()
save_to_s3 = CloudManager(filename="hls_stream.m3u8").add(s3, bucket_name="bucket-name", folder="folder1/folder2/...")
hls.output(clouds=save_to_s3, monitor=monitor)
# you can also pass a local path to save a copy of files to your server
from python-ffmpeg-video-streaming.
I just have released a new version of the package and now you can update the package.
pip install --upgrade python-ffmpeg-video-streaming
For now, you can only set this value for an AWS cloud.
from python-ffmpeg-video-streaming.
Hi @aminyazdanpanah, I uninstalled the previous version and installed python-ffmpeg-video-streaming-0.1.3
and tried running below code
import sys
import ffmpeg_streaming
from ffmpeg_streaming import S3, CloudManager, Formats
def monitor(ffmpeg, duration, time_):
per = round(time_ / duration * 100)
sys.stdout.write("\rTranscoding...(%s%%) [%s%s]" % (per, '#' * per, '-' * (100 - per)))
sys.stdout.flush()
s3 = S3(aws_access_key_id='XXXXX',
aws_secret_access_key='XXXXX', region_name='ap-south-1')
video = ffmpeg_streaming.input(s3, bucket_name="staging", key="videos/etvideo.mp4")
# you can also open a file from a local path
# video = ffmpeg_streaming.input("/var/media/video.mp4")
hls = video.hls(Formats.h264())
hls.auto_generate_representations()
save_to_s3 = CloudManager(filename="hls_stream.m3u8").add(s3, bucket_name="staging", folder="videos/converted/")
hls.output(clouds=save_to_s3, monitor=monitor)
And it is giving below error
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/v5/9155pbg92g5bpkhtylq7zyd40000gn/T/tmpt7w7bxso_videos/etvideo.mp4_py_ff_vi_st.tmp'
Probably, the problem is a slash at videos/etvideo
from python-ffmpeg-video-streaming.
Could you post the line number of the error code and in which file did you get this error(e.x. File ".../clouds.py", line 6)?
from python-ffmpeg-video-streaming.
Hi @aminyazdanpanah, Please find below full traceback:
Traceback (most recent call last):
File "video_streaming.py", line 73, in <module>
video = ffmpeg_streaming.input(s3, bucket_name="staging", key="videos/etvideo.mp4")
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_input.py", line 116, in input
return Media(InputOption(_input, **options))
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_media.py", line 185, in __init__
options = dict(input_opts)
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_input.py", line 86, in __iter__
yield from self._create().items()
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_input.py", line 93, in _create
options.update(get_from_cloud(self.input_, self.options))
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_input.py", line 69, in get_from_cloud
'i': cloud.download(save_to, **options),
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/site-packages/ffmpeg_streaming/_clouds.py", line 74, in download
filename = tempfile.NamedTemporaryFile(suffix='_' + key + '_py_ff_vi_st.tmp', delete=False)
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/tempfile.py", line 541, in NamedTemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
File "/Users/hiteshgarg14/Workspace/venv/lib/python3.8/tempfile.py", line 250, in _mkstemp_inner
fd = _os.open(file, flags, 0o600)
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/v5/9155pbg92g5bpkhtylq7zyd40000gn/T/tmptpdnlbtj_videos/etvideo.mp4_py_ff_vi_st.tmp'
from python-ffmpeg-video-streaming.
I fixed this problem in 6ab7aeb.
Please update the package and try it again.
from python-ffmpeg-video-streaming.
Related Issues (20)
- Issue in uploading video to GCP bucket iteratively, contents of previous iteration are uploaded HOT 1
- Example is not working HOT 2
- Encoding with AV1? HOT 1
- set limit output size HOT 1
- Output frame rate HOT 1
- how to make multiple representations for HLS stream while capturing webcam HOT 1
- Wrong aspect ratio when playing the resulting m3u8 file HOT 1
- Can we use this library to access windows webcam and save as image ? HOT 1
- rtsp_transport with TCP HOT 1
- Create a socket connection and show a progress bar(or other parameters) to your users HOT 1
- Integration with django HOT 1
- file saving in cloud HOT 2
- FileNotFoundError: [Errno 2] No such file or directory: 'ffmpeg': 'ffmpeg' HOT 1
- Clean Interrupt
- Save to s3 not working HOT 1
- Azure Cloud Storage throws ImportError for BlockBlobService HOT 1
- WebVTT subtitles not referenced.
- rtsp to file mp4 not work
- Produce arbitrary HLS fragment files from .mp4 from an entry recorded in .m3u8 file HOT 2
- Typo in codec filter name for H.264
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from python-ffmpeg-video-streaming.