Guide · Chime SDK Media Pipelines · Capture, Live Connector & AI Insights

AWS Chime SDK Media Pipelines for MCP Servers — Capture, Live Connector, and AI Insights

Chime SDK Media Pipelines captures audio, video, and content from active Chime SDK Meetings sessions in real time, routing them to S3 for recording, to RTMP endpoints for live streaming, or through AI processing pipelines for transcription and speaker analytics. MCP server tools built on @aws-sdk/client-chime-sdk-media-pipelines can start and stop capture pipelines, configure per-source artifact settings, wire live connector pipelines for Twitch/YouTube streaming, and create media insights pipelines using Amazon Transcribe Call Analytics for keyword alerting and sentiment analysis. The first-hour failure is the S3 bucket policy — the chime.amazonaws.com service principal must be granted s3:PutObject in the S3 bucket policy independently of the IAM execution role; without it, pipeline creation succeeds but artifact uploads silently fail.

TL;DR

Three pipeline types: (1) CreateMediaCapturePipeline — records meeting media to S3; (2) CreateMediaLiveConnectorPipeline — streams meeting audio+video to an RTMP endpoint; (3) CreateMediaInsightsPipeline — runs real-time AI processing (transcription, keyword alerts, sentiment, speaker search) on meeting audio. For capture pipelines: set ArtifactsConfiguration per source type (Audio/Video/Content) — omitting a source type disables recording for that source. The S3 bucket needs a resource-based policy granting chime.amazonaws.com the s3:PutObject action on the destination prefix — the IAM role policy alone is not sufficient. For insights pipelines: create a MediaInsightsPipelineConfiguration (a reusable template) with the desired processor chain, then call CreateMediaInsightsPipeline to start processing for a specific meeting. Pipelines are tied to meeting lifetime — when the meeting is deleted, any attached pipeline is automatically stopped.

Why Media Pipelines in an MCP server

AI agents managing communication workflows often need to record or analyze meeting content in real time. Media Pipelines is the bridge between Chime SDK Meetings (which manages the live session) and storage or AI services (which process the content). Without Media Pipelines, there is no server-side recording — Chime SDK's client SDK can record locally on a participant's device, but that requires a human at a computer with disk space and no server-side access to the content.

MCP server use cases for Media Pipelines include: automatically starting a capture pipeline when a support call begins, posting a transcript summary to a Chime channel when the call ends, detecting compliance keywords in real time and alerting a supervisor, generating post-call analytics for CRM integration, and streaming internal all-hands meetings to a public YouTube/Twitch channel via RTMP live connector.

Media Pipelines are a separate sub-service from Meetings. The pipeline client uses the @aws-sdk/client-chime-sdk-media-pipelines package and routes to media-pipelines-chime.{region}.amazonaws.com — a different endpoint than the Meetings client. The same IAM principal can use both clients simultaneously.

S3 bucket policy requirement (critical prerequisite)

Before creating any capture pipeline, the S3 destination bucket must have a resource-based bucket policy that grants chime.amazonaws.com the s3:PutObject permission. This is in addition to any IAM role policies on the execution environment. The Chime Media Pipelines service writes artifacts using its own service credentials — the pipeline's IAM execution role does not control the actual file writes, and the two must both be authorized independently.

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "ChimeMediaPipelinesCapture",
      "Effect": "Allow",
      "Principal": {
        "Service": "chime.amazonaws.com"
      },
      "Action": [
        "s3:PutObject",
        "s3:PutObjectAcl"
      ],
      "Resource": "arn:aws:s3:::your-capture-bucket/*",
      "Condition": {
        "StringEquals": {
          "aws:SourceAccount": "123456789012"
        }
      }
    }
  ]
}

The aws:SourceAccount condition is essential — without it, any AWS Chime service call could write to your bucket. Always scope it to your AWS account ID. Some teams omit s3:PutObjectAcl and find that some artifacts upload but metadata is missing; include both permissions to avoid this.

If the bucket policy is missing or incorrect, CreateMediaCapturePipeline returns HTTP 201 (success) — the pipeline is created and starts running. However, no files appear in S3. The failure is silent from the pipeline creation API; you must check the pipeline's Status via GetMediaCapturePipeline to discover InProgress vs Failed states, and check CloudWatch Logs for the pipeline's error stream.

CreateMediaCapturePipeline: recording meetings to S3

The capture pipeline records up to three independent media sources from a meeting: Audio (mixed), Video (active speaker or composited grid), and Content (screen share). Each source is configured independently in ArtifactsConfiguration.

