AWS Builder Center

Smart Crop with AWS Elemental Inference: build a live demo viewer

Build a small local web page that plays your AWS Elemental MediaLive channel and draws the Smart Crop region over the landscape picture as it follows the action, in sync with the frame on screen.

Series: Building with AWS Elemental Inference (4 articles)

  1. …
  2. 4
    Smart Crop with AWS Elemental Inference: build a live demo viewer This article
Senior Specialist Solutions Architect AWS Elemental
Placeholders in angle brackets (for example  <CHANNEL_ID> ) stand in for your own values.
Before you start: this article assumes Smart Crop is already running on your channel. To set it up, see Smart Crop with AWS Elemental Inference: the AWS Management Console way, the programmatic way, or building it with AI (Kiro).



What you'll build

The other Smart Crop articles confirm that the feature works by reading crop coordinates in a terminal, or by watching the vertical output. Neither shows why the vertical output looks the way it does. This viewer does: it plays the full 16:9 picture, draws the 9:16 region that Smart Crop chose, dims everything outside it, and marks the crop center point.
The demo viewer: the landscape picture with a 9:16 box over the area Smart Crop chose, the rest dimmed, and a blue marker at the crop center point. The status line shows the x and y values, the number of crop points held, the frame time, and how far the player is behind the live edge.

It is two files, about 280 lines in total:
File
What it does
 server.py 
A small local Python server. It reads the feed attached to your channel, signs the crop metadata queries with your AWS credentials, and serves the page.
 index.html 
The page. It plays the HLS stream, works out the wall-clock time of the frame on screen, and draws the crop box for that frame.
This article is for developers comfortable with Python and a little JavaScript (level 300).

How it works

Three ideas make the viewer accurate.
1. The browser never holds AWS credentials. Crop metadata comes from the feed's data endpoint, and every request must be signed with AWS Signature Version 4 (SigV4). A web page can't do that safely, so  server.py  does the signing and the page asks it for points over plain local HTTP.
2. Everything is matched on wall-clock time. MediaLive stamps frames with a 90,000-ticks-per-second clock anchored to the Unix epoch, and the crop points carry the same timestamps. AWS Elemental MediaPackage writes  EXT-X-PROGRAM-DATE-TIME  tags into the HLS playlist, so the player knows the wall-clock time of each segment. The page converts the video's playback position into that wall-clock time and looks up the crop point for exactly that moment. Because both sides use the same clock, the box stays in step with the action however far behind live the player is.
3. One crop point per frame. The service returns one center point per frame of the frame rate you ask for. The page stores each point under its frame number rather than its exact timestamp, because the same frame can come back from overlapping queries with a timestamp that differs by a fraction of a millisecond.
The following diagram shows the flow.
Architecture: video from Amazon S3 flows into AWS Elemental MediaLive. MediaLive sends video to AWS Elemental Inference, whose cropping output returns crop center points, and sends the stream over CMAF Ingest to AWS Elemental MediaPackage. On your computer, the browser plays the HLS stream with EXT-X-PROGRAM-DATE-TIME tags and asks the local server.py for crop points over local HTTP. server.py makes SigV4-signed metadata queries to the feed's data endpoint, so your AWS credentials stay on the server. The browser matches each crop point to the frame on screen by wall-clock time.


Prerequisites

  • A MediaLive channel with Smart Crop running, attached to an Elemental Inference feed. To configure MediaLive and Elemental Inference, follow one of the companion articles: the AWS Management Console way, the programmatic way, or building it with AI (Kiro).
  • A MediaPackage v2 channel fed by MediaLive. In the MediaLive channel, use a CMAF Ingest output group to send to MediaPackage v2.
  • A MediaPackage CMAF-HLS Origin endpoint for the landscape rendition. If the playlist also carries the vertical rendition, the player may pick that one instead.
  • The playlist must include  EXT-X-PROGRAM-DATE-TIME  tags; without them the page can't sync and says so. On the MediaPackage v2 origin endpoint (container type CMAF), choose Add HLS manifest, then in the HLS manifest settings set Program date/time interval (sec.), for example equal to your segment length.
  • Python 3 with Boto3 installed (the server uses botocore, which comes with it).
  • AWS credentials in your environment that can describe the channel, read the Elemental Inference feed, and call  GetMetadata  on the feed.
  • Google Chrome or Mozilla Firefox. The viewer was tested in both on macOS. Safari isn't supported, because it doesn't give the page the program date time the sync relies on.

