目次

Amazon Kinesis Video Streams v2.0 完全ガイド 2026

概要

Amazon Kinesis Video Streams(以下 KVS)は、IoT カメラ・監視カメラ・スマートホーム・ドライブレコーダー・ロボット・ドローンなどのビデオデバイスから、リアルタイムに映像ストリームをクラウドに安全に取り込み、保存・再生・分析するための AWS 完全マネージドビデオストリーミングサービスです。Producer SDK(C/C++/Java/Android/iOS)で低遅延ビデオ送信、WebRTC による双方向リアルタイム通信、HLS/DASH による標準プレーヤー再生、Rekognition Video による顔認識・物体検出、カスタム ML モデル(SageMaker)による分析、KVS Edge Agent によるエッジ処理を統合的に実現します。最大 10 年のビデオ保存とタイムスタンプベース検索により、セキュリティ監視・品質管理・機械学習トレーニングデータ生成など幅広い用途に対応します。

課題解決

  • 複数カメラ映像の一元管理 - 監視カメラ数百~数千台の映像を中央クラウドで統合管理
  • 自動映像分析パイプライン - Rekognition Video で顔認識・人物検出・行動分析を自動実行
  • エッジ・クラウド分散処理 - KVS Edge Agent でオンプレ前処理、クラウドで本処理
  • リアルタイム双方向通信 - WebRTC で低レイテンシー(<500ms) な双方向ビデオ通話
  • 長期保存と効率的検索 - 最大 10 年保存、タイムスタンプで特定時間帯の映像快速検索

アーキテクチャ図

graph TB
    subgraph Producers["ビデオプロデューサー"]
        Camera["監視カメラ<br/>IP Camera / RTSP"]
        Mobile["モバイル<br/>iOS/Android"]
        Robot["ロボット<br/>自動運転"]
        Drone["ドローン"]
        EdgeDevice["Edge Device<br/>Raspberry Pi"]
    end
    
    subgraph KVSIngestion["KVS インジェスト層"]
        SDK["Producer SDK<br/>C++/Java/Android/iOS"]
        RTSP["RTSP サポート"]
        EdgeAgent["KVS Edge Agent<br/>Greengrass/Snowball"]
    end
    
    subgraph KVSStorage["KVS ストレージ・再生"]
        Store["ビデオストレージ<br/>最大 10 年"]
        HLS["HLS Streaming<br/>ブラウザ再生"]
        DASH["DASH / MPEG-TS"]
    end
    
    subgraph Analysis["分析・処理層"]
        Rekognition["Rekognition Video<br/>顔認識・物体検出"]
        Custom["Custom ML<br/>SageMaker"]
        Lambda["Lambda<br/>カスタム処理"]
    end
    
    subgraph Outputs["出力・アクション"]
        WebRTC["WebRTC<br/>双方向通話"]
        Alert["アラート通知"]
        Dashboard["リアルタイムダッシュボード"]
        S3["S3<br/>ビデオアーカイブ"]
    end
    
    Producers -->|Producer SDK<br/>RTSP| KVSIngestion
    KVSIngestion --> KVSStorage
    KVSStorage --> Analysis
    KVSStorage --> Outputs
    Analysis --> Outputs
    
    style KVSStorage fill:#FF9900,color:#fff
    style Analysis fill:#FFA500

コアコンポーネント

1. ビデオプロデューサー SDK

対応言語・プラットフォーム:
  ・C++ (デスクトップ・組み込み)
  ・Java (JVM 系アプリ)
  ・Android (モバイル)
  ・iOS (モバイル)
  ・Python (ラッパー)

主機能:
  - TLS 暗号化ストリーミング
  - ローカルバッファリング(ネットワーク切断時)
  - 自動再接続
  - フレームレート制御
  - 解像度・ビットレート適応

例: Android カメラ
import com.amazonaws.kinesisvideo.client.KinesisVideoClient;
import com.amazonaws.kinesisvideo.producer.StreamInfo;

public class CameraActivity {
    private KinesisVideoClient client;
    
