For the complete documentation index, see llms.txt. This page is also available as Markdown.

RTSP シミュレーター

アップロードした動画ファイルをループする RTSP ソースとしてストリーミングし、カメラなしで推論パイプラインをテストします。

RTSP Simulator は、アップロードした動画ファイルをライブ RTSP ストリームに変換するエッジコンテナサービスです。物理カメラを設置する前にデバイス上で推論パイプラインを構築・テストしたり、既知のクリップを Workflow に対して再生したりするのに使用できます。

アップロードする .mp4 ファイルを Web インターフェースまたは REST API からアップロードするか、Deployment Manager から動画を選択します。サービスはそれを RTSP 互換形式にトランスコードし、停止するまでその結果を連続ループで配信します。

RTSP Simulator は Enterprise 顧客専用でご利用いただけます。 詳細については Roboflow の営業チームにお問い合わせください。 詳細をご確認ください。

接続詳細

置き換えてください <device-ip> を、Deployment Manager のデバイスページに表示される IP アドレスに置き換えます。

用途
アドレス

RTSP ストリーム

rtsp://<device-ip>:8554/stream

Web UI、REST API、Swagger ドキュメント

http://<device-ip>:8080

ポート
プロトコル
用途

8080

HTTP

Web UI、REST API、Swagger ドキュメントは /docs

8554

RTSP (TCP)

映像ストリームの出力。UDP 転送は無効で、UDP を優先するクライアントは TCP インターリーブにダウングレードされます。

複数のクライアントが同時にストリームを読み取ることができます。

動画形式

Web UI、CLI、API は .mp4 ファイルのみを受け付けます。アップロードは自動的にトランスコードされるため、ストリームはどの RTSP クライアントでも動作します:

  • コーデック: H.264、Baseline プロファイル

  • ピクセル形式: yuv420p

  • 音声: 除去、映像のみ

  • 最大ファイルサイズ: デフォルトで 5 GB

Roboflow 動画の使用

デバイスをローカルネットワークから到達できない場合は、Deployment Manager から動画を設定します。デバイスが動画をダウンロードして配信します。

1

設定を開く

デバイスの Configuration タブで、RTSP Simulator カードの「Configure」(歯車アイコン)を選択します。

2

アップロード

「Video source」で「Roboflow video」を選択し、次に「Upload Video」を選択して .mp4 または .mov ファイルを選択します。動画は Workspace の Asset Library に保存されます。

3

保存

必要に応じて変換およびストリーミング設定を変更します。サイトが Secure Gateway 経由で Roboflow に接続する場合は、「Secure Gateway (optional)」にそのアドレスを入力します。「Save Configuration」を選択します。変更はデバイスの再起動後に有効になります。

カードには動画名、RTSP URL、およびダウンロードとストリーム状態が表示されます。Roboflow 動画が設定されている間は、ローカルの Web UI と CLI の操作はロックされます。ローカルアップロードに戻すには、「Local upload」を選択して保存します。

Web インターフェースの使用

開く http://<device-ip>:8080 をブラウザで開きます。

1

アップロード

をドラッグして .mp4 ページ上に配置します。ファイルがアップロードされ、ストリーミング形式に変換されます。

2

再生

「Play」を選択してストリーミングを開始します。動画は無期限にループし、RTSP サーバーに公開されます。

3

接続

推論パイプライン、Deployment Manager のストリーム、または任意の RTSP クライアントを rtsp://<device-ip>:8554/stream.

4

停止

「Stop」を選択してストリームを終了し、変換済みファイルを削除します。

デプロイでシミュレートされたストリームを使うには、カメラと同じようにデバイス上のストリームソースとして追加します。参照: ストリームの追加.

CLI の使用

ヘッドレスまたは SSH のみでアクセスする場合、 rtsp-cli ツールはデバイス上で対話型のターミナルインターフェースを提供します。

Web UI を使わずに動画を取り込むには、まず入力ディレクトリにコピーし、その後 CLI を起動して I.

キー
コマンド
説明

I

取り込み

/data/input/ から動画を選択して変換する /data/input/

P

再生

RTSP ストリーミングを開始

S

停止

ストリーミングを停止して変換済みファイルを削除

D

削除

動画ファイルを削除

C

設定

ストリーム設定を調整(ビットレート、バッファ、遅延)

R

更新

ステータス表示を更新

Q

終了

CLI を終了

ストリームのテスト

任意の RTSP プレーヤーで接続し、ストリームが生きていることを確認します。

このストリームは TCP のみで提供されるため、ffplay に最初に UDP を試させるのではなく、TCP 転送を強制してください。

HTTP API

