Closed vm7608 closed 1 month ago
Yes I think so because you can connect to your source using something like open-cv and then yield out the frames
import gradio as gr
from gradio_webrtc import WebRTC
import cv2
def generation():
url = "https://download.tsi.telecom-paristech.fr/gpac/dataset/dash/uhd/mux_sources/hevcds_720p30_2M.mp4"
cap = cv2.VideoCapture(url)
iterating = True
while iterating:
iterating, frame = cap.read()
yield frame
with gr.Blocks() as demo:
gr.HTML(
"""
<h1 style='text-align: center'>
Video Streaming (Powered by WebRTC ⚡️)
</h1>
"""
)
output_video = WebRTC(label="Video Stream", rtc_configuration=rtc_configuration,
mode="receive", modality="video")
button = gr.Button("Start", variant="primary")
output_video.stream(
fn=generation, inputs=None, outputs=[output_video],
trigger=button.click
)
if __name__ == "__main__":
demo.launch()
The above code does not work. I don't think WebRTC has two arguments, mode
and modality
.
Update to the latest version please!
I'm integrating an IP camera feed into my Gradio application using WebRTC. The camera provides an RTSP stream URL. I'd like to know if gradio-webrtc currently supports directly connecting to and streaming from RTSP sources. Thank you so much!