    public void startStreaming() {
        client = KinesisVideoClient.builder()
            .region("ap-northeast-1")
            .credentials(credentialsProvider)
            .build();
        
        StreamInfo streamInfo = new StreamInfo.Builder()
            .name("security-camera-01")
            .dataFormat(StreamDataFormat.H264)
            .mediaStreamType(MediaStreamType.VIDEO)
            .build();
        
        client.createStream(streamInfo);
        
        KinesisVideoMediaSourceConfiguration config = 
            new KinesisVideoMediaSourceConfiguration.Builder()
                .mediaSource(cameraPreview)
                .build();
        
        client.startStreamingSession(config);
    }
}

2. ビデオストレージ・再生

保持期間: 0 時間~10 年(設定可能)

再生フォーマット:
  - HLS(HTTP Live Streaming)
    → Web ブラウザ・モバイルプレーヤー対応
    → 動的ビットレート適応
  
  - DASH(Dynamic Adaptive Streaming over HTTP)
    → YouTube・Netflix 採用フォーマット
  
  - MPEG-TS(MPEG-2 Transport Stream)
    → レイテンシー < 200ms(ライブ向け)

タイムスタンプベース検索:
  GetClip API
  - 特定時間帯の映像を MP4 として抽出
  - 例: 2026-04-27 10:00:00 ~ 10:15:00 の映像

例: Python で映像抽出
import boto3
from datetime import datetime, timedelta

kvs = boto3.client('kinesisvideo', region_name='ap-northeast-1')

# Stream Name から ARN 取得
stream_response = kvs.describe_stream(StreamName='security-camera-01')
stream_arn = stream_response['StreamInfo']['StreamARN']

# タイムスタンプベース検索
start_time = datetime(2026, 4, 27, 10, 0, 0)
end_time = datetime(2026, 4, 27, 10, 15, 0)

clip_response = kvs.get_clip(
    StreamARN=stream_arn,
    ClipFragmentSelector={
        'FragmentSelectorType': 'SERVER_TIMESTAMP',
        'TimestampRange': {
            'StartTimestamp': start_time,
            'EndTimestamp': end_time
        }
    }
)

# MP4 ファイルとして保存
with open('extracted_clip.mp4', 'wb') as f:
    f.write(clip_response['Payload'].read())

3. Rekognition Video 統合

ストリーム分析フロー:
  KVS ストリーム
    ↓ Rekognition StartStreamProcessor
    ↓ フレーム単位で分析
    ↓ Kinesis Data Streams に検出結果出力
    ↓ Lambda / CloudWatch で処理・アラート

検出能力:
  - 顔認識(顔 ID、年齢、性別、感情)
  - 人物トラッキング(フレーム間追跡)
  - 物体検出(人・犬・猫・車・自転車)
  - シーンテキスト検出(看板・標識)
  - 保護具検出(ヘルメット・マスク・ベスト)
  - 転倒検知(医療施設向け)

例: Python で Stream Processor 起動
import boto3
from datetime import datetime

rekognition = boto3.client('rekognition', region_name='ap-northeast-1')

# 顔認識 Stream Processor 起動
processor_response = rekognition.create_stream_processor(
    Input={
        'KinesisVideoStream': {
            'Arn': 'arn:aws:kinesisvideo:ap-northeast-1:123456789012:stream/security-camera-01/...'
        }
    },
    Output={
        'KinesisDataStream': {
            'Arn': 'arn:aws:kinesis:ap-northeast-1:123456789012:stream/face-detection-results'
        }
    },
    RoleArn='arn:aws:iam::123456789012:role/RekognitionRole',
    StreamProcessorSettings={
        'FaceSearch': {
            'CollectionId': 'security-faces',
            'FaceMatchThreshold': 0.95
        }
    },
    Name='security-camera-01-face-processor',
    Tags={
        'Environment': 'Production',
        'Application': 'SecurityMonitoring'
    }
)

# Stream Processor 起動
rekognition.start_stream_processor(
    Name='security-camera-01-face-processor'
)

