examples: update camera_* with video_*

This commit is contained in:
Aleix Conchillo Flaqué
2025-04-23 13:39:50 -07:00
parent 420912dd4b
commit e79a002e5a
36 changed files with 98 additions and 101 deletions

View File

@@ -43,7 +43,7 @@ async def main():
DailyParams(
audio_out_enabled=True,
audio_in_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
#

View File

@@ -66,7 +66,7 @@ async def main():
DailyParams(
audio_out_enabled=True,
audio_in_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
#

View File

@@ -41,7 +41,7 @@ async def main(room_url: str, token: str):
api_key=daily_api_key,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
),

View File

@@ -243,9 +243,9 @@ async def bot(args: DailySessionArguments):
audio_in_enabled=True,
audio_in_filter=KrispFilter(),
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=576,
video_out_enabled=True,
video_out_width=1024,
video_out_height=576,
vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
turn_analyzer=FalSmartTurnAnalyzer(
api_key=os.getenv("FAL_SMART_TURN_API_KEY"), aiohttp_session=session
@@ -276,9 +276,9 @@ async def local_daily():
params=DailyParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=576,
video_out_enabled=True,
video_out_width=1024,
video_out_height=576,
vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.2)),
turn_analyzer=FalSmartTurnAnalyzer(
api_key=os.getenv("FAL_SMART_TURN_API_KEY"), aiohttp_session=session

View File

@@ -29,9 +29,9 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
transport = SmallWebRTCTransport(
webrtc_connection=webrtc_connection,
params=TransportParams(
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
),
)

View File

@@ -33,9 +33,7 @@ async def main():
transport = TkLocalTransport(
tk_root,
TkTransportParams(
camera_out_enabled=True, camera_out_width=1024, camera_out_height=1024
),
TkTransportParams(video_out_enabled=True, video_out_width=1024, video_out_height=1024),
)
imagegen = FalImageGenService(

View File

@@ -28,9 +28,9 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
transport = SmallWebRTCTransport(
webrtc_connection=webrtc_connection,
params=TransportParams(
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
),
)

View File

@@ -77,9 +77,9 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
webrtc_connection=webrtc_connection,
params=TransportParams(
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
),
)

View File

@@ -153,9 +153,9 @@ async def main():
tk_root,
TkTransportParams(
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
),
)

View File

@@ -75,9 +75,9 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -39,7 +39,6 @@ class MirrorProcessor(FrameProcessor):
)
)
elif isinstance(frame, InputImageRawFrame):
print(f"Received image frame: {frame.size} {frame.format}")
await self.push_frame(
OutputImageRawFrame(image=frame.image, size=frame.size, format=frame.format)
)
@@ -55,11 +54,11 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
camera_out_width=1280,
camera_out_height=720,
video_in_enabled=True,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)

View File

@@ -57,11 +57,11 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
camera_out_width=1280,
camera_out_height=720,
video_in_enabled=True,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)
@@ -72,10 +72,10 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
tk_root,
TkTransportParams(
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
camera_out_width=1280,
camera_out_height=720,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)

View File

@@ -57,7 +57,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -57,7 +57,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -57,7 +57,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -57,7 +57,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -68,7 +68,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True, # Make sure camera input is enabled
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -68,7 +68,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True, # Make sure camera input is enabled
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -70,7 +70,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True, # Make sure camera input is enabled
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -40,10 +40,10 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
webrtc_connection=webrtc_connection,
params=TransportParams(
audio_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
camera_out_width=1280,
camera_out_height=720,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)

View File

@@ -26,10 +26,10 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
webrtc_connection=webrtc_connection,
params=TransportParams(
audio_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
camera_out_width=1280,
camera_out_height=720,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)

View File

@@ -232,7 +232,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=True,
video_in_enabled=True,
vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.8)),
),
)

View File

@@ -33,7 +33,7 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_in_enabled=False,
video_in_enabled=False,
# set stop_secs to something roughly similar to the internal setting
# of the Multimodal Live api, just to align events.
vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.5)),

View File

@@ -34,9 +34,9 @@ async def run_bot(webrtc_connection: SmallWebRTCConnection):
params=TransportParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=512,
camera_out_height=512,
video_out_enabled=True,
video_out_width=512,
video_out_height=512,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -143,9 +143,9 @@ async def main():
DailyParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=576,
video_out_enabled=True,
video_out_width=1024,
video_out_height=576,
transcription_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),

View File