すべてのエンドポイントは JSON を返します。対話型 Swagger ドキュメントは http://<device-ip>:8080/docsで提供されます。参照: サービス デバイス上サービス API に共通するルールについて。

一般的な流れ

/stop は元のファイルと変換済みファイルの両方も削除してディスク領域を解放するため、次の /play.

アップロード

のみ .mp4 が受け付けられ、アップロード開始前にアクティブなストリームは停止されます。オプションの 設定 部分は、トランスコード時に適用される変換設定の JSON 文字列です。変換済みファイルに組み込まれるため、後から変更するには再アップロードが必要です。

Upload a video file

post

Uploads a video and converts it to the RTSP streaming format. Only .mp4 is accepted. An active stream is stopped before the upload begins.

The optional settings part is a JSON string of conversion settings, applied during transcoding. Because they are baked into the converted file, changing them later requires re-uploading.

本文
filestring · binary必須

Video file to upload. Must be .mp4.

settingsstringオプション

Optional JSON string holding an UploadSettings object. It is a string part rather than a nested object because the service parses it with json.loads before validating, so the UploadSettings schema below documents the shape rather than being referenced here.

Example: {"target_fps": 30, "crf_quality": 23, "max_width": 1920}
レスポンス
200

Upload and conversion succeeded

application/json
successboolean必須
messagestring必須
post/upload
POST /upload HTTP/1.1
Host: device-ip:8080
Content-Type: multipart/form-data
Accept: */*
Content-Length: 93

{
  "file": "binary",
  "settings": "{\"target_fps\": 30, \"crf_quality\": 23, \"max_width\": 1920}"
}
{
  "success": true,
  "message": "Video uploaded successfully",
  "video": {
    "filename": "factory_line.mp4",
    "size": 125000000,
    "size_mb": 119.21,
    "extension": ".mp4"
  }
}

ストリーミング

Start streaming

post

Starts publishing the converted video to the RTSP server, looping until stopped. Uses the current stream settings.

レスポンス
200

Streaming started

application/json
successboolean必須
messagestring必須
rtsp_urlstring必須

RTSP stream URL as the service sees it, always naming localhost, on the port set by RTSP_PORT (8554 by default). Consumers off the device must substitute the device address; read rtsp_port from /info rather than assuming 8554.

post/play
POST /play HTTP/1.1
Host: device-ip:8080
Accept: */*
{
  "success": true,
  "message": "Streaming started",
  "rtsp_url": "rtsp://localhost:8554/stream"
}

Stop streaming and delete video files

post

Stops the stream and deletes both the original and converted files to free disk space. Uploading again is required before the next /play.

レスポンス
200

Streaming stopped and files deleted

application/json
successboolean必須
messagestring必須
post/stop
POST /stop HTTP/1.1
Host: device-ip:8080
Accept: */*
{
  "success": true,
  "message": "text"
}

/delete は、ストリームが実行中でなくても動画ファイルを削除し、実行中の場合はまず停止します。

Delete video files

post

Deletes the original and converted video files, stopping the stream first if it is running. Unlike /stop, this succeeds whether or not a stream is active.

レスポンス
200

Files deleted

application/json
successboolean必須
messagestring必須
post/delete
POST /delete HTTP/1.1
Host: device-ip:8080
Accept: */*
{
  "success": true,
  "message": "text"
}

ステータス

streaming は components.mediamtx.healthy (ストリーミングサーバー)と components.ffmpeg_process.running (トランスコードおよび公開プロセス)が両方とも true のとき true になります。 components.stream のエントリはそれをゲートしません: components.stream.source_ready は起動時に一時的に false になることがありますが、 streaming はすでに true を読み取っていることがあり、それは正常です。内訳は、失敗したストリームを特定する最速の方法です: components を確認して、再起動する前にどの部分に異常があるかを見てください。

Get streaming status

get

Returns whether the stream is live, plus the health of each component, which is the fastest way to localize a failure.

streaming is true when components.mediamtx.healthy and components.ffmpeg_process.running are both true; the components.stream entry does not gate it. components.stream.source_ready can be false briefly during startup, which is normal.

レスポンス
200

Current status

application/json
streamingboolean必須
rtsp_urlstring · ヌル許容オプション

RTSP stream URL as the service sees it, always naming localhost, on the port set by RTSP_PORT (8554 by default). Null when not streaming. Consumers off the device must substitute the device address; read rtsp_port from /info rather than assuming 8554.