import {
  ChimeSDKMediaPipelinesClient,
  CreateMediaCapturePipelineCommand,
  DeleteMediaCapturePipelineCommand,
  GetMediaCapturePipelineCommand,
} from '@aws-sdk/client-chime-sdk-media-pipelines';

const pipelinesClient = new ChimeSDKMediaPipelinesClient({ region: 'us-east-1' });

server.tool(
  'start_meeting_capture',
  'Start recording a Chime meeting to S3',
  {
    meetingId: z.string().describe('MeetingId to capture'),
    s3BucketArn: z.string().describe('S3 bucket ARN (arn:aws:s3:::bucket-name)'),
    s3KeyPrefix: z.string().default('captures/').describe('S3 key prefix for captured artifacts'),
    captureVideo: z.boolean().default(true),
    captureContent: z.boolean().default(true),
    videoLayout: z.enum(['ActiveSpeakerOnly', 'Composited', 'None']).default('Composited'),
  },
  async ({ meetingId, s3BucketArn, s3KeyPrefix, captureVideo, captureContent, videoLayout }) => {
    const result = await pipelinesClient.send(
      new CreateMediaCapturePipelineCommand({
        SourceType: 'ChimeSdkMeeting',
        SourceArn: `arn:aws:chime::123456789012:meeting:${meetingId}`,
        SinkType: 'S3Bucket',
        SinkArn: s3BucketArn,
        ChimeSdkMeetingConfiguration: {
          ArtifactsConfiguration: {
            Audio: {
              MuxType: captureVideo
                ? 'AudioWithActiveSpeakerVideo'  // Combined audio+video track
                : 'AudioOnly',                   // Audio-only MP4
            },
            Video: captureVideo ? {
              State: 'Enabled',
              MuxType: videoLayout === 'None' ? 'VideoOnly' : 'VideoOnly',
            } : {
              State: 'Disabled',
            },
            Content: captureContent ? {
              State: 'Enabled',
              MuxType: 'ContentOnly',
            } : {
              State: 'Disabled',
            },
            CompositedVideo: videoLayout === 'Composited' ? {
              Layout: 'GridView',
              Resolution: 'FHD',
              GridViewConfiguration: {
                ContentShareLayout: 'ActiveSpeakerOnly',
                ActiveSpeakerOnlyConfiguration: { ActiveSpeakerPosition: 'TopLeft' },
              },
            } : undefined,
          },
        },
      })
    );

    return {
      content: [{
        type: 'text',
        text: JSON.stringify({
          pipelineId: result.MediaCapturePipeline?.MediaPipelineId,
          status: result.MediaCapturePipeline?.Status,
          sinkArn: result.MediaCapturePipeline?.SinkArn,
        }, null, 2),
      }],
    };
  }
);

The Audio.MuxType field controls whether video is muxed into the audio track's MP4 file. AudioWithActiveSpeakerVideo produces a single MP4 with the active speaker's video alongside the audio — suitable for playback. AudioOnly produces an MP4 with only the audio track — suitable for transcription-only workflows where video is not needed. AudioWithCompositedVideo (available when CompositedVideo is configured) muxes the composited grid into the audio MP4.

Composited video produces a grid layout showing all active participants. Configure CompositedVideo in ArtifactsConfiguration alongside Audio.MuxType: 'AudioWithCompositedVideo' to get a recording that shows all participants in a grid, similar to what a human observer would see in the meeting. This is more computationally expensive than ActiveSpeakerOnly but produces recordings that are easier to review without additional video editing.

Stopping and monitoring capture pipelines

server.tool(
  'stop_meeting_capture',
  'Stop an active meeting capture pipeline',
  {
    pipelineId: z.string().describe('MediaPipelineId from start_meeting_capture'),
  },
  async ({ pipelineId }) => {
    await pipelinesClient.send(
      new DeleteMediaCapturePipelineCommand({ MediaPipelineId: pipelineId })
    );
    return { content: [{ type: 'text', text: `Pipeline ${pipelineId} stopped` }] };
  }
);

server.tool(
  'get_capture_status',
  'Check the status of a media capture pipeline',
  {
    pipelineId: z.string(),
  },
  async ({ pipelineId }) => {
    try {
      const result = await pipelinesClient.send(
        new GetMediaCapturePipelineCommand({ MediaPipelineId: pipelineId })
      );
      return {
        content: [{
          type: 'text',
          text: JSON.stringify({
            pipelineId,
            status: result.MediaCapturePipeline?.Status,
            // Status values: Initializing | InProgress | Failed | Stopping | Stopped | NotStarted
            createdAt: result.MediaCapturePipeline?.CreatedTimestamp,
          }),
        }],
      };
    } catch (err: any) {
      if (err.name === 'NotFoundException') {
        return { content: [{ type: 'text', text: JSON.stringify({ status: 'NotFound', pipelineId }) }] };
      }
      throw err;
    }
  }
);

