> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-hi/deploy/serverless-video-streaming-api.md).

# Serverless Video Streaming API

### Overview

Serverless Streaming API WebRTC का उपयोग करके वेबकैम, RTSP कैमरों, या वीडियो फ़ाइलों से वीडियो को Roboflow Cloud में स्ट्रीम करता है। आपका [Workflow](https://docs.roboflow.com/workflows/what-is-workflows) प्रत्येक फ्रेम को प्रोसेस करता है और परिणाम वापस आपके एप्लिकेशन में स्ट्रीम करता है।

आप इस API के साथ कोई भी Workflow चला सकते हैं। single model inference के लिए, एक ऐसा Workflow बनाएं जो आपके model को wrap करे।

**समर्थित input sources:**

* **Webcam**: ब्राउज़र या डिवाइस कैमरा MediaStream API के माध्यम से
* **RTSP**: IP कैमरे या कोई भी RTSP-compatible source। URL इंटरनेट से सार्वजनिक रूप से accessible होना चाहिए ताकि cloud function उससे connect कर सके। URL में username/password के माध्यम से authentication समर्थित है (उदा., `rtsp://user:pass@host/stream`).
* **Video Files**: Data Channel के माध्यम से upload किया गया पहले से रिकॉर्ड किया हुआ वीडियो

### यह कैसे काम करता है

जब आप streaming session शुरू करते हैं, SDK WebRTC connection initialize करने के लिए Roboflow's API को call करता है। API एक serverless function spawn करता है जो आपका Workflow चलाता है। एक बार connect होने पर, data दो WebRTC channels के माध्यम से flow करता है:

#### Video Track

वीडियो frames को bidirectionally stream करता है। आप अपने webcam या video file से frames भेजते हैं, और बदले में annotated/processed frames प्राप्त करते हैं। Video Track real-time display के लिए optimized है: यह resolution को adjust करता है और उपलब्ध bandwidth के आधार पर frames drop कर सकता है। connection स्थिर होने पर quality धीरे-धीरे बढ़ती है।

WebRTC congestion control के कारण, quality और FPS को full capacity तक पहुँचने में एक मिनट तक लग सकता है, खासकर 1920×1080 at 30 FPS जैसे उच्च resolutions पर।

#### Data Channel

Structured inference results को JSON messages के रूप में भेजता है। इसमें predictions, coordinates, और classifications जैसे सभी Workflow output data शामिल हैं। Video Track के विपरीत, Data Channel लाइव camera feed के साथ तालमेल बनाए रखने के लिए बिना किसी optimization के reliable, ordered delivery प्रदान करता है। वीडियो फ़ाइलों को process करने के लिए, आप file को Data Channel के माध्यम से upload कर सकते हैं और वीडियो को पूरी तरह process करने के लिए उसी तरह results consume कर सकते हैं।

आप दोनों channels का एक साथ उपयोग कर सकते हैं, उदाहरण के लिए अपने application में structured prediction data को process करते हुए annotated video प्रदर्शित करना।

### Regions और GPU Plans

निर्दिष्ट करें `requested_region` और `requested_plan` अपने configuration में ताकि आप नियंत्रित कर सकें कि आपका stream कहाँ और कैसे process हो।

**Regions:** `us` (United States), `eu` (Europe), `ap` (Asia Pacific)

latency कम करने के लिए अपने users या video source के सबसे नज़दीकी region चुनें।

**GPU Plans:**

* `webrtc-gpu-medium`: अधिकांश workflows के लिए डिफ़ॉल्ट और अनुशंसित
* `webrtc-gpu-small`: कम लागत। यह तब आज़माएँ जब आप पुष्टि कर लें कि Medium आपके use case के लिए अच्छी तरह काम करता है।
* `webrtc-gpu-large`: SAM3 और Rapid Models के लिए आवश्यक जो SAM3 का उपयोग करते हैं (लगभग 5 FPS की अपेक्षा करें)

### Concurrency Limits

वर्तमान में, प्रत्येक workspace की सीमा **10 concurrent streams** तक डिफ़ॉल्ट रूप से सीमित है। यह दुरुपयोग रोकने में मदद करता है और कुल service reliability सुनिश्चित करता है।

यदि आपको अधिक सीमा चाहिए, तो कृपया हमारी sales team से संपर्क करें; हमें आपकी आवश्यकताओं के आधार पर इसे समायोजित करके खुशी होगी।

### Pricing

आपके चुने गए GPU plan के आधार पर प्रति घंटे billed। Billing तब शुरू होती है जब serverless function spawn होता है और WebRTC connection स्थापित हो जाता है। देखें [roboflow.com/credits](https://roboflow.com/credits) वर्तमान दरों के लिए।

### SDKs

#### JavaScript

वेब ब्राउज़र और React Native applications के लिए।

```bash
npm install @roboflow/inference-sdk
```

अपनी API key को frontend code में expose न करें। इसे सुरक्षित रखने के लिए backend proxy endpoint का उपयोग करें।

* [NPM package](https://www.npmjs.com/package/@roboflow/inference-sdk)
* [Sample application](https://github.com/roboflow/inferenceSampleApp)
* [Documentation](https://docs.roboflow.com/deploy/sdks/web-browser/web-inference-sdk)

#### Python

backend applications, RTSP streams, और video file processing के लिए।

```bash
pip install inference-sdk[webrtc]
```

* [PyPI package](https://pypi.org/project/inference-sdk/)
* [Example scripts](https://github.com/roboflow/inference/tree/main/examples/webrtc_sdk) (webcam, RTSP, video file)

### Configuration

Streaming session बनाते समय, एक `StreamConfig` object पास करें ताकि behavior नियंत्रित किया जा सके:

* `stream_output`: Video Track के माध्यम से stream किए जाने वाले Workflow output names की सूची
* `data_output`: Data Channel के माध्यम से भेजे जाने वाले Workflow output names की सूची
* `requested_plan`: GPU plan (ऊपर देखें)
* `requested_region`: Region code (`us`, `eu`, या `ap`)
* `realtime_processing`: यदि `True` (default), जब processing साथ नहीं दे पाती तो frames drop करें
* `workflow_parameters`: Workflow को पास करने के लिए parameters का dictionary

### बिना कोड के परीक्षण

आप Roboflow web interface में सीधे streaming का परीक्षण कर सकते हैं:

1. जाएं [app.roboflow.com](https://app.roboflow.com)
2. खोलें **Workflows** tab
3. एक Workflow चुनें और क्लिक करें **Test Workflow**
4. अपना source चुनें (Webcam, RTSP, या Video File) और GPU/region settings कॉन्फ़िगर करें
5. क्लिक करें **Run**


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/deploy/serverless-video-streaming-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