print(f"Processor started: {processor_response['StreamProcessorArn']}")

4. WebRTC(双方向通信)

用途:
  - ドアベルカメラ ↔ スマートフォン(音声双方向)
  - リモートロボット操作(音声 + 制御コマンド)
  - 遠隔医療・遠隔監視

特徴:
  - レイテンシー: < 500ms(通常 200-300ms)
  - シグナリング: AWS マネージド(STUN/TURN)
  - ICE Candidate 自動生成
  - エンドツーエンド暗号化

例: Python で Signaling Channel 作成
import boto3

kvs = boto3.client('kinesisvideo', region_name='ap-northeast-1')

# Signaling Channel 作成(WebRTC 用)
channel_response = kvs.create_signaling_channel(
    ChannelName='doorbell-camera-01',
    ChannelType='SINGLE_MASTER',
    Tags={
        'Device': 'DoorBellCamera',
        'Location': 'FrontDoor'
    }
)

channel_arn = channel_response['ChannelARN']
print(f"Signaling Channel: {channel_arn}")

# ICE Servers 取得(STUN/TURN)
ice_response = kvs.get_signaling_channel_endpoint(
    ChannelARN=channel_arn,
    SingleMasterChannelEndpointConfiguration={
        'Role': 'MASTER'
    }
)

ice_servers = ice_response['ResourceEndpointList'][0]['ResourceEndpoint']
print(f"ICE Servers: {ice_servers}")

5. KVS Edge Agent(エッジ処理)

デプロイ方式:
  1. AWS Greengrass コンポーネント
  2. Docker コンテナ(Raspberry Pi など)
  3. AWS Snowball Edge
  4. 組み込みデバイス

機能:
  - ローカルビデオキャプチャ
  - エッジで軽量処理(フィルタリング・圧縮)
  - インターネット接続障害時もローカルに保存
  - 回線復旧後に自動同期

例: Greengrass 上での KVS Edge Agent
# AWS Greengrass deployment manifest
components:
  - name: kinesis-video-stream-agent
    version: 1.0.0
    publish:
      region: ap-northeast-1
    artifacts:
      - uri: s3://my-bucket/kvs-edge-agent.jar
    configuration:
      VideoCapturePath: /dev/video0
      StreamName: edge-camera-01
      LocalStoragePath: /var/kvs-storage
      MaxLocalStorageSize: 50GB
      ResolutionWidth: 1280
      ResolutionHeight: 720
      FramesPerSecond: 30
      EncodingBitRate: 2500000
      LocalRetentionPeriodInHours: 24

主要ユースケース

  1. 工場監視・安全管理 - 200 台の監視カメラ → Rekognition(安全装備着用チェック)→ アラート
  2. スマートホーム - 玄関カメラ → Rekognition(顔認識)→ スマートフォン通知・ドア解錠
  3. 医療施設 - 患者モニタリングカメラ → 転倒検知 → ナースコール自動発動
  4. 交通監視 - 信号カメラ → 物体検出(違反車両)→ 自動チケット発行
  5. 自動運転開発 - ドライブレコーダー → ML トレーニングデータ生成 → SageMaker
  6. リアルタイムスポーツ分析 - スタジアムカメラ → Rekognition(選手トラッキング)→ 統計分析
  7. リモート操作ロボット - ロボットカメラ → WebRTC → オペレータ遠隔操作
  8. 建設現場安全管理 - ドローンカメラ → 進捗管理・安全チェック
  9. 牧場・農業監視 - 牛カメラ → カスタム ML(健康状態検知)
  10. 駐車場管理 - 駐車カメラ → ナンバープレート認識 → 料金自動計算
  11. 図書館蔵書検出 - 本棚カメラ → 物体検出(配置確認)
  12. ライブストリーミング配信 - イベントカメラ → HLS → YouTube
  13. 法執行・刑事捜査 - 防犯カメラ → Rekognition(容疑者特定) → 捜査支援
  14. ペット監視 - ペット用カメラ → 異常行動検知 → 獣医師アラート

設定・操作の具体例

