Skip to content
Discussion options

You must be logged in to vote

it's working now, just missing the "boundary=frame"

async def frame_stream(index):
    while CAMERA_MANAGER[index].is_running:
        frame = CAMERA_MANAGER[index].get_frame()
        _, buffer = cv2.imencode(".jpg", frame)
        yield (b'--frame\r\n'
                       b'Content-Type: image/jpeg\r\n\r\n' + buffer.tobytes() + b'\r\n')

# Rota de streaming
@router.get("/video_feed/{index}", responses={200: {"content": {"multipart/x-mixed-replace;boundary=frame": {}}}})
async def video_feed(index: int):
    camera_quant = len(CAMERA_MANAGER)
    if index < 0 or index >= camera_quant or camera_quant == 0:
        raise HTTPException(status_code=404, detail="Camera not found.")
    
    

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by gustavosett
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
1 participant