Step 1: Create the server

Create a folder called  crop-viewer  and save the following as  server.py .
You don't need to edit this code. Your own values (the AWS Region, your MediaLive channel ID and your MediaPackage HLS URL) are passed to the server when you start it, in Step 3. The  <REGION> ,  <CHANNEL_ID>  and  <LANDSCAPE_HLS_URL>  in the comment at the top of the file are only a reminder of that command. The same goes for  index.html  in Step 2: it gets everything it needs from the server.
At startup, the server reads everything it needs from your live configuration: the frame rate and size of the  SMART_CROP  output, the feed attached to the channel (from its  InferenceSettings ), the feed's data endpoint, and the name of its cropping output. Nothing is hard-coded. If any of these is missing, it stops with a message that says which one and what to fix.
 query_crop()  turns a time window from the page into a metadata query. Note the details that matter:
  • The signing name is  elemental-inference , even though the Boto3 client is  elementalinference .
  • One query may cover at most 30 seconds; beyond that the service returns HTTP 413.
  • A 404 at the live edge just means no points have landed for that window yet.
  • On HTTP 429 (rate limited) it backs off with jitter, and re-signs each attempt because the signature covers the request time.
"""Smart Crop viewer: local server.

Serves index.html and answers /api/crop with SigV4-signed Elemental Inference
crop queries, so AWS credentials never reach the browser.

python3 server.py --region <REGION> --channel-id <CHANNEL_ID> --hls "<LANDSCAPE_HLS_URL>"
open http://127.0.0.1:8000
"""
import argparse, json, os, random, sys, time, urllib.error, urllib.request
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from urllib.parse import parse_qs, urlparse

import botocore.session
from botocore.auth import SigV4Auth
from botocore.awsrequest import AWSRequest

p = argparse.ArgumentParser()
p.add_argument("--region", required=True)
p.add_argument("--channel-id", required=True)
p.add_argument("--hls", required=True, help="HLS URL of the landscape rendition")
p.add_argument("--port", type=int, default=8000)
args = p.parse_args()

TIMESCALE = 90000 # MediaLive PTS: 90,000 ticks/s, epoch-anchored
MAX_WINDOW_MS = 30000 # service caps one query at 30s (413 beyond)

session = botocore.session.Session()
ml = session.create_client("medialive", region_name=args.region)
ei = session.create_client("elementalinference", region_name=args.region)

# Read everything from the live configuration; nothing hard-coded.
channel = ml.describe_channel(ChannelId=args.channel_id)
vd = next((v for v in channel["EncoderSettings"]["VideoDescriptions"]
if v.get("ScalingBehavior") == "SMART_CROP"), None) \
or sys.exit(f"channel {args.channel_id}: no video description has ScalingBehavior SMART_CROP")
if not (vd.get("Width") and vd.get("Height")):
sys.exit(f"output {vd['Name']}: set Width and Height on the SMART_CROP output")
codec = next(iter(vd["CodecSettings"].values()))
if "FramerateNumerator" not in codec: # FramerateControl INITIALIZE_FROM_SOURCE
sys.exit(f"output {vd['Name']}: frame rate follows the source; set Framerate control "
"to SPECIFIED with a numerator and denominator on that output")
FRAME_RATE = {"numerator": codec["FramerateNumerator"],
"denominator": codec.get("FramerateDenominator", 1)}
feed_arn = (channel.get("InferenceSettings") or {}).get("FeedArn") \
or sys.exit(f"channel {args.channel_id}: no Elemental Inference feed attached")
feed = ei.get_feed(id=feed_arn.split("/")[-1])
OUTPUT = next((o["name"] for o in feed.get("outputs", []) if "cropping" in o["outputConfig"]), None) \
or sys.exit(f"feed {feed['id']}: no cropping output")
if not feed.get("dataEndpoints"):
sys.exit(f"feed {feed['id']}: no data endpoint")
HOST = urlparse(feed["dataEndpoints"][0]).netloc
URL = f"https://{HOST}/v1/feed/{feed['id']}/input/0/metadata"
print(f"feed {feed['id']} output {OUTPUT} frame rate {FRAME_RATE}")

class GaveUp(Exception):
pass