CLI: ストリーム作成・再生

# KVS ストリーム作成
aws kinesisvideo create-stream \
  --stream-name security-camera-01 \
  --data-retention-in-hours 24 \
  --region ap-northeast-1

# ストリーム情報確認
aws kinesisvideo describe-stream \
  --stream-name security-camera-01 \
  --region ap-northeast-1

# HLS 再生 URL 取得
STREAM_ARN=$(aws kinesisvideo describe-stream \
  --stream-name security-camera-01 \
  --query 'StreamInfo.StreamARN' \
  --output text \
  --region ap-northeast-1)

aws kinesisvideo get-hls-streaming-session-url \
  --stream-arn $STREAM_ARN \
  --playback-mode ON_DEMAND \
  --region ap-northeast-1

# 出力例: https://kinesisvideo.ap-northeast-1.amazonaws.com/...

# 時間範囲指定で映像クリップ抽出
aws kinesisvideo get-clip \
  --stream-arn $STREAM_ARN \
  --clip-fragment-selector \
  FragmentSelectorType=SERVER_TIMESTAMP,\
TimestampRange='{StartTimestamp=2026-04-27T10:00:00Z,EndTimestamp=2026-04-27T10:15:00Z}' \
  --region ap-northeast-1 \
  output.mp4

SDK (Python): プロデューサー・Rekognition 分析

import boto3
from datetime import datetime
import json
from kinesisvideo import KinesisVideoClient

# 1. ストリーム作成・情報取得
kvs = boto3.client('kinesisvideo', region_name='ap-northeast-1')

stream_response = kvs.create_stream(
    StreamName='security-camera-02',
    DataRetentionInHours=720  # 30 日保持
)

# 2. Media Endpoint 取得(Producer/Consumer 接続用)
media_endpoint = kvs.get_data_endpoint(
    StreamName='security-camera-02',
    APIName='GET_MEDIA'
)

print(f"Media Endpoint: {media_endpoint['DataEndpoint']}")

# 3. Rekognition Stream Processor 起動
rekognition = boto3.client('rekognition', region_name='ap-northeast-1')

processor = rekognition.create_stream_processor(
    Input={
        'KinesisVideoStream': {
            'Arn': stream_response['StreamARN']
        }
    },
    Output={
        'KinesisDataStream': {
            'Arn': 'arn:aws:kinesis:ap-northeast-1:123456789012:stream/detection-results'
        }
    },
    RoleArn='arn:aws:iam::123456789012:role/RekognitionProcessorRole',
    StreamProcessorSettings={
        'FaceSearch': {
            'CollectionId': 'security-personnel'
        }
    },
    Name='camera-02-face-detection',
    Tags={'Environment': 'Production'}
)

# 4. Stream Processor 起動
rekognition.start_stream_processor(Name='camera-02-face-detection')

# 5. 検出結果を Kinesis から消費
kinesis = boto3.client('kinesis', region_name='ap-northeast-1')

def process_detections():
    response = kinesis.get_shard_iterator(
        StreamName='detection-results',
        ShardId='shardId-000000000000',
        ShardIteratorType='LATEST'
    )
    
    shard_iterator = response['ShardIterator']
    
    while shard_iterator:
        records = kinesis.get_records(
            ShardIterator=shard_iterator,
            Limit=100
        )
        
        for record in records['Records']:
            detection = json.loads(record['Data'])
            
            # 顔検出イベント処理
            if 'FaceSearchResponse' in detection:
                matches = detection['FaceSearchResponse']['FaceMatches']
                if matches:
                    print(f"Known face detected: {matches[0]['Face']['ExternalImageId']}")
                    # アラート送信
                    send_alert(matches[0]['Face']['ExternalImageId'])
        
        shard_iterator = records.get('NextShardIterator')

def send_alert(person_id):
    sns = boto3.client('sns', region_name='ap-northeast-1')
    sns.publish(
        TopicArn='arn:aws:sns:ap-northeast-1:123456789012:security-alerts',
        Subject='Security Alert',
        Message=f'Known person detected: {person_id}'
    )

