October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
AWS EC2

How to Run an FFmpeg YouTube Live Loop on an AWS Mumbai Instance

A practical guide to running an FFmpeg prerecorded-video loop from AWS Mumbai to YouTube Live, including the command template, stream settings, and monitoring.

By VGSources Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To loop a prerecorded video on YouTube Live from AWS Mumbai, run FFmpeg on an EC2 instance in the ap-south-1 region, read the file at real-time speed, and send the encoder output to the ingest URL and stream key shown in YouTube Studio. The loop uses FFmpeg’s -re and -stream_loop -1 options. AWS’s documented loop example targets IVS, not YouTube, so treat the command below as an adaptation: use YouTube’s current endpoint and settings, then verify the preview before starting the event.

What you need before starting

  • A YouTube channel eligible to go live, with a stream or event created in YouTube Studio.
  • An uploaded video file on the EC2 instance, with rights to stream its video and audio.
  • An Ubuntu EC2 instance in AWS Asia Pacific (Mumbai), region code ap-south-1. [AWS region table]
  • SSH access restricted to your own IP address, or an AWS browser-based access method.
  • Enough CPU, disk, and outbound network capacity for the chosen file and stream settings. There is no universally suitable instance size; measure the actual workload.

AWS uses a t2.micro in an IVS tutorial example, but that is not evidence it can encode every YouTube stream reliably. [AWS IVS tutorial]

Create and secure the Mumbai instance

  1. In the AWS Console, choose the Mumbai region, shown as Asia Pacific (Mumbai), ap-south-1.
  2. Launch an Ubuntu EC2 instance. Select instance capacity based on the source codec, output resolution and frame rate, and whether FFmpeg will encode or simply copy compatible streams. Leave CPU headroom and monitor utilization during a test.
  3. Configure its security group to allow SSH only from your administrator IP address. Security groups act as virtual firewalls for inbound and outbound traffic. Allow outbound access needed to install packages and reach YouTube’s ingest service; do not copy IVS-specific port rules as YouTube requirements. [AWS security groups]
  4. Connect after the instance passes its status checks. AWS documents SSH prerequisites including a permitted source IP, the instance details, and the matching private key; EC2 Instance Connect and Systems Manager Session Manager are browser-based alternatives where configured. [AWS connection guidance]
  5. Install FFmpeg using the Ubuntu package source available to your instance, then confirm it runs with ffmpeg -version. Keep the operating system and packages updated.

Prepare the YouTube Live event and settings

  1. Open YouTube Studio’s Live Control Room and create or select the stream. Copy the server/ingest URL and stream key shown for that configuration. YouTube describes the key as the credential that allows the encoder to send a feed; treat it like a password. [Create a YouTube live stream with an encoder]
  2. Choose RTMPS when YouTube offers it. YouTube recommends RTMPS, which encrypts data to and through Google’s servers. Use the exact server URL displayed in Live Control Room rather than assuming a fixed endpoint format. [YouTube encoder settings]
  3. Select a resolution, frame rate, codec, and bitrate appropriate to the video and your available upload capacity. YouTube’s current encoder settings list RTMP/RTMPS, H.264, H.265 (HEVC) or AV1 video, up to 60 fps, AAC or MP3 audio, and CBR encoding. Its recommended H.264 video bitrates include 6 Mbps for 720p30, 8 Mbps for 720p60, 10 Mbps for 1080p30, and 17 Mbps for 1080p60. Check the full live table when configuring because recommendations can change. [YouTube encoder settings]
  4. Set a two-second keyframe interval; YouTube says not to exceed four seconds. For SDR, YouTube recommends Rec. 709, progressive scan, and square pixels. It also recommends stereo audio at 44.1 kHz and 128 Kbps. Match the source where forcing a setting would distort or unnecessarily alter it. [YouTube encoder settings]

Run the FFmpeg loop

First place the video on the instance and set VIDEO to its full path. The following is a template for 720p30-class H.264 output, not a command independently tested against YouTube. It uses YouTube’s listed H.264 recommendation of 6 Mbps for 720p30, with a two-second GOP at 30 fps. Replace the ingest placeholder with the exact URL and key format shown in Live Control Room; do not publish or commit real credentials.

VIDEO="/path/to/video.mp4"
INGEST="<YouTube RTMPS server URL and stream key in the format shown in Live Control Room>"
ffmpeg -re -stream_loop -1 -i "$VIDEO" 
  -c:v libx264 -preset veryfast -pix_fmt yuv420p 
  -r 30 -g 60 -b:v 6000k -maxrate 6000k -bufsize 12000k 
  -c:a aac -b:a 128k -ar 44100 -ac 2 
  -f flv "$INGEST"