Pipeline status values: Initializing (provisioning), InProgress (capturing), Stopping (delete requested, draining), Stopped (terminated cleanly), Failed (error — check CloudWatch for details), NotStarted (created but meeting not yet active). A pipeline in Failed state has stopped capturing; calling DeleteMediaCapturePipeline on a Failed pipeline is safe and cleans up the resource.

CreateMediaLiveConnectorPipeline: RTMP streaming

The Live Connector pipeline takes a meeting's audio and video and pushes it to an RTMP endpoint — YouTube Live, Twitch, a custom media server, or any service that accepts RTMP ingest. This enables MCP server tools to start and stop live streams of Chime meetings on demand.

import { CreateMediaLiveConnectorPipelineCommand } from '@aws-sdk/client-chime-sdk-media-pipelines';

server.tool(
  'start_rtmp_stream',
  'Stream a Chime meeting to an RTMP endpoint',
  {
    meetingId: z.string(),
    rtmpUrl: z.string().describe('RTMP ingest URL (e.g. rtmps://live.twitch.tv/live/)'),
    rtmpStreamKey: z.string().describe('RTMP stream key'),
  },
  async ({ meetingId, rtmpUrl, rtmpStreamKey }) => {
    const result = await pipelinesClient.send(
      new CreateMediaLiveConnectorPipelineCommand({
        Sources: [
          {
            SourceType: 'ChimeSdkMeeting',
            ChimeSdkMeetingLiveConnectorConfiguration: {
              Arn: `arn:aws:chime::123456789012:meeting:${meetingId}`,
              MuxType: 'AudioWithCompositedVideo',
              CompositedVideo: {
                Layout: 'GridView',
                Resolution: 'FHD',
                GridViewConfiguration: {
                  ContentShareLayout: 'ActiveSpeakerOnly',
                },
              },
            },
          },
        ],
        Sinks: [
          {
            SinkType: 'RTMP',
            RTMPConfiguration: {
              Url: `${rtmpUrl}${rtmpStreamKey}`,
              AudioChannels: 'Stereo',
              AudioSampleRate: '48000',
            },
          },
        ],
      })
    );

    return {
      content: [{
        type: 'text',
        text: JSON.stringify({
          pipelineId: result.MediaLiveConnectorPipeline?.MediaPipelineId,
          status: result.MediaLiveConnectorPipeline?.Status,
        }),
      }],
    };
  }
);

The RTMP URL and stream key are concatenated — Chime does not have separate URL/key fields. Store the stream key in AWS Secrets Manager and retrieve it at runtime rather than accepting it directly from the tool input. MCP tool inputs that contain live streaming credentials can be logged in the agent's memory or conversation history; keeping them in Secrets Manager ensures they are not exposed.

MediaInsightsPipelineConfiguration: AI processing template

AI insights pipelines work in two stages: (1) create a MediaInsightsPipelineConfiguration, which is a reusable template defining the processor chain; (2) call CreateMediaInsightsPipeline to run that configuration against a specific meeting. The configuration is created once and reused across many pipeline invocations.

The configuration defines an ordered chain of elements, each being a processor that transforms or analyzes the audio stream, or a sink that delivers results. Available processors include AmazonTranscribeProcessor, AmazonTranscribeCallAnalyticsProcessor, and VoiceAnalyticsProcessor. Available sinks include KinesisDataStreamSink, LambdaFunctionSink, and S3RecordingSink.

import {
  CreateMediaInsightsPipelineConfigurationCommand,
  CreateMediaInsightsPipelineCommand,
  DeleteMediaInsightsPipelineCommand,
} from '@aws-sdk/client-chime-sdk-media-pipelines';