def query_crop(start_ms, end_ms):
end_ms = min(end_ms, start_ms + MAX_WINDOW_MS)
body = json.dumps({
"outputName": OUTPUT,
"timeSpecification": {"ptsBased": {
"startPts": int(start_ms * TIMESCALE / 1000),
"endPts": int(end_ms * TIMESCALE / 1000),
"timescale": TIMESCALE}},
"parameters": {"smartCropping": {"frameRate": FRAME_RATE}},
})
for attempt in range(5):
# Re-sign every attempt: the signature covers the timestamp.
req = AWSRequest(method="POST", url=URL, data=body,
headers={"Content-Type": "application/json", "host": HOST})
SigV4Auth(session.get_credentials().get_frozen_credentials(),
"elemental-inference", args.region).add_auth(req)
try:
raw = urllib.request.urlopen(urllib.request.Request(
URL, data=body.encode(), headers=dict(req.headers), method="POST"), timeout=30).read()
break
except urllib.error.HTTPError as e:
if e.code == 404: # empty window at live edge: normal
return []
if e.code != 429 and e.code < 500:
raise
if attempt == 4:
raise GaveUp(f"still HTTP {e.code} after 5 attempts")
delay = 0.4 * 2 ** attempt # back off with jitter, don't hammer
time.sleep(delay + random.random() * delay)
samples = []
for it in json.loads(raw).get("items", []):
c = it.get("metadata", {}).get("smartCropping", {}).get("crop", {}).get("centerPoint")
if c:
s = c.get("scale") or 10000
samples.append({"pdtMs": it["pts"] * 1000 / TIMESCALE,
"x": c["xPosition"] / s, "y": c["yPosition"] / s})
return samples

INDEX = os.path.join(os.path.dirname(os.path.abspath(__file__)), "index.html")
HOSTS = {f"127.0.0.1:{args.port}", f"localhost:{args.port}"}

class Handler(BaseHTTPRequestHandler):
def do_GET(self):
u = urlparse(self.path)
if self.headers.get("Host") not in HOSTS: # DNS-rebinding guard
return self._json({"error": "bad Host header"}, 403)
if u.path in ("/", "/index.html"):
with open(INDEX, "rb") as f:
return self._send(f.read(), "text/html; charset=utf-8")
if u.path == "/api/config":
return self._json({"hls": args.hls, "cropAspect": vd["Width"] / vd["Height"],
"frameMs": 1000 * FRAME_RATE["denominator"] / FRAME_RATE["numerator"]})
if u.path == "/api/crop":
q = parse_qs(u.query)
try:
return self._json({"items": query_crop(float(q["startMs"][0]), float(q["endMs"][0]))})
except GaveUp as e:
return self._json({"error": str(e)}, 503)
except Exception as e:
return self._json({"error": str(e)}, 502)
return self._json({"error": "not found"}, 404)

def _json(self, obj, code=200):
self._send(json.dumps(obj).encode(), "application/json", code)

def _send(self, data, ctype, code=200):
self.send_response(code)
self.send_header("Content-Type", ctype)
self.send_header("Content-Length", str(len(data)))
self.end_headers()
self.wfile.write(data)

def log_request(self, code="-", size="-"):
if isinstance(code, int) and code >= 400:
super().log_request(code, size)

print(f"open http://127.0.0.1:{args.port}")
ThreadingHTTPServer(("127.0.0.1", args.port), Handler).serve_forever()
The server listens only on  127.0.0.1 , so it isn't reachable from other machines. It serves only the page and its two API routes, and rejects requests whose  Host  header isn't  127.0.0.1  or  localhost , so another web page can't use it to reach your credentials.

Step 2: Create the page

Save the following as  index.html  in the same folder. It does four things:
  • Plays the stream with the open-source  hls.js  library. It jumps to the live edge on load, rather than starting at the back of the playlist window, and holds the player two segments behind live instead of the default three (lower latency, at a small risk of a brief stall if a segment arrives late).
  • Keeps a clock.  pdtNow()  returns the wall-clock time of the frame on screen, from the playlist's program date time.
  • Polls for crop points over a 20-second window centered on the frame on screen, keeping about 40 seconds of points around it. Each poll starts 4 seconds after the previous one finishes, so a slow or throttled request never stacks up behind another.
  • Draws the box on every animation frame: it interpolates the crop center for the displayed time, then places a full-height box, in the shape of your  SMART_CROP  output, inside the area where the video is actually painted, and marks the crop center point with a blue "+" in a circle. If no point covers the frame on screen, or there's a gap in the points, the box turns amber. Errors appear on a separate red line under the status line.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Smart Crop viewer</title>