The loop flags follow an AWS FFmpeg example: -re paces the input in real time, while -stream_loop -1 repeats the input indefinitely. AWS’s example sends to IVS; substituting YouTube’s endpoint and compatible settings is an adaptation, not a YouTube-specific AWS recipe. [AWS FFmpeg example]

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

This template re-encodes video with H.264 and audio with AAC. If the input already has compatible codecs and settings, stream-copying may reduce CPU use, but only use it after confirming the file’s codecs, frame rate, resolution, pixel format, and audio match the selected YouTube output. A mismatch can cause ingest rejection or poor playback. If you change the frame rate, keyframe interval, or resolution, recalculate the keyframe cadence and choose bitrate from YouTube’s current table rather than keeping these example values.

Verify the preview, start, and monitor the broadcast

  1. Start FFmpeg and watch its terminal output for connection errors, encoder errors, or repeated reconnects.
  2. Wait for the YouTube Live Control Room preview. Confirm that the picture moves, audio is audible and in sync, and stream health has no relevant warning before starting the event as its settings require.
  3. Test a representative segment and observe the stream through at least one loop boundary. Check that playback returns cleanly to the start without a gap or unwanted audio change.
  4. Monitor YouTube’s stream health and messages while live, and monitor the EC2 instance’s CPU, memory, disk space, and network behavior.
  5. To end the feed, stop FFmpeg from sending content, then end the event in Live Control Room if required by its configuration. YouTube’s encoder workflow says, “To end the stream, stop sending content from your encoder.” [YouTube encoder workflow]

Plan for unattended and long-running streams

An EC2 process only keeps running while the instance and FFmpeg process remain available. For unattended use, arrange process supervision and instance restart behavior, and decide how you will be alerted if FFmpeg exits or the stream loses its connection. A shell session alone is not a robust recovery plan. Avoid putting a stream key in a public script, repository, screenshot, or shell transcript; if exposed, replace it in Live Control Room.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

YouTube says streams under 12 hours are automatically archived. The cited guidance does not establish what happens for longer continuous broadcasts, so confirm current duration limits, archive behavior, live eligibility, and event lifecycle rules before designing a continuous loop. [YouTube encoder workflow]

Repeated or unattended playback does not grant rights to the material or guarantee policy compliance. Use content you own or are licensed to stream, including music and other embedded audio, and check YouTube’s current copyright and reused-content policies. A loop can still be subject to claims or restrictions even when it is technically valid as an encoder feed.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.

Troubleshooting

Symptom Likely cause What to check or do
YouTube does not show a preview Wrong server URL or key, FFmpeg has not connected, or outbound access is blocked. Copy the current URL and key from the selected Live Control Room stream, check FFmpeg’s output, and confirm outbound connectivity. Keep the key private.
Connection works but stream health reports issues Bitrate, codec, keyframes, frame rate, or available upload capacity does not fit the selected output. Compare the encoder settings with YouTube’s current table; use CBR and a two-second keyframe interval, and check the EC2 network and CPU headroom.
Video stutters or FFmpeg falls behind The instance may not encode the selected resolution and frame rate in real time. Inspect CPU utilization and FFmpeg output. Test a lower output resolution or frame rate, or choose more compute capacity. Do not assume the tutorial’s example instance size is sufficient.
Audio is missing, distorted, or out of sync Unsupported or mismatched source audio, channel layout, sample rate, or an issue at the file’s loop boundary. Inspect the source with FFmpeg, verify AAC or MP3 compatibility, and test stereo 44.1 kHz output at the loop boundary.
The stream stops after an SSH disconnect or process error FFmpeg was tied to the interactive shell, the process exited, or the instance stopped. Use a process manager or service supervisor suitable for your setup, configure instance restart and monitoring, and test recovery before relying on the stream.
The archive is missing or the event ends unexpectedly Event lifecycle or duration behavior may differ for a long broadcast. Check current YouTube event settings and documentation; the documented automatic archive statement covers streams under 12 hours, not longer runs.

Cost considerations

AWS cost depends on instance type, operating system, storage, runtime, and network transfer. No verified Mumbai price or instance-size recommendation is established here; check AWS’s current pricing for the region and configuration before leaving a stream online continuously. Also account for the video file’s storage and any monitoring or restart setup you add.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Or let it run in the cloud

If your aim is simply to keep a prerecorded video looping on YouTube Live, StreamNeo is an alternative to managing an EC2 instance and FFmpeg process. Upload a recording or build a playlist, add your YouTube stream key once, and go live; StreamNeo runs the loop in the cloud, so your computer and home connection do not need to stay on.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
  • One flat price per slot for any uploaded quality up to 4K 60fps, without re-encoding or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card required; one free day per account.
  • Each slot includes 10 GB of storage, pooled across active slots, plus 24/7 looping, playlists, and StreamNeo team support.

Monthly plan: $9.99 per month. Visit StreamNeo for details, or start the free day.

Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from Patch Notes

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.