{
  "asyncapi": "3.1.0",
  "id": "urn:waraps.api-video-server",
  "info": {
    "title": "WARA-PS Video Server RTMP API",
    "version": "1.0.4",
    "description": "### Overview\nThe WARA-PS video server receives live video streams and makes those streams available to clients that need to watch an agent camera feed.\n\nThe current video server integration uses RTMP. A publisher sends video to the video server using a stream name.\n\n### Quick Start\nTwo roles share the same stream name -- typically the agent's name: a **publisher** sends RTMP/FLV video to the publish URL (port 1935), and any number of **watchers** connect to the watch URL (port 1936) for that same stream name. See the ffmpeg examples below to try both ends locally.\n\n### RTMP Publish URL\n\n```text\nrtmp://ome.waraps.org:1935/app/{stream_name}\n```\n\nFor agent video, use the agent name as the stream name. Example for `SimUSV1`:\n\n```text\nrtmp://ome.waraps.org:1935/app/SimUSV1\n```\n\n### RTMP Watch URL\n\n```text\nrtmp://ome.waraps.org:1936/app/{stream_name}\n```\n\nExample for `SimUSV1`:\n\n```text\nrtmp://ome.waraps.org:1936/app/SimUSV1\n```\n\n### Publish Video With ffmpeg\nPublish a looping MP4 file:\n\n```bash\nffmpeg -stream_loop -1 -re -i demo.mp4 -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -b:a 128k -pix_fmt yuv420p -f flv \"rtmp://ome.waraps.org:1935/app/SimUSV1\"\n```\n\nPublish a generated test pattern when no camera or video file is available:\n\n```bash\nffmpeg -re -f lavfi -i testsrc=size=1280x720:rate=30 -f lavfi -i sine=frequency=1000:sample_rate=44100 -c:v libx264 -preset veryfast -tune zerolatency -c:a aac -b:a 128k -pix_fmt yuv420p -f flv \"rtmp://ome.waraps.org:1935/app/SimUSV1\"\n```\n\n### Watch Video\nWatch the RTMP stream with ffplay:\n\n```bash\nffplay \"rtmp://ome.waraps.org:1936/app/SimUSV1\"\n```\n\n### Stream Naming\nThe path after `/app/` is the stream name. For agent video, use the same agent name that identifies the agent in WARA-PS.",
    "contact": {
      "name": "waraps.org",
      "url": "https://portal.waraps.org/",
      "email": "info@waraps.org"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    }
  },
  "defaultContentType": "video/x-flv",
  "servers": {
    "publish": {
      "host": "ome.waraps.org:1935",
      "protocol": "rtmp",
      "description": "RTMP video server publish endpoint"
    },
    "watch": {
      "host": "ome.waraps.org:1936",
      "protocol": "rtmp",
      "description": "RTMP video server watch endpoint"
    }
  },
  "channels": {
    "videoStream": {
      "address": "app/{stream_name}",
      "description": "RTMP stream path. Publish to rtmp://ome.waraps.org:1935/app/{stream_name}. Watch from rtmp://ome.waraps.org:1936/app/{stream_name}.",
      "parameters": {
        "stream_name": {
          "$ref": "#/components/parameters/StreamName"
        }
      },
      "messages": {
        "videoStream.message": {
          "$ref": "#/components/messages/VideoStreamMessage"
        }
      }
    }
  },
  "operations": {
    "publishVideo": {
      "action": "send",
      "title": "Publish a video stream to the video server",
      "channel": {
        "$ref": "#/channels/videoStream"
      },
      "summary": "Publish a video stream to the video server",
      "description": "Publish RTMP/FLV video to rtmp://ome.waraps.org:1935/app/{stream_name}.",
      "messages": [
        {
          "$ref": "#/channels/videoStream/messages/videoStream.message"
        }
      ]
    },
    "watchVideo": {
      "action": "receive",
      "title": "Watch a video stream from the video server",
      "channel": {
        "$ref": "#/channels/videoStream"
      },
      "summary": "Watch a video stream from the video server",
      "description": "Watch the RTMP stream with ffplay or another RTMP-capable player using the same stream URL.",
      "messages": [
        {
          "$ref": "#/channels/videoStream/messages/videoStream.message"
        }
      ]
    }
  },
  "components": {
    "parameters": {
      "StreamName": {
        "description": "Stream name used in the RTMP path. For agent video, use the agent name.",
        "examples": [
          "SimUSV1",
          "MiniUAV1"
        ]
      }
    },
    "schemas": {
      "VideoStream": {
        "type": "string",
        "format": "binary",
        "description": "Continuous RTMP/FLV video stream encoded by the publisher."
      }
    },
    "messages": {
      "VideoStreamMessage": {
        "name": "video-stream",
        "title": "Video Stream",
        "description": "Continuous RTMP/FLV stream.",
        "contentType": "video/x-flv",
        "payload": {
          "$ref": "#/components/schemas/VideoStream"
        },
        "examples": [
          {
            "name": "SimUSV1 RTMP publish URL",
            "summary": "Publish SimUSV1 video",
            "payload": "rtmp://ome.waraps.org:1935/app/SimUSV1"
          },
          {
            "name": "SimUSV1 RTMP watch URL",
            "summary": "Watch SimUSV1 video",
            "payload": "rtmp://ome.waraps.org:1936/app/SimUSV1"
          }
        ]
      }
    }
  }
}