# 実行
process_detections()

IaC (Terraform): KVS + Rekognition + Lambda

# IAM ロール
resource "aws_iam_role" "kvs_rekognition_role" {
  name = "kvs-rekognition-role"
  
  assume_role_policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Principal = {
          Service = [
            "kinesisvideo.amazonaws.com",
            "rekognition.amazonaws.com"
          ]
        }
        Action = "sts:AssumeRole"
      }
    ]
  })
}

# Rekognition 権限ポリシー
resource "aws_iam_role_policy" "rekognition_policy" {
  name = "rekognition-policy"
  role = aws_iam_role.kvs_rekognition_role.id
  
  policy = jsonencode({
    Version = "2012-10-17"
    Statement = [
      {
        Effect = "Allow"
        Action = [
          "kinesisvideo:GetMedia",
          "kinesisvideo:GetHLSStreamingSessionURL"
        ]
        Resource = "*"
      },
      {
        Effect = "Allow"
        Action = [
          "kinesis:PutRecord",
          "kinesis:PutRecords"
        ]
        Resource = aws_kinesis_stream.detection_results.arn
      }
    ]
  })
}

# KVS ストリーム
resource "aws_kinesisvideo_stream" "security_camera" {
  stream_name             = "security-camera-floor1"
  data_retention_in_hours = 720  # 30 日
  
  tags = {
    Environment = "Production"
    Location    = "Floor1"
  }
}

# 検出結果を受信する Kinesis ストリーム
resource "aws_kinesis_stream" "detection_results" {
  name             = "camera-detections"
  shard_count      = 1
  retention_period = 24
}

# Lambda: アラート処理
resource "aws_lambda_function" "detection_alerter" {
  filename         = "detection_alerter.zip"
  function_name    = "detection-alerter"
  role             = aws_iam_role.lambda_role.arn
  handler          = "index.handler"
  runtime          = "python3.11"
  timeout          = 60
  
  environment {
    variables = {
      SNS_TOPIC_ARN = aws_sns_topic.security_alerts.arn
    }
  }
}

# Lambda Event Source Mapping
resource "aws_lambda_event_source_mapping" "detection_stream" {
  event_source_arn  = aws_kinesis_stream.detection_results.arn
  function_name     = aws_lambda_function.detection_alerter.arn
  starting_position = "LATEST"
  batch_size        = 100
}

# SNS Topic: アラート通知
resource "aws_sns_topic" "security_alerts" {
  name = "security-alerts"
}

resource "aws_sns_topic_subscription" "security_email" {
  topic_arn = aws_sns_topic.security_alerts.arn
  protocol  = "email"
  endpoint  = "security@company.com"
}

output "stream_arn" {
  value = aws_kinesisvideo_stream.security_camera.stream_arn
}

output "hls_endpoint" {
  value = "https://kinesisvideo.ap-northeast-1.amazonaws.com/"
}

CloudFormation: WebRTC Signaling Channel

Resources:
  SecurityCamera:
    Type: AWS::KinesisVideo::Stream
    Properties:
      StreamName: doorbell-camera
      DataRetentionInHours: 24
      Tags:
        - Key: Type
          Value: DoorBell

  SignalingChannel:
    Type: AWS::KinesisVideo::SignalingChannel
    Properties:
      ChannelName: doorbell-webrtc
      ChannelType: SINGLE_MASTER
      Tags:
        - Key: Application
          Value: SmartHome

  RekognitionProcessor:
    Type: AWS::Rekognition::StreamProcessor
    Properties:
      RoleArn: !GetAtt ProcessorRole.Arn
      Input:
        KinesisVideoStream:
          Arn: !GetAtt SecurityCamera.StreamArn
      Output:
        KinesisDataStream:
          Arn: !GetAtt DetectionStream.Arn
      StreamProcessorSettings:
        FaceSearch:
          CollectionId: family-collection
      Name: doorbell-face-detector
      Tags:
        Environment: Production

  DetectionStream:
    Type: AWS::Kinesis::Stream
    Properties:
      Name: doorbell-detections
      ShardCount: 1
      RetentionPeriodHours: 24

  ProcessorRole:
    Type: AWS::IAM::Role
    Properties:
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Principal:
              Service: rekognition.amazonaws.com
            Action: sts:AssumeRole
      ManagedPolicyArns:
        - arn:aws:iam::aws:policy/AmazonKinesisVideoFullAccess
      Policies:
        - PolicyName: KinesisAccess
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: Allow
                Action:
                  - kinesis:PutRecord
                  - kinesis:PutRecords
                Resource: !GetAtt DetectionStream.Arn