<script src="https://cdn.jsdelivr.net/npm/hls.js@1.7.3"></script>
<style>
body { margin: 0; background: #111; color: #ddd; font: 14px system-ui, sans-serif; }
#stage { position: relative; width: 100vw; max-width: 1280px; aspect-ratio: 16/9; margin: 20px auto 8px; }
video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.dim { position: absolute; background: rgba(0,0,0,.55); pointer-events: none; }
#box { position: absolute; border: 2px solid #22d3ee; box-sizing: border-box; pointer-events: none; }
#box.stale { border-color: #fbbf24; }
/* Crop center point: blue "+" inside a blue ring */
#center { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 2px solid #2563eb;
border-radius: 50%; box-sizing: border-box; pointer-events: none; }
#center::before, #center::after { content: ''; position: absolute; left: 50%; top: 50%; background: #2563eb;
transform: translate(-50%, -50%); }
#center::before { width: 12px; height: 2px; }
#center::after { width: 2px; height: 12px; }
#status, #error { max-width: 1280px; margin: 0 auto; font-family: ui-monospace, monospace; font-size: 12px; }
#error { color: #f87171; }
</style>
</head>
<body>
<div id="stage">
<video id="v" muted playsinline></video>
<div class="dim" id="dl"></div><div class="dim" id="dr"></div><div id="box"></div><div id="center"></div>
</div>
<div id="status">starting…</div>
<div id="error"></div>
<script>
const video = document.getElementById('v'), box = document.getElementById('box');
const center = document.getElementById('center');
const dl = document.getElementById('dl'), dr = document.getElementById('dr');
const status = document.getElementById('status'), error = document.getElementById('error');
const POLL_MS = 4000, WINDOW_MS = 20000, RETAIN_MS = 60000;

let offsetMs = null; // PDT(ms) - currentTime*1000; constant within a level
let samples = []; // [{pdtMs, x, y}] sorted by pdtMs

// --- Clock: wall-clock time of the frame on screen, from EXT-X-PROGRAM-DATE-TIME ---
const pdtNow = () => offsetMs === null ? null : video.currentTime * 1000 + offsetMs;
let hlsRef = null;
let frameMs, cropAspect; // frame duration and crop width/height, from the channel via /api/config

async function start() {
const cfg = await (await fetch('/api/config')).json();
({ frameMs = 20, cropAspect } = cfg);
if (!Hls.isSupported()) { status.textContent = 'This browser lacks MSE; use Chrome or Firefox.'; return; }
// Sit 2 segments behind the live edge (hls.js default is 3): lower latency, slightly more stall risk.
const hls = new Hls({ liveDurationInfinity: true, liveSyncDurationCount: 2 });
hlsRef = hls;
hls.loadSource(cfg.hls); hls.attachMedia(video);
hls.on(Hls.Events.MANIFEST_PARSED, () => video.play().catch(() => {}));
// Start near the live edge, not at the start of the playlist window (DVR).
let jumped = false;
hls.on(Hls.Events.LEVEL_UPDATED, () => {
if (jumped || hls.liveSyncPosition == null) return;
jumped = true;
video.currentTime = hls.liveSyncPosition;
offsetMs = null; // re-anchor the clock after the jump
});
hls.on(Hls.Events.ERROR, (_e, d) => { if (d.fatal) error.textContent = 'HLS error: ' + d.details; });
const anchor = () => {
const d = hls.playingDate; if (!d) return;
const next = d.getTime() - video.currentTime * 1000;
if (offsetMs === null || Math.abs(next - offsetMs) > 500) offsetMs = next; // ignore jitter
};
hls.on(Hls.Events.FRAG_CHANGED, anchor);
setInterval(anchor, 1000);
poll();
requestAnimationFrame(draw);
}

