recv, right?), but how can I do it on the client?
@pc.on("track")handlers, I check if the other one has been initialized. They happen sequentially, so one of them must have both initialized and from there I set up a function that processes them in a loop
Hi, I'm trying to process with OpenCV and python a live video transmission from a WebRTC site: https://webrtc-streamer.herokuapp.com/webrtcstreamer.html?video=Bahia&options=rtptransport%3Dtcp%26timeout%3D60& But I can't open the video with cv2.videocapture (URL).
How could I open the video that is compatible with OpenCV? I appreciate it if you demonstrate the code.
Hi everyone. I know this might not be the correct channel for this, but just in case. Has anyone had experience with accepting multiple webrtc sources, encoding to a single tiled video output and then republishing via RTMP to twitch/youtube/... ?
If i understand the workflow correctly I would first establish a webrtc connection between server and client applications, use ffmpeg (?) to encode to video and then output to rtmp endpoint. In theory seems simple, just checking if anyone has additional knowledge and is willing to share. Especially with ffmpeg I'm not entierly clear how would I arrange tiles or allow server to receive instructions on how to actually tile the video if new participants are added etc...
I hope you are well
I have this issue with audio tracks in which some of the audio frames/packets are missing and not sent to the user or encoder.
More details in GitHub issue:
Any help is appreciated
from av import VideoFrame from aiortc.contrib.media import MediaRecorder from aiortc.mediastreams import AudioStreamTrack, VideoStreamTrack import av import numpy as np import asyncio def run(coro): return asyncio.get_event_loop().run_until_complete(coro) class RTCServer(VideoStreamTrack): def __init__(self,): super().__init__() self.image = np.random.randint( 0, 255, (640, 360, 3), dtype='uint8') async def recv(self): pts, time_base = await self.next_timestamp() image = np.random.randint( 0, 255, (640, 360, 3), dtype='uint8') av_frame = VideoFrame.from_ndarray(image) av_frame.pts = pts av_frame.time_base = time_base return self.frame def terminate(self): try: if not (self.stream is None): self.stream.release() self.stream = None except AttributeError: pass rtc_video = RTCServer() url_youtube = 'rtmp://a.rtmp.youtube.com/live2/' url_youtube += 'SECRETE-KEY' recorder = MediaRecorder(url_youtube, format='flv') recorder.addTrack(rtc_video) recorder.addTrack(AudioStreamTrack()) run(recorder.start()) run(asyncio.sleep(2)) run(recorder.stop())