2026年3月27日谷歌正式在全球超过200个国家和地区上线Search Live功能搭载Gemini 3.1 Flash Live模型支持用户通过手机摄像头与搜索引擎进行实时、持续的多模态对话。本文面向对多模态AI和实时推理感兴趣的开发者从技术架构角度解析这次全量上线背后的核心能力实现并探讨在实际项目中如何参考类似思路构建实时视觉问答系统。阅读本文你将了解Search Live的技术架构与核心能力边界Gemini 3.1 Flash Live与前代模型的关键改进点实时视觉多模态问答系统的典型技术路径可参考的代码示例与接口调用方式一、Search Live是什么1.1 功能定义Search Live是Google Search的AI功能扩展运行在Google App的AI Mode内。用户激活后可持续开启摄像头以语音和画面内容为输入与AI进行多轮对话无需手动输入关键词。和传统图像识别的区别在于图像识别一次性给一张图得到一个结果Search Live持续对话摄像头画面是动态的问题可以延伸追问1.2 底层模型Search Live底层运行的是Gemini 3.1 Flash Live模型这是谷歌Gemini系列专为实时流媒体交互场景优化的变体关键特性包括指标Gemini 3.1 Flash Live前代表现响应延迟进一步压低官方未公布具体msFlash 2.0约500ms语言支持90约70视频流输入✅ 支持实时摄像头帧部分支持多轮对话✅ 完整上下文保留有限二、实时多模态问答的技术架构2.1 整体架构实现类似Search Live的实时视觉对话功能技术链路大致如下摄像头帧 → 帧采样 → 视觉编码器 → 多模态融合 → LLM推理 → 流式语音输出 ↓ ↑ 语音输入 → ASR语音转文字 ───────────────┘核心挑战有三个低延迟帧处理需要在不影响用户体验的前提下稳定采样视频帧多模态上下文管理视觉信息语音信息历史对话需要统一管理流式响应边推理边输出不能等全部生成完再说话2.2 帧采样策略实时摄像头输入是连续视频流不可能每帧都送进模型。通常的做法是关键帧采样python复制import cv2 import time class FrameSampler: def __init__(self, fps2): fps: 每秒采样帧数实时对话场景通常1-3fps足够 self.fps fps self.last_sample_time 0 self.frame_buffer [] def should_sample(self) - bool: current_time time.time() if current_time - self.last_sample_time 1.0 / self.fps: self.last_sample_time current_time return True return False def add_frame(self, frame): if self.should_sample(): # 降采样到合适分辨率减少token消耗 resized cv2.resize(frame, (512, 512)) self.frame_buffer.append(resized) # 保留最近N帧避免上下文过长 if len(self.frame_buffer) 5: self.frame_buffer.pop(0) def get_latest_frames(self): return self.frame_buffer.copy()2.3 调用 Gemini Live API谷歌提供了Gemini Live API支持实时视频流输入。以下是基础调用示例python复制import asyncio import base64 import cv2 from google import genai from google.genai import types client genai.Client(api_keyYOUR_API_KEY) MODEL gemini-3.1-flash-live async def video_chat_session(): config { response_modalities: [AUDIO], # 输出语音 system_instruction: 你是一个视觉助手根据用户摄像头画面实时回答问题。回答简洁不超过两句话。 } async with client.aio.live.connect(modelMODEL, configconfig) as session: cap cv2.VideoCapture(0) sampler FrameSampler(fps1) print(摄像头已开启开始对话...) async def send_frames(): while True: ret, frame cap.read() if not ret: break sampler.add_frame(frame) frames sampler.get_latest_frames() if frames: # 将最新帧编码为base64 _, buffer cv2.imencode(.jpg, frames[-1], [cv2.IMWRITE_JPEG_QUALITY, 80]) img_b64 base64.b64encode(buffer).decode() # 发送图像帧 await session.send(input{ inline_data: { mime_type: image/jpeg, data: img_b64 } }) await asyncio.sleep(1.0) # 1fps async def receive_responses(): async for response in session.receive(): if response.server_content: if response.server_content.model_turn: for part in response.server_content.model_turn.parts: if part.text: print(fAI: {part.text}) # 并发发送帧和接收响应 await asyncio.gather( send_frames(), receive_responses() ) cap.release() # 运行 asyncio.run(video_chat_session())2.4 语音输入集成实际使用中用户是通过语音提问的。需要在帧发送的同时接入ASR流式识别python复制import pyaudio import numpy as np class AudioCapture: def __init__(self, sample_rate16000, chunk_size1024): self.sample_rate sample_rate self.chunk_size chunk_size self.audio pyaudio.PyAudio() def get_audio_stream(self): return self.audio.open( formatpyaudio.paInt16, channels1, rateself.sample_rate, inputTrue, frames_per_bufferself.chunk_size ) def read_chunk(self, stream) - bytes: 读取一个音频块并转为base64 data stream.read(self.chunk_size, exception_on_overflowFalse) return data async def send_audio_and_video(session, audio_capture, frame_sampler): 同时发送音频流和视频帧 Gemini Live API 支持在同一个 session 中混合发送 stream audio_capture.get_audio_stream() while True: # 发送音频块 audio_chunk audio_capture.read_chunk(stream) await session.send(input{ realtime_input: { media_chunks: [{ mime_type: audio/pcm, data: base64.b64encode(audio_chunk).decode() }] } }) # 同时检查是否有新帧需要发送 frames frame_sampler.get_latest_frames() if frames: _, buffer cv2.imencode(.jpg, frames[-1]) await session.send(input{ inline_data: { mime_type: image/jpeg, data: base64.b64encode(buffer).decode() } }) await asyncio.sleep(0.064) # 约15fps音频采样三、性能优化与工程注意点3.1 延迟优化实时对话的核心体验指标是端到端延迟几个常见优化点1. 减少图像分辨率python复制# 不要直接发原始分辨率先降采样 def preprocess_frame(frame, target_size(512, 512)): h, w frame.shape[:2] # 保持宽高比的短边对齐 scale min(target_size[0]/h, target_size[1]/w) new_h, new_w int(h*scale), int(w*scale) resized cv2.resize(frame, (new_w, new_h)) return resized2. 流式输出不等全量Gemini Live API本身支持流式输出确保在接收端也用流式处理不要缓存后统一播放。3. 合理控制上下文长度多轮对话中历史帧不要无限累积通常保留最近3-5帧画面上下文已经足够。3.2 常见问题Q摄像头帧发送过快导致报错这通常是API请求频率限制的问题。Gemini Flash Live有请求频率限制建议采样率控制在1-2fps。python复制# 加个简单的限流 import asyncio class RateLimiter: def __init__(self, max_per_second2): self.min_interval 1.0 / max_per_second self.last_call 0 async def wait(self): now asyncio.get_event_loop().time() elapsed now - self.last_call if elapsed self.min_interval: await asyncio.sleep(self.min_interval - elapsed) self.last_call asyncio.get_event_loop().time()Q如何处理弱网环境下的掉帧建议在客户端加帧队列网络恢复时优先发最新帧丢弃堆积的旧帧。四、Search Live的技术意义从技术演进角度看Search Live代表了几个方向的收敛端到端多模态不再是先识图再搜索再回答的串行管道而是视觉理解和语言推理在同一模型内完成实时性优先Flash系列模型的定位明确以延迟换精度适配交互场景持续会话Live API的核心价值是保持对话连续性而非单次请求响应对国内开发者来说类似的能力可以通过以下路径复现国内通义千问-VL / 混元Vision WebSocket流式接口国际Gemini Live API需要Google Cloud账号五、总结维度Search Live底层模型Gemini 3.1 Flash Live交互方式摄像头语音实时持续对话语言支持90覆盖范围200国家和地区核心技术实时视频流多模态推理 流式响应这次全量上线的技术挑战不在于模型能力本身而在于如何在全球范围内稳定支撑大规模并发的实时流媒体推理这是个工程问题不是算法问题。