Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
DocumentaryTube
AWS EC2

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

Use FFmpeg on an Ubuntu EC2 instance in AWS Mumbai to loop a prerecorded video to YouTube Live, with secure setup, recommended settings and testing steps.

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

You can loop a prerecorded video into a YouTube Live broadcast from an Ubuntu EC2 instance in AWS’s Mumbai region, ap-south-1. The basic pattern is to have FFmpeg read the file in real time with -re, repeat it with -stream_loop -1, and send the output to the RTMPS ingest URL and stream key shown in YouTube Live Control Room. The loop flags are a documented FFmpeg pattern; the AWS example they come from targets IVS, not YouTube, so treat the command below as a template and verify it in YouTube’s preview before starting the event.

What you need before starting

  • An AWS account and an Ubuntu EC2 instance in Asia Pacific (Mumbai), region code ap-south-1. AWS lists its regions and codes.
  • A video file accessible on the instance, with enough disk space to store it.
  • A YouTube channel eligible to create a live stream, and access to YouTube Studio’s Live Control Room.
  • An SSH client and the instance’s private key, or a browser-based access method such as EC2 Instance Connect or Systems Manager Session Manager. AWS says SSH requires passing instance status checks and a security group that permits SSH from your IP address. See AWS’s Linux SSH guidance.

Create and secure the Mumbai instance

  1. In the AWS console, choose region Asia Pacific (Mumbai) (ap-south-1) and launch an Ubuntu EC2 instance. Select instance capacity based on the source file’s codec, target resolution and frame rate, and whether you will encode or copy the video. Do not assume a small tutorial instance is sufficient for your workload; check CPU use during a representative test and leave headroom.
  2. Configure the security group as a virtual firewall. Limit inbound SSH access to your administrator IP rather than opening it to all addresses. Permit the outbound access the instance needs to install packages and reach the YouTube ingest endpoint. The port rules in AWS’s IVS tutorial are for IVS; they are not YouTube requirements. AWS explains security-group rules here.
  3. Connect after the instance passes status checks. Use the correct public address or configured connection method and the matching private key. If SSH fails, check the instance state, status checks, security-group source address, network route, username and key permissions.

Install FFmpeg and make the video available

On Ubuntu, update package metadata and install FFmpeg:

sudo apt update
sudo apt install ffmpeg

Check that the binary is available:

ffmpeg -version

Upload the video to the instance using a secure transfer method, or retrieve it from storage you control. Confirm its path and inspect its streams before broadcasting:

ffprobe -hide_banner "/path/to/video.mp4"

Note the video’s resolution, frame rate, codec and audio format. Those properties affect whether you can copy streams without re-encoding or need to encode them to a YouTube-compatible output. Ensure the file has usable audio if the broadcast is meant to include sound.

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.

Create the YouTube Live event and protect its key

  1. Open YouTube Studio and go to Create → Go live to enter Live Control Room. Create or select the stream/event you intend to broadcast.
  2. Copy the server/ingest URL and stream key displayed for that event. YouTube describes the key as the credential that lets an encoder send video to the channel; treat it like a password. YouTube’s encoder workflow explains creating a live stream.
  3. Use the RTMPS server destination offered in the current Live Control Room. YouTube recommends RTMPS, a secure extension to RTMP, and says it encrypts data to and through Google’s servers. Do not assume a URL format from an old example: use the exact URL and key arrangement shown for your event. YouTube’s current encoder settings and recommendations.
  4. Keep the key out of public scripts, source-control repositories, screenshots and shared terminal transcripts. Avoid placing it directly in a shell command that may be saved in history. If it is exposed, replace or reset it in Live Control Room before broadcasting.

Choose an output profile before building the command

YouTube’s encoder guidance lists RTMP/RTMPS transport, H.264, H.265 (HEVC) or AV1 video, AAC or MP3 audio, and frame rates up to 60 fps. It recommends constant bitrate (CBR), a two-second keyframe interval, and says not to exceed four seconds. Its recommended bitrate depends on codec, resolution and frame rate, so choose the target first rather than copying a bitrate from an unrelated setup.

H.264 output YouTube-recommended video bitrate
720p at 30 fps 6 Mbps
720p at 60 fps 8 Mbps
1080p at 30 fps 10 Mbps
1080p at 60 fps 17 Mbps

These are YouTube’s displayed H.264 recommendations, not measurements of what a particular EC2 instance can encode. Consult the full, current table for other codecs and output modes before choosing. A higher resolution or frame rate can require more CPU when encoding and more sustained network bandwidth.

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.
  • Video: H.264 is a broadly practical choice for an FFmpeg example. Use square pixels, progressive scan and Rec. 709 for SDR where appropriate; avoid forcing a conversion that changes the source’s appearance.
  • Keyframes: For 30 fps, a two-second interval corresponds to 60 frames, hence -g 60. At a different frame rate, adjust the GOP to preserve the interval.
  • Audio: YouTube recommends stereo at 44.1 kHz and 128 Kbps. Match the source and intended output; if converting, check that the source has an audio stream and listen to the result.
  • Network: The instance must sustain the selected video and audio bitrate to the ingest endpoint. Check stream health in Live Control Room rather than treating a successful FFmpeg start as proof of a stable stream.