// --- Poll: keep the buffer centered on the displayed frame; next poll starts after this one ends ---
async function poll() {
const centerMs = pdtNow() ?? Date.now() - 20000;
try {
const r = await fetch(`/api/crop?startMs=${Math.round(centerMs - WINDOW_MS / 2)}&endMs=${Math.round(centerMs + WINDOW_MS / 2)}`);
const body = await r.json();
if (!r.ok) throw new Error(`HTTP ${r.status}: ${body.error}`);
if (error.textContent.startsWith('crop')) error.textContent = '';
// One entry per frame: key on the frame slot, not the exact timestamp.
const slot = s => Math.round(s.pdtMs / frameMs);
const bySlot = new Map(samples.map(s => [slot(s), s]));
body.items.forEach(s => bySlot.set(slot(s), s));
samples = [...bySlot.values()].sort((a, b) => a.pdtMs - b.pdtMs);
// Keep only samples near the frame on screen, so the buffer can't grow without limit.
const now = pdtNow() ?? samples.at(-1)?.pdtMs;
if (now != null) samples = samples.filter(s => Math.abs(s.pdtMs - now) <= RETAIN_MS / 2);
} catch (e) { error.textContent = 'crop poll failed: ' + e.message; }
setTimeout(poll, POLL_MS);
}

// --- Lookup: interpolate the crop center at the displayed PDT ---
function sampleAt(t) {
const n = samples.length; if (!n) return null;
if (t <= samples[0].pdtMs) return { ...samples[0], stale: t < samples[0].pdtMs - 100 };
if (t >= samples[n - 1].pdtMs) return { ...samples[n - 1], stale: t > samples[n - 1].pdtMs + 100 };
let lo = 0, hi = n - 1;
while (hi - lo > 1) { const m = (lo + hi) >> 1; if (samples[m].pdtMs <= t) lo = m; else hi = m; }
const a = samples[lo], b = samples[hi], f = (t - a.pdtMs) / (b.pdtMs - a.pdtMs || 1);
return { x: a.x + (b.x - a.x) * f, y: a.y + (b.y - a.y) * f, stale: b.pdtMs - a.pdtMs > 3 * frameMs };
}

// --- Where the frame is actually painted inside the <video> element (object-fit: contain) ---
function videoRect() {
const W = video.clientWidth, H = video.clientHeight, w = video.videoWidth, h = video.videoHeight;
if (!w || !h) return { x: 0, y: 0, w: W, h: H };
const s = Math.min(W / w, H / h);
return { x: (W - w * s) / 2, y: (H - h * s) / 2, w: w * s, h: h * s };
}

// --- Draw: full-height crop box at the channel's crop aspect, dimmed either side ---
function draw() {
const t = pdtNow(), pos = sampleAt(t ?? (samples.at(-1)?.pdtMs ?? 0));
if (pos) {
const r = videoRect(), bw = Math.min(r.w, r.h * cropAspect);
const left = Math.max(r.x, Math.min(r.x + pos.x * r.w - bw / 2, r.x + r.w - bw));
Object.assign(box.style, { left: left + 'px', top: r.y + 'px', width: bw + 'px', height: r.h + 'px' });
Object.assign(dl.style, { left: r.x + 'px', top: r.y + 'px', width: (left - r.x) + 'px', height: r.h + 'px' });
Object.assign(dr.style, { left: (left + bw) + 'px', top: r.y + 'px', width: (r.x + r.w - left - bw) + 'px', height: r.h + 'px' });
Object.assign(center.style, { left: (r.x + pos.x * r.w) + 'px', top: (r.y + pos.y * r.h) + 'px' });
box.classList.toggle('stale', pos.stale || t === null);
status.textContent = t === null
? 'no EXT-X-PROGRAM-DATE-TIME in the stream: box shows newest sample, not synced'
: `x ${pos.x.toFixed(3)} y ${pos.y.toFixed(3)} | ${samples.length} samples ` +
`(${samples.length ? ((samples.at(-1).pdtMs - samples[0].pdtMs) / 1000).toFixed(0) : 0}s span) | ` +
`frame time ${new Date(t).toISOString().slice(11, 23)}Z | ` +
`behind playlist edge ${hlsRef && hlsRef.latency != null ? hlsRef.latency.toFixed(1) + 's' : '–'}${pos.stale ? ' | NO SAMPLE FOR THIS FRAME' : ''}`;
}
requestAnimationFrame(draw);
}
start();
</script>
</body>
</html>

Step 3: Run it

With your MediaLive channel and MediaPackage v2 channel running, start the server from the  crop-viewer  folder:
python3 server.py --region <REGION> --channel-id <CHANNEL_ID> --hls "<LANDSCAPE_HLS_URL>"
Replace the placeholders:
  •  <REGION> : the AWS Region of your channel, for example  eu-west-1 .
  •  <CHANNEL_ID> : the ID of your MediaLive channel (the one running Smart Crop).
  •  <LANDSCAPE_HLS_URL> : the HLS playback URL of your MediaPackage v2 origin endpoint for the landscape rendition.
