Closed tomriddle54 closed 4 years ago
@syedmustafa54 Hello, vidgear as of now doesn't support web streaming. It planned to add support for webrtc(that enables web browsers with Real-Time Communications) in upcoming release, see its development in proposal: #50.
For now, Kindly see Aiortc, a library for Web Real-Time Communication (WebRTC) and Object Real-Time Communication (ORTC) in Python.
Thanks for your patience, VidGear just introduced WebGear API, that might help in your application. Kindly install the PR(#98) as follows:
git clone https://github.com/abhiTronix/vidgear.git
cd vidgear
git checkout development
sudo pip3 install .
cd
and install uvicorn as follows:
sudo pip3 install uvicorn
Then run this python code:
#import libs
import uvicorn
from vidgear.gears import WebGear
#various performance tweaks
options = {"frame_size_reduction": 40, "frame_jpeg_quality": 80, "frame_jpeg_optimize": True, "frame_jpeg_progressive": False}
#initialize WebGear app and open stream(for e.g `test.mp4`)
web = WebGear(source = "test.mp4", logging = True, **options)
#run this app on Uvicorn server
uvicorn.run(web(), host='0.0.0.0', port=8000)
#close app safely
web.shutdown()
This will run at address: http://0.0.0.0:8000/ on browser.
Then you can run your javascript code as follows:
var arrayBuffer = msg.data;
var bytes = new Uint8Array(arrayBuffer);
var image = document.getElementById('video');
image.src = 'data:image/jpeg,'+encode(bytes);
};
Try this and revert your results here. Goodluck!
@syedmustafa54 I'm hoping you to test this PR as soon as possible as it will be going to be merged by tomorrow.
@syedmustafa54 I merged this PR and marked this issue as solved as it performed as expected at my end, Kindly share your results when you're ready. Good luck!
Successfully resolved and merged in commit d57f01e
Question
I was trying to use a socket but found this. My question is how can I send this video to web and using javascript and this lib
this is my javascript this is how I receive image using javascript