RTSP 시뮬레이터
카메라 없이 추론 파이프라인을 테스트할 수 있도록 업로드한 비디오 파일을 반복 재생되는 RTSP 소스로 스트리밍합니다.
RTSP Simulator는 업로드한 비디오 파일을 실시간 RTSP 스트림으로 바꾸는 엣지 컨테이너 서비스입니다. 실제 카메라가 설치되기 전에 장치에서 추론 파이프라인을 구축하고 테스트하거나, 워크플로에 대해 알려진 클립을 다시 재생하는 데 사용할 수 있습니다.
업로드합니다 .mp4 파일을 웹 인터페이스나 REST API를 통해 업로드하면, 서비스가 이를 RTSP 호환 형식으로 트랜스코딩하고, 중지할 때까지 결과를 연속 루프로 게시합니다.
연결 정보
다음으로 바꾸세요 <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 인터리브 방식으로 협상합니다.
여러 클라이언트가 동시에 스트림을 읽을 수 있습니다.
비디오 형식
오직 .mp4 파일만 허용됩니다. 업로드는 자동으로 트랜스코딩되어 스트림이 모든 RTSP 클라이언트에서 작동합니다:
코덱: H.264, Baseline 프로파일
픽셀 형식: yuv420p
오디오: 제거됨, 비디오만
최대 파일 크기: 기본값은 5GB
웹 인터페이스 사용
열기 http://<device-ip>:8080 브라우저에서.
배포에서 시뮬레이션 스트림을 사용하려면 카메라를 추가하듯 장치의 스트림 소스로 추가하세요. 참조: 스트림 추가.
CLI 사용
헤드리스 또는 SSH 전용 액세스의 경우, rtsp-cli 도구는 장치에서 대화형 터미널 인터페이스를 제공합니다.
웹 UI 없이 비디오를 가져오려면 먼저 입력 디렉터리에 복사한 다음 CLI를 실행하고 I.
I
가져오기
다음에서 비디오를 선택하여 변환 /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에 공통으로 적용되는 규칙을 확인하세요.
API는 인증되지 않으며, 실행 중인 스트림을 중지하고 업로드된 비디오를 삭제할 수 있습니다. 포트 8080에 도달할 수 있는 모든 대상은 두 작업을 모두 수행할 수 있습니다.
일반적인 흐름
이 rtsp_url 에서 반환되는 /play 및 /status 항상 이름을 지정합니다 localhost, 서비스가 자신의 관점에서 URL을 보고하기 때문입니다. 장치에서 실행되는 소비자만 이를 그대로 사용할 수 있습니다. 그 외의 경우에는 장치 주소로 바꾸세요: rtsp://<device-ip>:8554/stream.
포트는 RTSP_PORT이며, 기본값은 8554 이지만 장치별로 구성할 수 있습니다. 다음에서 읽으세요 rtsp_port 에서 /info 기본값을 가정하지 말고 사용하세요.
/stop 는 디스크 공간을 확보하기 위해 원본 파일과 변환된 파일을 모두 삭제하므로, 다음 /play.
업로드
오직 .mp4 가 허용되며, 업로드가 시작되기 전에 활성 스트림이 중지됩니다. 선택적 설정 부분은 트랜스코딩 중 적용되는 변환 설정의 JSON 문자열입니다. 변환된 파일에 포함되므로 나중에 변경하려면 다시 업로드해야 합니다.
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.
Video file to upload. Must be .mp4.
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.
{"target_fps": 30, "crf_quality": 23, "max_width": 1920}Upload and conversion succeeded
No file selected, unsupported extension, invalid upload settings, or the file is not a readable video
File exceeds MAX_FILE_SIZE (5 GB by default)
Request failed validation
Conversion failed
Not enough free disk space for the 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"
}
}스트리밍
Starts publishing the converted video to the RTSP server, looping until stopped. Uses the current stream settings.
Streaming started
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.
Already streaming, or no video has been uploaded
The stream failed to start
POST /play HTTP/1.1
Host: device-ip:8080
Accept: */*
{
"success": true,
"message": "Streaming started",
"rtsp_url": "rtsp://localhost:8554/stream"
}Stops the stream and deletes both the original and converted files to free disk space. Uploading again is required before the next /play.
Streaming stopped and files deleted
Not currently streaming
Stop failed
POST /stop HTTP/1.1
Host: device-ip:8080
Accept: */*
{
"success": true,
"message": "text"
}/delete 는 스트림이 실행 중일 필요 없이 비디오 파일을 제거하며, 실행 중이라면 먼저 중지합니다.
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.
Files deleted
No video files found to delete
Delete failed
POST /delete HTTP/1.1
Host: device-ip:8080
Accept: */*
{
"success": true,
"message": "text"
}상태
스트리밍 다음 경우 true입니다 components.mediamtx.healthy (스트리밍 서버) 및 components.ffmpeg_process.running (트랜스코드 및 게시 프로세스)가 모두 true일 때입니다. components.stream 항목은 이를 게이트하지 않습니다: components.stream.source_ready 는 시작 중 잠시 false일 수 있으며, 그동안 스트리밍 은 이미 true로 읽히는데, 이는 정상입니다. 분해 정보는 실패한 스트림의 원인을 가장 빠르게 찾는 방법입니다: 다음을 확인하세요 components 무엇이 비정상인지 확인하고, 아무것도 다시 시작하기 전에 살펴보세요.
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.
Current status
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 HTTP/1.1
Host: device-ip:8080
Accept: */*
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 서비스가 실행 중인 제한을 보고하며, 여기에는 남은 디스크 공간과 최대 업로드 크기도 포함됩니다. 큰 파일을 업로드하기 전에 확인할 가치가 있습니다.
Returns disk space, the upload size limit, accepted extensions, and the RTSP port.
System information
Maximum upload size in bytes, set by MAX_FILE_SIZE
Accepted file extensions. Only .mp4 today.
Port the RTSP stream is served on, set by RTSP_PORT
GET /info HTTP/1.1
Host: device-ip:8080
Accept: */*
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, 현재 실행 중인 스트림에는 적용되지 않습니다.
Returns the current playback settings.
Current settings
Playback settings, changeable between streaming sessions without re-uploading.
Maximum bitrate in kbps
5000Buffer size in KB
3000Maximum delay in milliseconds
500GET /stream-settings HTTP/1.1
Host: device-ip:8080
Accept: */*
Current settings
{
"max_bitrate_kbps": 5000,
"buffer_size_kb": 3000,
"max_delay_ms": 500
}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.
Maximum bitrate in kbps
5000Buffer size in KB
3000Maximum delay in milliseconds
500Settings saved
Request failed validation
Failed to persist 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"
}구성
환경 변수
장치의 구성 탭에서 서비스에 이 값을 설정하세요. 참조: 디바이스 구성 업데이트.
MAX_FILE_SIZE
5368709120
바이트 단위 최대 업로드 크기(5GB)
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 구성 메뉴 또는 다음을 통해 스트리밍 세션 사이에 변경할 수 있습니다 /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
마지막 업데이트
도움이 되었나요?