The terminal prints the feed ID, the cropping output name and the frame rate it found. Leave that terminal window open: the server must keep running for as long as you use the viewer. (You stop it when you're finished; see Clean up.)
Open  http://127.0.0.1:8000  in Chrome. Within a few seconds the stream starts and the box appears. It needs the first batch of crop points and the first program date time from the playlist before it can draw.

Read the status line

Field
What it tells you
 x ,  y 
The crop center for the frame on screen, as fractions of the frame width and height. For a full-height 9:16 crop of a 16:9 source,  y  stays at 0.500.
 samples (span) 
How many crop points the page holds, and the time they cover. At 50 frames per second, a full 40-second buffer holds about 2,000 points.
 frame time 
The wall-clock time (UTC) of the frame on screen, from the playlist.
 behind playlist edge 
How far the player is behind the newest segment. With the player held two segments back, this is about two segment lengths.

Latency

The viewer is as close to live as your packaging allows, and the box is in sync at any latency. What you see is the sum of:
  • the segment length in MediaLive (a segment can't be sent until it's complete)
  • encoding, packaging and delivery
  • the player's buffer
On a test channel with 6-second segments in both MediaLive and MediaPackage, and hls.js at its default of three segments behind live, the viewer ran about 42 seconds behind real time. Moving both to 2-second segments and holding the player two segments back brought that to about 22 seconds. Shorter segments mean more requests to MediaPackage and a slightly higher chance of stalls, so choose what suits your demo.
If you use an AI coding assistant such as  Kiro , you can give it these two files as a starting point for your own changes.

Common issues

  • The box is amber and the status line says there's no program date time. The playlist has no  EXT-X-PROGRAM-DATE-TIME  tags. Enable them on the MediaPackage endpoint.
  • The box appears but the video doesn't play, and the status line shows an HLS error. Check that the HLS URL is correct and that the endpoint allows requests from your browser (CORS).
  • The player shows the vertical picture. Your HLS URL carries both renditions. Use an endpoint or manifest that carries only the landscape rendition.
  • The viewer is a long way behind live. If the player starts at the back of a long playlist window, it plays from there. The page jumps to the live edge on load; if you've changed that, check  behind playlist edge .
  • The server stops at startup with a message. It names what's missing: no  SMART_CROP  video description, no Width and Height on it, a frame rate that follows the source (set Framerate control to SPECIFIED), no feed attached, or no cropping output or data endpoint on the feed. Check that Smart Crop is enabled and that you passed the right Region and channel ID.
  • The terminal shows  GET /favicon.ico ... 404 . That's the browser asking for a tab icon, which the viewer doesn't have. It's harmless; the server logs only failed requests.

Clean up

The viewer creates no AWS resources. Stop the server with Ctrl+C and close the page. To remove Smart Crop itself, follow the Clean up section of the article you used to set it up: revert the channel first, then delete the feed.

Conclusion

In this article, you built a two-file viewer that shows Smart Crop working on a live channel: a local Python server that signs the metadata queries, and a page that lines up each crop point with the frame on screen using the playlist's program date time. The same pattern (a signed query on the server and a wall-clock clock in the page) is the base for the demo viewers in the other parts of this series. For more detail, see the  AWS Elemental Inference User Guide .

Next in the series

This article is one of four on Smart Crop. The companion articles cover the same feature for different audiences:
  • Smart Crop with AWS Elemental Inference: the AWS Management Console way: no code, done in the AWS Management Console.
  • Smart Crop with AWS Elemental Inference: the programmatic way: the AWS CLI, Python (Boto3), and AWS CloudFormation.
  • Smart Crop with AWS Elemental Inference: building it with AI (Kiro): let an AI coding assistant build and run it for you.
  • Smart Crop with AWS Elemental Inference: build a live demo viewer (this article): a small web page, built with Python, that plays your channel and draws the crop region over it as it moves.
Smart Crop is the first of the AWS Elemental Inference features this series covers. Each of the others will get the same four articles. Still to come:
  • Event Clipping (coming soon): use the same feed to find the key moments in a live broadcast and turn them into clips automatically.
  • Smart Subtitling (coming soon)
  • Contextual Metadata (coming soon)

Series: Building with AWS Elemental Inference (4 articles)

  1. …
  2. 4
    Smart Crop with AWS Elemental Inference: build a live demo viewer This article
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article