Outputs:
  StreamARN:
    Value: !GetAtt SecurityCamera.StreamArn
  SignalingChannelARN:
    Value: !GetAtt SignalingChannel.ChannelArn
  DetectionStreamName:
    Value: !Ref DetectionStream

類似サービス比較表

観点 KVS AWS IVS Azure Media Services GCP Live Stream API Wowza
双方向通信 ✅(WebRTC) ❌(一方向ライブ) ❌(一方向) ❌(一方向) ✅(カスタム)
長期保存 ✅(最大 10 年) 短期(ライブ配信向け) ✅(無制限) ✅(無制限) 設定可能
Rekognition 統合 ✅(ネイティブ) Azure Video Analyzer
WebRTC ✅(マネージド STUN/TURN) ✅(別途)
エッジエージェント ✅(Greengrass) ✅(Azure Stack Edge)
SageMaker 連携
用途 セキュリティ・IoT・分析 ライブ配信 メディア処理 ライブ配信 配信基盤

ベストプラクティス

✅ 推奨

  • 複数 Availability Zone にカメラ分散 - 単一 AZ 障害対応
  • IAM ロール最小権限 - Rekognition・Kinesis アクセスのみ
  • Rekognition Collection 事前構築 - 顔認識精度向上
  • エッジエージェント + クラウド処理 - ネットワーク帯域削減・プライバシー保護
  • HLS 再生に CloudFront 配置 - CDN キャッシュで転送量削減・低遅延
  • CloudWatch メトリクス監視 - ストリーム状態・Rekognition 検出率
  • タイムスタンプ検索活用 - 特定時間帯の映像を効率的に取得
  • WebRTC は TURN サーバー有効化 - NAT 越え・ファイアウォール対応
  • 長期保存は S3 Glacier へエクスポート - コスト削減

❌ アンチパターン

  • すべてのカメラをクラウド分析 - ネットワーク帯域浪費、レイテンシー増加
  • フレームレート 30fps で 4K 映像 - ネットワーク・ストレージコスト爆増
  • 保持期間なし(無制限) - ストレージ料金青天井
  • CloudFront なしで HLS 配信 - データ転送料金高騰
  • Rekognition Collection なし - 顔認識精度低下・無限FP
  • エラーハンドリングなし - ストリーム中断時のデータ欠損

トラブルシューティング表

症状 原因 対応
Producer が接続できない ネットワーク遮断 / IAM 権限不足 SecurityGroup 確認、IAM ロール確認
HLS 再生できない CloudFront キャッシュ期限 / Endpoint URL 誤り キャッシュクリア、Endpoint 再取得
Rekognition 検出遅延 Stream Processor 過負荷 / フレームレート高 フレームレート低下(30fps→15fps)
WebRTC レイテンシー高 TURN サーバー遠い / ネットワーク不安定 TURN サーバー地域確認、ネットワーク改善
ストレージ容量枯渇 保持期間設定誤り / ファイル削除なし 保持期間短縮、S3 Glacier エクスポート
Lambda アラート来ない Rekognition Face Collection 空 / IAM 権限 Face Collection に顔登録、IAM 確認