// Step 1: Create the configuration (once at setup time)
async function createInsightsConfig(kinesisStreamArn: string): Promise<string> {
  const result = await pipelinesClient.send(
    new CreateMediaInsightsPipelineConfigurationCommand({
      MediaInsightsPipelineConfigurationName: 'call-analytics-v1',
      ResourceAccessRoleArn: 'arn:aws:iam::123456789012:role/ChimeMediaInsightsRole',
      Elements: [
        {
          Type: 'AmazonTranscribeCallAnalyticsProcessor',
          AmazonTranscribeCallAnalyticsProcessorConfiguration: {
            LanguageCode: 'en-US',
            // CallAnalyticsStreamCategories map to real-time alerts
            // Define categories via Transcribe Call Analytics console first
            ContentRedactionType: 'PII',  // Redact PII from transcript
            ContentIdentificationType: 'PII', // Also identify and tag PII
            PartialResultsStability: 'high', // Real-time stability: low/medium/high
            EnablePartialResultsStabilization: true,
            PostCallAnalyticsSettings: {
              OutputLocation: 's3://your-bucket/call-analytics-output/',
              DataAccessRoleArn: 'arn:aws:iam::123456789012:role/TranscribeAccessRole',
              ContentRedactionOutput: 'redacted_and_combined',
            },
          },
        },
        {
          Type: 'KinesisDataStreamSink',
          KinesisDataStreamSinkConfiguration: {
            InsightsTarget: kinesisStreamArn,
          },
        },
      ],
      RealTimeAlertConfiguration: {
        Disabled: false,
        Rules: [
          {
            Type: 'KeywordMatchRule',
            KeywordMatchConfiguration: {
              RuleName: 'escalation-keywords',
              Keywords: ['refund', 'cancel', 'supervisor', 'complaint', 'legal'],
              Negate: false,
            },
          },
          {
            Type: 'SentimentRule',
            SentimentConfiguration: {
              RuleName: 'negative-sentiment',
              SentimentType: 'NEGATIVE',
              TimePeriod: 60, // seconds of negative sentiment before alerting
            },
          },
        ],
      },
    })
  );

  return result.MediaInsightsPipelineConfiguration?.MediaInsightsPipelineConfigurationArn!;
}

The ResourceAccessRoleArn is an IAM role that the Media Pipelines service assumes to deliver events to your Kinesis stream, Lambda function, or S3 bucket. This role needs kinesis:PutRecord (for Kinesis sinks), lambda:InvokeFunction (for Lambda sinks), or s3:PutObject (for S3 sinks). The trust policy must allow mediapipelines.chime.amazonaws.com to assume the role.

Starting a media insights pipeline

Once the configuration ARN is known, starting insights processing for a meeting is a single API call. The pipeline remains active until stopped or the meeting ends.

server.tool(
  'start_call_analytics',
  'Start real-time transcription and analytics for a Chime meeting',
  {
    meetingId: z.string(),
    configArn: z.string().describe('MediaInsightsPipelineConfigurationArn'),
  },
  async ({ meetingId, configArn }) => {
    const result = await pipelinesClient.send(
      new CreateMediaInsightsPipelineCommand({
        MediaInsightsPipelineConfigurationArn: configArn,
        MediaInsightsRuntimeMetadata: {
          // Key-value pairs available in the transcript events stream
          MeetingId: meetingId,
        },
        ChimeSdkMeetingConfiguration: {
          Artifacts: {
            Audio: { State: 'Enabled' },
            Video: { State: 'Disabled' }, // Insights pipelines process audio only
            Content: { State: 'Disabled' },
          },
        },
        KinesisVideoStreamSourceRuntimeConfiguration: undefined,
        // Use ChimeSdkMeetingConfiguration when sourcing from a Chime meeting
      })
    );

    return {
      content: [{
        type: 'text',
        text: JSON.stringify({
          pipelineId: result.MediaInsightsPipeline?.MediaPipelineId,
          status: result.MediaInsightsPipeline?.Status,
        }),
      }],
    };
  }
);

server.tool(
  'stop_call_analytics',
  'Stop an active media insights pipeline',
  {
    pipelineId: z.string(),
  },
  async ({ pipelineId }) => {
    await pipelinesClient.send(
      new DeleteMediaInsightsPipelineCommand({ MediaPipelineId: pipelineId })
    );
    return { content: [{ type: 'text', text: `Pipeline ${pipelineId} stopped` }] };
  }
);

The MediaInsightsRuntimeMetadata map is passed through to every transcript event in the Kinesis stream. Use it to tag events with the meeting ID, customer ID, or ticket number so that downstream consumers can correlate transcript segments with your application's records without a separate lookup.

Reading transcription events from Kinesis

Transcription events arrive in the Kinesis Data Stream as JSON objects. Each event has a TranscriptEvent key with Transcript.Results containing one or more partial or final transcript results. Final results have IsPartial: false. Real-time alert events (keyword match, sentiment) arrive as separate CategoryEvent records in the same stream.