@@ -51,13 +51,13 @@ async def run_bot(webrtc_connection):
pipecat_transport = SmallWebRTCTransport(
webrtc_connection=webrtc_connection,
params=TransportParams(
camera_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_width=1280,
camera_out_height=720,
video_in_enabled=True,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)
@@ -67,13 +67,13 @@ async def run_bot(webrtc_connection):
None,
"SmallWebRTC",
params=DailyParams(
camera_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_width=1280,
camera_out_height=720,
video_in_enabled=True,
video_out_enabled=True,
video_out_is_live=True,
video_out_width=1280,
video_out_height=720,
),
)

View File

@@ -27,10 +27,10 @@ load_dotenv(override=True)
class EdgeDetectionProcessor(FrameProcessor):
def __init__(self, camera_out_width, camera_out_height: int):
def __init__(self, video_out_width, video_out_height: int):
super().__init__()
self._camera_out_width = camera_out_width
self._camera_out_height = camera_out_height
self._video_out_width = video_out_width
self._video_out_height = video_out_height
async def process_frame(self, frame: Frame, direction: FrameDirection):
await super().process_frame(frame, direction)
@@ -45,7 +45,7 @@ class EdgeDetectionProcessor(FrameProcessor):
img = cv2.cvtColor(cv2.Canny(img, 100, 200), cv2.COLOR_GRAY2BGR)
# convert the size if needed
desired_size = (self._camera_out_width, self._camera_out_height)
desired_size = (self._video_out_width, self._video_out_height)
if frame.size != desired_size:
resized_image = cv2.resize(img, desired_size)
frame = OutputImageRawFrame(resized_image.tobytes(), desired_size, frame.format)
@@ -71,13 +71,13 @@ Respond to what the user said in a creative and helpful way. Keep your responses
async def run_bot(webrtc_connection):
transport_params = TransportParams(
camera_in_enabled=True,
camera_out_enabled=True,
camera_out_is_live=True,
audio_in_enabled=True,
audio_out_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
audio_out_10ms_chunks=2,
video_in_enabled=True,
video_out_enabled=True,
video_out_is_live=True,
vad_analyzer=SileroVADAnalyzer(),
)
pipecat_transport = SmallWebRTCTransport(
@@ -111,7 +111,7 @@ async def run_bot(webrtc_connection):
rtvi,
llm, # LLM
EdgeDetectionProcessor(
transport_params.camera_out_width, transport_params.camera_out_height
transport_params.video_out_width, transport_params.video_out_height
), # Sending the video back to the user
pipecat_transport.output(),
context_aggregator.assistant(),

View File

@@ -48,7 +48,7 @@ async def main(room_url: str, token: str, callId: str, sipUri: str):
dialin_settings=None, # Not required for Twilio
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
),

View File

@@ -138,7 +138,7 @@ async def main(
api_key=daily_api_key,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
)
@@ -152,7 +152,7 @@ async def main(
dialin_settings=daily_dialin_settings,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
)

View File

@@ -64,7 +64,7 @@ async def main(
api_key=daily_api_key,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
)
@@ -78,7 +78,7 @@ async def main(
dialin_settings=daily_dialin_settings,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
)

View File

@@ -56,7 +56,7 @@ async def main(
api_key=daily_api_key,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
)

View File

@@ -165,7 +165,7 @@ async def main(
api_key=daily_api_key,
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
),
)

View File

@@ -41,7 +41,7 @@ async def main():
DailyParams(
audio_out_enabled=True,
audio_in_enabled=True,
camera_out_enabled=False,
video_out_enabled=False,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
),

View File

@@ -123,9 +123,9 @@ async def main():
DailyParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=576,
video_out_enabled=True,
video_out_width=1024,
video_out_height=576,
vad_analyzer=SileroVADAnalyzer(params=VADParams(stop_secs=0.5)),
),
)

View File

@@ -124,9 +124,9 @@ async def main():
DailyParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=576,
video_out_enabled=True,
video_out_width=1024,
video_out_height=576,
vad_analyzer=SileroVADAnalyzer(),
transcription_enabled=True,
#

View File

@@ -51,9 +51,9 @@ async def main(room_url, token=None):
DailyParams(
audio_in_enabled=True,
audio_out_enabled=True,
camera_out_enabled=True,
camera_out_width=1024,
camera_out_height=1024,
video_out_enabled=True,
video_out_width=1024,
video_out_height=1024,
transcription_enabled=True,
vad_analyzer=SileroVADAnalyzer(),
),