2025-2026 最新動向

  • Rekognition Video ストリーム処理改善 - より正確な物体検出、カスタムラベル対応
  • WebRTC SFU(Selective Forwarding Unit) - 複数ユーザーへの効率的配信
  • エッジ AI 強化 - Greengrass 上でのリアルタイム推論(SageMaker モデル)
  • RTMP サポート拡張 - OBS・Wirecast などの配信ツール対応
  • 360 度ビデオ対応 - VR・ドローン向け
  • ビデオ分析メトリクス拡張 - より詳細な検出結果・信頼度スコア
  • マルチリージョン複製 - 災害対応・ジオロケーション最適化

学習リソース・参考文献

公式ドキュメント

  1. AWS Kinesis Video Streams Developer Guide
  2. Kinesis Video Streams FAQs
  3. Kinesis Video Streams Pricing
  4. KVS Producer SDK
  5. Rekognition Video Integration
  6. KVS WebRTC Documentation
  7. KVS Edge Agent
  8. Build Video Surveillance on AWS

ベンダー・オープンソース

  1. WebRTC.org
  2. GStreamer kvssink Plugin
  3. FFmpeg KVS Integration
  4. Android KVS SDK
  5. iOS KVS SDK

実装例・チェックリスト

実装例: スマートホーム玄関監視

# Lambda: 顔検出時にプッシュ通知
import boto3
import json
import os

sns = boto3.client('sns')
dynamodb = boto3.resource('dynamodb')

table = dynamodb.Table('family-members')

def lambda_handler(event, context):
    for record in event['Records']:
        payload = json.loads(record['kinesis']['data'])
        
        if 'FaceSearchResponse' not in payload:
            continue
        
        matches = payload['FaceSearchResponse']['FaceMatches']
        
        if matches:
            face_id = matches[0]['Face']['ExternalImageId']
            confidence = matches[0]['Similarity']
            
            # DynamoDB で顔 ID から人物名を取得
            response = table.get_item(Key={'FaceId': face_id})
            
            if 'Item' in response:
                person_name = response['Item']['Name']
                phone = response['Item']['PhoneNumber']
                
                # スマートフォンに通知
                message = f"{person_name} が帰宅しました(信頼度: {confidence:.0f}%)"
                
                sns.publish(
                    TopicArn=os.environ['SNS_TOPIC_ARN'],
                    Subject='玄関カメラアラート',
                    Message=message
                )
                
                # HomeKit/Alexa トリガー(別途統合)
                trigger_home_automation(person_name)
    
    return {'statusCode': 200}

def trigger_home_automation(person_name):
    # 例: Alexa に玄関錠解錠指示
    # IoT Core メッセージ発行
    iot = boto3.client('iot-data')
    iot.publish(
        topic=f'home/entrance/unlock',
        qos=1,
        payload=json.dumps({'person': person_name})
    )

チェックリスト

  • [ ] Producer SDK で映像送信テスト実施?
  • [ ] Rekognition Face Collection に家族の顔登録?
  • [ ] Stream Processor 起動・稼働確認?
  • [ ] Lambda 関数でアラート処理実装?
  • [ ] CloudWatch メトリクス監視(ストリーム状態・検出率)?
  • [ ] HLS 再生テスト実施?
  • [ ] CloudFront 配置してキャッシュ有効化?
  • [ ] 保持期間設定(日数 vs コスト)?
  • [ ] IAM ロール最小権限設定?
  • [ ] WebRTC テスト(双方向通話)?
  • [ ] エッジエージェント(Greengrass)デプロイ検討?
  • [ ] S3 Glacier へのアーカイブ自動化?

まとめ

Amazon Kinesis Video Streams は IoT カメラ・監視カメラ・スマートホームなどのビデオデバイスからクラウドへのリアルタイム映像送信・保存・再生・分析を実現する完全マネージドビデオストリーミングプラットフォームです。Rekognition Video による自動顔認識・物体検出、WebRTC による双方向低遅延通信、HLS による標準プレーヤー対応、KVS Edge Agent によるエッジ処理、最大 10 年の長期保存により、セキュリティ監視・スマートホーム・工場管理・自動運転開発など幅広い用途に対応します。AWS AI/ML サービスと統合し、エンタープライズグレードの映像分析基盤を実現します。


最終更新:2026-04-27
バージョン:v2.0