get/status
GET /status HTTP/1.1
Host: device-ip:8080
Accept: */*
200

Current status

{
  "streaming": true,
  "rtsp_url": "rtsp://localhost:8554/stream",
  "video": {
    "filename": "sample.mp4",
    "size": 1048576,
    "size_mb": 1,
    "extension": ".mp4"
  },
  "components": {
    "mediamtx": {
      "healthy": true,
      "error": null
    },
    "ffmpeg_process": {
      "exists": true,
      "pid": 1234,
      "running": true,
      "exit_code": null
    },
    "stream": {
      "api_available": true,
      "source_ready": true,
      "readers": 1,
      "error": null
    }
  }
}

/info 空きディスク容量や最大アップロードサイズを含む、サービスが現在実行している制限を報告します。大きなファイルを送る前に確認する価値があります。

Get system information

get

Returns disk space, the upload size limit, accepted extensions, and the RTSP port.

レスポンス
200

System information

application/json
max_file_sizeinteger必須

Maximum upload size in bytes, set by MAX_FILE_SIZE

max_file_size_gbnumber必須
allowed_extensionsstring[]必須

Accepted file extensions. Only .mp4 today.

rtsp_portinteger必須

Port the RTSP stream is served on, set by RTSP_PORT

get/info
GET /info HTTP/1.1
Host: device-ip:8080
Accept: */*
200

System information

{
  "disk_space": {
    "total": 1,
    "used": 1,
    "free": 1,
    "free_gb": 1
  },
  "max_file_size": 1,
  "max_file_size_gb": 1,
  "allowed_extensions": [
    "text"
  ],
  "rtsp_port": 1
}

ストリーム設定エンドポイント

再生設定はアップロード設定とは異なり、ストリーミング時に適用され、再アップロードせずにセッション間で変更できます。更新は次の /playで有効になり、現在実行中のストリームには反映されません。

Get stream settings

get

Returns the current playback settings.

レスポンス
200

Current settings

application/json

Playback settings, changeable between streaming sessions without re-uploading.

max_bitrate_kbpsinteger · 最小: 100 · 最大: 100000オプション

Maximum bitrate in kbps

Default: 5000
buffer_size_kbinteger · 最小: 100 · 最大: 50000オプション

Buffer size in KB

Default: 3000
max_delay_msinteger · 最小: 50 · 最大: 5000オプション

Maximum delay in milliseconds

Default: 500
get/stream-settings
GET /stream-settings HTTP/1.1
Host: device-ip:8080
Accept: */*
200

Current settings

{
  "max_bitrate_kbps": 5000,
  "buffer_size_kb": 3000,
  "max_delay_ms": 500
}

Update stream settings

post

Persists new playback settings. They apply to the next streaming session, not the one currently running.

本文

Playback settings, changeable between streaming sessions without re-uploading.

max_bitrate_kbpsinteger · 最小: 100 · 最大: 100000オプション

Maximum bitrate in kbps

Default: 5000
buffer_size_kbinteger · 最小: 100 · 最大: 50000オプション

Buffer size in KB

Default: 3000
max_delay_msinteger · 最小: 50 · 最大: 5000オプション

Maximum delay in milliseconds

Default: 500
レスポンス
200

Settings saved

application/json
successboolean必須
messagestring必須
post/stream-settings
POST /stream-settings HTTP/1.1
Host: device-ip:8080
Content-Type: application/json
Accept: */*
Content-Length: 66

{
  "max_bitrate_kbps": 5000,
  "buffer_size_kb": 3000,
  "max_delay_ms": 500
}
{
  "success": true,
  "message": "text"
}

設定

環境変数

デバイスの Configuration タブにあるサービスで設定します。参照: デバイス構成を更新.

変数
デフォルト
説明

MAX_FILE_SIZE

5368709120

最大アップロードサイズ(バイト、5 GB)

RTSP_PORT

8554

RTSP サーバーポート

WEB_PORT

8080

Web UI と API のポート

LOG_LEVEL

INFO

ログの詳細度: DEBUG, INFO, WARNING、または ERROR

アップロード設定

これらは変換時に適用されるため、変更するには動画を再アップロードする必要があります。

設定項目
デフォルト
説明

target_fps

元の

ターゲットフレームレート、1~120。元の

crf_quality

23

品質レベル、0~51(18 は高、23 は中、28 は低)

max_width

元の

縮小時の最大幅、320~7680。元の

ストリーム設定

これらは再生時に適用され、CLI の config メニューまたは /stream-settings エンドポイントからストリーミング セッション間で変更できます。

設定項目
デフォルト
説明

max_bitrate_kbps

5000

最大ビットレート(kbps、100~100,000)

buffer_size_kb

3000

バッファサイズ(KB、100~50,000)

max_delay_ms

500

最大遅延(ミリ秒、50~5,000)

最終更新

役に立ちましたか?