# This command streams a video file to a stream. Streaming ends when the video ends.
vaictl -p PROJECT_ID \
-l LOCATION_ID \
-c application-cluster-0 \
--service-endpoint visionai.googleapis.com \
send video-file to streams STREAM_ID --file-path LOCAL_FILE.EXT
本地视频数据(循环播放):
# This command streams a video file to a stream. Video is looped into the stream until you stop the command.
vaictl -p PROJECT_ID \
-l LOCATION_ID \
-c application-cluster-0 \
--service-endpoint visionai.googleapis.com \
send video-file to streams STREAM_ID --file-path LOCAL_FILE.EXT--loop
实时流式传输协议 (RTSP) 数据流:
# This command will send an RTSP feed into the stream.# This command has to run in the network that has direct access to the RTSP feed.
vaictl-pPROJECT_ID\-lLOCATION_ID\-capplication-cluster-0\--service-endpointvisionai.googleapis.com\
sendrtsptostreamsSTREAM_ID--rtsp-uriRTSP_ADDRESS
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-11。"],[],[],null,["# Create streams and ingest data\n\nThe first step in analyzing your video data with an application is\ncreating a pipeline for the continuous flow of data.\nStreams offers the ability to ingest real-time video data, which then\ncan be used as input for models or stored in a Warehouse.\n\nCreate a Stream\n---------------\n\nTo be able to stream video data you must first create a stream.\n\n\nThe first time you create a stream in a new project it can take some time to create the stream.\nThis time is around 30 minutes. This time is due to the system needing to initialize a\ncomputation cluster for subsequent computations.\n\n\u003cbr /\u003e\n\n### Console\n\nCreate a stream in the Google Cloud console.\n\n1. Open the **Streams** tab of the Vertex AI Vision dashboard.\n\n [Go to the Streams tab](https://console.cloud.google.com/ai/vision-ai/video-streams)\n2. Click add**Register**.\n\n3. Enter the stream name and select a region. You can click **Add Row** to\n register multiple streams at the same time.\n\n4. Click the **Register** button to create one or more streams.\n\nIngest videos\n-------------\n\nAfter you have created a stream you can begin to ingest data using that stream.\n\n\nSome limitations and considerations apply to ingested video:\n\n- The input video source must have the following specifications:\n - [H.264 encoding](https://en.wikipedia.org/wiki/Advanced_Video_Coding)\n - \\\u003c= 1080p resolution\n - \\~25\n\n If the video doesn't meet these specifications Vertex AI Vision may not\n process the input well.\n- Audio is dropped during ingestion.\n- If the stream is part of an app connected to a warehouse, video parameters (such as FPS or resolution) must be the same for the whole stream ; variations in RTSP video data parameters or local video data parameters are not supported.\n- Due to model startup latency, ingested videos may have the first few seconds of content missing. This amount of time can reach up to fifteen seconds.\n- Ingestion termination can happen after long connection (\\~5 hours, on average). There's no reconnection capability from the `vaictl` tool ; users must manually reconnect.\n- While `vaictl` is a useful tool for ingesting video data, the tool does not automatically handle recovery from network errors. These errors may either come from the data-source side or the Cloud-ingestion side. It's the user's responsibility to create a restart script to handle unexpected `vaictl` operation terminations.\n\n\u003cbr /\u003e\n\n### Vertex AI Vision SDK\n\nTo send a request to ingest video data using an existing stream you must\n[install the Vertex AI Vision SDK](/vision-ai/docs/cloud-environment#install_the_streams_sdk).\n\n\n| **Note** : You may need to establish user access credentials by running the following command: `gcloud auth application-default login`. For more information about this command, see the [Vertex AI Vision SDK\n| reference documentation](/sdk/gcloud/reference/auth/application-default/login).\n\n\u003cbr /\u003e\n\nMake the following variable substitutions:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: Your Google Cloud project ID.\n- \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e: Your location ID. For example, `us-central1`. [More information](/about/locations). [Supported regions](/vision-ai/docs/warehouse-supported-regions).\n- \u003cvar translate=\"no\"\u003eLOCAL_FILE.EXT\u003c/var\u003e: The filename of a local video file. For example, `my-video.mp4`.\n- \u003cvar translate=\"no\"\u003eSTREAM_ID\u003c/var\u003e: The stream ID that you created in the cluster For example, `input-1`.\n- \u003cvar translate=\"no\"\u003eRTSP_ADDRESS\u003c/var\u003e: The address of your Real Time Streaming Protocol ([RTSP](https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol)) feed. For example, `rtsp://my-ip-camera`.\n\n**Local video data:** \n\n # This command streams a video file to a stream. Streaming ends when the video ends.\n vaictl -p \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n -l \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e \\\n -c application-cluster-0 \\\n --service-endpoint visionai.googleapis.com \\\n send video-file to streams \u003cvar translate=\"no\"\u003eSTREAM_ID\u003c/var\u003e --file-path \u003cvar translate=\"no\"\u003eLOCAL_FILE.EXT\u003c/var\u003e\n\n**Local video data (looped):** \n\n # This command streams a video file to a stream. Video is looped into the stream until you stop the command.\n vaictl -p \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n -l \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e \\\n -c application-cluster-0 \\\n --service-endpoint visionai.googleapis.com \\\n send video-file to streams \u003cvar translate=\"no\"\u003eSTREAM_ID\u003c/var\u003e --file-path \u003cvar translate=\"no\"\u003eLOCAL_FILE.EXT\u003c/var\u003e --loop\n\n**Real Time Streaming Protocol (RTSP) feed data:** \n\n # This command will send an RTSP feed into the stream.\n # This command has to run in the network that has direct access to the RTSP feed.\n vaictl -p \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e \\\n -l \u003cvar translate=\"no\"\u003eLOCATION_ID\u003c/var\u003e \\\n -c application-cluster-0 \\\n --service-endpoint visionai.googleapis.com \\\n send rtsp to streams \u003cvar translate=\"no\"\u003eSTREAM_ID\u003c/var\u003e --rtsp-uri \u003cvar translate=\"no\"\u003eRTSP_ADDRESS\u003c/var\u003e\n\nPlay ingested videos\n--------------------\n\nAfter you have created a stream and sent video content to the stream you can\nplay the video content.\n\nIf you leave the stream view tab open for more than one hour, you must\nrefresh the page to continue to load video contents. \n\n### Console\n\nPlay ingested video in the Google Cloud console.\n\n1. Open the **Streams** tab of the Vertex AI Vision dashboard.\n\n [Go to the Streams tab](https://console.cloud.google.com/ai/vision-ai/video-streams)\n2. Click on the stream name from the streams list.\n\n3. In the video stream detail page the ingested video live view\n automatically loads."]]