// Structure of a Chime Transcribe Call Analytics event in Kinesis
interface ChimeInsightsEvent {
  TranscriptEvent?: {
    Transcript: {
      Results: Array<{
        ResultId: string;
        StartTime: number;    // seconds from meeting start
        EndTime: number;
        IsPartial: boolean;
        Alternatives: Array<{
          Transcript: string;
          Items: Array<{
            Content: string;
            Type: 'pronunciation' | 'punctuation';
            StartTime: number;
            EndTime: number;
            VocabularyFilterMatch: boolean;
            Speaker: string;      // 'spk_0', 'spk_1', etc.
            Confidence: number;
          }>;
          Entities: Array<{ Content: string; Category: string; Type: string; Confidence: number }>;
        }>;
        ChannelId: string;    // 'ch_0' for agent, 'ch_1' for customer in call analytics
      }>;
    };
  };
  CategoryEvent?: {
    MatchedCategories: string[];
    MatchedDetails: Record<string, { TimestampRanges: Array<{ BeginOffsetMillis: number; EndOffsetMillis: number }> }>;
  };
  UtteranceEvent?: {
    UtteranceId: string;
    IsPartial: boolean;
    ParticipantRole: 'AGENT' | 'CUSTOMER';
    Sentiment: 'POSITIVE' | 'NEGATIVE' | 'MIXED' | 'NEUTRAL';
    Transcript: string;
    BeginOffsetMillis: number;
    EndOffsetMillis: number;
    IssuesDetected: Array<{ CharacterOffsets: { Begin: number; End: number } }>;
    ActionItemsDetected: Array<{ CharacterOffsets: { Begin: number; End: number } }>;
    OutcomesDetected: Array<{ CharacterOffsets: { Begin: number; End: number } }>;
  };
}

UtteranceEvent is a higher-level abstraction available with AmazonTranscribeCallAnalyticsProcessor that segments the transcript by speaker turn and includes per-utterance sentiment, issues detected, action items detected, and outcomes detected — all from Transcribe Call Analytics ML models without additional processing. For MCP server tools that summarize calls or extract action items, consuming UtteranceEvent records is more efficient than parsing the lower-level TranscriptEvent word stream.

IAM role requirements for Media Pipelines

Three IAM roles are involved in a media insights pipeline:

  1. MCP server execution role — needs chime:CreateMediaInsightsPipeline, chime:CreateMediaCapturePipeline, chime:DeleteMediaInsightsPipeline, chime:GetMediaCapturePipeline.
  2. ResourceAccessRoleArn — assumed by the Media Pipelines service to deliver events. Needs kinesis:PutRecord for Kinesis sinks; needs a trust policy allowing mediapipelines.chime.amazonaws.com.
  3. TranscribeDataAccessRole (for PostCallAnalyticsSettings.DataAccessRoleArn) — assumed by Transcribe Call Analytics to write post-call analysis to S3. Needs s3:PutObject on the output bucket and trust allowing transcribe.amazonaws.com.
// ResourceAccessRole trust policy
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "Service": "mediapipelines.chime.amazonaws.com" },
      "Action": "sts:AssumeRole",
      "Condition": {
        "StringEquals": { "aws:SourceAccount": "123456789012" }
      }
    }
  ]
}

Production gotchas

GotchaSymptomFix
Missing S3 bucket policy for capture pipeline Pipeline status shows InProgress but no files in S3; pipeline transitions to Failed after a few minutes Add resource-based bucket policy granting chime.amazonaws.com the s3:PutObject permission with aws:SourceAccount condition — IAM role policy alone is not enough
ResourceAccessRoleArn missing Kinesis trust policy Insights pipeline creates successfully but no events appear in Kinesis; CloudWatch shows AccessDenied Trust policy must include mediapipelines.chime.amazonaws.com as the principal — not chime.amazonaws.com
Capture pipeline region different from meeting BadRequestException: Meeting not found on CreateMediaCapturePipeline Capture pipeline must be created in the same region as the meeting — use the same region for both the pipelinesClient and the meetingsClient
Video set to Disabled but AudioWithActiveSpeakerVideo specified ConflictException or unexpected behavior in audio track If Video.State: 'Disabled', use Audio.MuxType: 'AudioOnly' — cannot mux active-speaker video when video capture is disabled
MediaInsightsPipelineConfiguration not found when starting pipeline NotFoundException on CreateMediaInsightsPipeline Confirm the config ARN region matches the pipelinesClient region; configurations are regional resources
Real-time alert categories referenced but not configured in Transcribe CategoryEvent records never arrive in Kinesis even when keywords are spoken Call Analytics categories must be created in the Amazon Transcribe console or via CreateCallAnalyticsCategory API before they can appear in MatchedCategories; keywords in RealTimeAlertConfiguration are separate from categories
Partial results consuming too much Kinesis bandwidth Kinesis shard capacity exceeded; throttling errors in CloudWatch Use EnablePartialResultsStabilization: true with PartialResultsStability: 'high' to reduce partial result churn; consider filtering to only final results (IsPartial: false) in a Lambda consumer

Related pages