Run the loop with FFmpeg

The flags -re -stream_loop -1 -i pace the input in real time and repeat a file continuously. AWS documents this pattern in an FFmpeg example for IVS; adapting the loop to YouTube requires YouTube’s own current ingest URL, key and compatible settings. The following is a proposed H.264 720p30-class template, not a command independently tested against YouTube. It uses YouTube’s 6 Mbps H.264 recommendation for 720p30:

VIDEO="/path/to/video.mp4"
# Set INGEST securely to the exact RTMPS destination and key format
# shown in your current YouTube Live Control Room.
INGEST="<YouTube RTMPS ingest URL and stream key>"

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"

Replace the placeholder with the exact ingest destination and credential arrangement YouTube currently shows; do not publish a real key. The command encodes video and audio, so verify the instance can maintain real-time encoding. If the source already matches your intended output, stream-copying may reduce CPU load, but only use that approach when the source codecs, timestamps, pixel format and container are accepted by the selected ingest workflow. Re-encoding offers more control but uses compute. Test either approach with your actual file.

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.

To stop FFmpeg, send an interrupt in the terminal (usually Ctrl+C). YouTube’s encoder workflow says to end a stream by stopping content from the encoder; the event’s settings determine the next steps in Live Control Room.

Test, start and monitor the broadcast

  1. Start FFmpeg and watch its output for connection errors, encoder failures, timestamp warnings or a frame rate that falls behind real time.
  2. In Live Control Room, wait for YouTube’s preview and check that the picture and audio are present and that the stream health indicators do not show a problem.
  3. Start the event in Live Control Room when the preview and event settings are ready. Test a representative portion of the video and, for a loop, observe the transition at the file boundary for gaps, abrupt audio changes or failed reconnects.
  4. Continue monitoring FFmpeg and YouTube stream health. A process can remain running while the ingest connection or encoded output is unhealthy.

Plan for long broadcasts, rights and archives

YouTube’s encoder workflow says streams shorter than 12 hours are automatically archived. The cited guidance does not establish what happens for a longer continuous broadcast, so verify YouTube’s current duration limits and archive behavior before relying on an unattended event. Plan how the Live Control Room event will be ended or restarted if your stream approaches a service limit.

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

A prerecorded video still has to comply with YouTube’s rules. Confirm that you own or have permission to use the video, music, images and other included material for a live broadcast and any resulting archive. Repeated playback does not grant rights, and an unattended loop should not be treated as exempt from copyright or channel policies. Check current live eligibility and policies for your channel and content before leaving a stream running.

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

Troubleshoot common failures

Symptom Likely cause What to check
SSH connection times out Instance not reachable, status checks failing, or SSH ingress not allowed from your current IP Confirm instance status checks, public addressing or network route, security-group source IP, and that you are using the correct key and login details.
FFmpeg cannot open the file Wrong path, missing upload, or insufficient file permissions Check the path with ls, confirm the file arrived, and run ffprobe against that exact file.
Live Control Room never receives a signal Wrong event key or server URL, malformed destination, blocked egress, or expired/replaced key Copy the current event’s URL and key again, check outbound connectivity and FFmpeg’s connection messages, and keep the credential private.
Preview appears but stream health is poor Insufficient CPU for encoding, unstable outbound bandwidth, or bitrate/profile mismatch Check FFmpeg’s speed and CPU use, test a lower YouTube-recommended output profile, and confirm sustained network capacity.
Audio is missing or distorted Source has no audio stream or conversion does not match the source Inspect streams with ffprobe; review audio mapping and sample rate, then listen to the preview before starting.
Loop boundary glitches or the stream stops Source timestamps, encoder behavior or ingest connection interruption Test multiple loop boundaries, inspect FFmpeg logs, and check YouTube stream health. Make sure the file itself ends cleanly.

Estimate the AWS cost before leaving it on

There is no single Mumbai-instance cost for this workflow: the total depends on instance type, operating system, disk, runtime and network transfer. Check current AWS pricing for the exact region and configuration you plan to run, including whether your instance or storage continues billing while the stream is idle or stopped. Do not infer a suitable instance size or total from a tutorial example; measure the workload and compare the cost of the required always-on capacity.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Or let it run in the cloud

If your goal is simply to keep a prerecorded YouTube channel live, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; the stream runs from the cloud, with automatic recovery if YouTube drops it. Uploaded video streams as made, up to 4K 60fps, at one flat price per slot. The first day is free with no card.

Monthly access is $9.99 per month. Learn about StreamNeo or start the free day.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

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 the Screening Room

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

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.