October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Cupertino desk7 min

How to Loop a Prerecorded Video to YouTube Live with FFmpeg on macOS

Loop a local prerecorded file into your YouTube Live event from macOS with FFmpeg’s -stream_loop -1, the event’s RTMPS details, and settings matched to your file and connection.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To loop a local prerecorded video into your own YouTube Live event from a Mac, use FFmpeg’s -stream_loop -1 input option and pace the file with -re. You’ll also need the event’s RTMPS server URL and private stream key from YouTube Studio. This method loops a file you own or are authorized to use; it does not rebroadcast another channel’s YouTube Live stream.

Before you start

You need FFmpeg available in Terminal, a local video file, a YouTube channel eligible to go live, and a reliable upload connection. This guide does not prescribe a macOS installation command: the available instructions do not establish the right installation method for your macOS release or Mac hardware. FFmpeg options and encoders can vary by build, so check the documentation for the version installed on your Mac if an option or encoder is missing.

As an Amazon Associate I earn from qualifying purchases.

  • Have the video file’s path ready. A path in quotation marks, such as "/Users/name/Movies/video.mp4", handles spaces.
  • Check that the file contains the video and audio streams you expect before selecting mapping or copy options.
  • Use content you have the rights to stream. YouTube’s copyright and monetization rules still apply to prerecorded live streams; looping a file does not grant permission to use its contents.

Create the YouTube Live event and get its ingest details

  1. In YouTube Studio, create or select the live event.
  2. Open the event’s Live Control Room stream settings and copy its server URL and stream key.
  3. Use the server URL and key for that specific event in the command below. Treat the key like a password: do not share it in screenshots or logs. If it is exposed, reset it in Live Control Room.
  4. For a custom stream key, check whether resolution is set manually or automatically, and configure it to match the output you plan to send.

YouTube recommends RTMPS for encrypted ingest. Use the RTMPS server URL supplied for the event rather than guessing or copying a URL from another setup. YouTube’s encoder settings guidance covers current protocol and encoding recommendations; its stream key guidance explains managing keys.

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

Run FFmpeg with an infinitely looping input

In Terminal, adapt this illustrative command template. Replace the file path, ingest URL, and stream key with your own values:

#1 Best Overall
Sale
Apple 2025 MacBook Pro Laptop with Apple M5 chip with 10‑core CPU and 10‑core GPU: Built for AI, 14.2-inch Liquid Retina XDR Display, 16GB Unified Memory, 1TB SSD Storage; Space Black
  • SUPERCHARGED BY M5 — The 14-inch MacBook Pro with M5 brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. Featuring all-day battery life and a breathtaking Liquid Retina XDR display with up to 1600 nits peak brightness, it’s pro in every way.*
  • HAPPILY EVER FASTER — Along with its faster CPU and unified memory, M5 features a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR APPLE INTELLIGENCE — Apple Intelligence is the personal intelligence system that helps you write, express yourself, and get things done effortlessly. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.
  • APPS FLY WITH APPLE SILICON — All your favorites, including Microsoft 365 and Adobe Creative Cloud, run lightning fast in macOS.*
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -c:v libx264 -preset veryfast -tune zerolatency 
  -b:v 4500k -maxrate 4500k -bufsize 9000k 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUR_YOUTUBE_INGEST_URL/YOUR_STREAM_KEY"

This is an example, not a tested command or a promise that your FFmpeg build contains libx264. The sample 4.5 Mbps video rate is illustrative, not a universal setting. Choose bitrate and output format for the file, target resolution and frame rate, YouTube guidance, and the upload capacity you can sustain.

Why the loop and pacing options go where they do

-stream_loop -1 means loop the input indefinitely. It is an input option, so place it before the corresponding -i. -re reads the local file at its native rate, pacing it for a live stream. FFmpeg documents -re as equivalent to -readrate 1; do not apply it at a low rate to an actual live capture or network input, where it can cause packet loss. See the FFmpeg documentation.

Rank #2
Sale
Apple 2026 MacBook Pro Laptop with Apple M5 Pro chip with 18-core CPU and 20-core GPU: Built for AI, 16.2-inch Liquid Retina XDR Display, 24GB Unified Memory, 1TB SSD, Wi-Fi 7; Space Black
  • FAST RUNS IN THE FAMILY — The 16-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
  • BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
  • MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.

Make keyframes match the frame rate

The example’s GOP values of 60 frames represent a two-second interval only when the output is 30 fps. At 60 fps, 60 frames is one second; set the GOP and minimum keyframe interval to match your chosen frame rate and a two-second cadence. YouTube recommends a two-second keyframe interval and says not to exceed four seconds. It supports up to 60 fps for RTMP/RTMPS encoder streams.

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

Choose output settings that YouTube and your connection can sustain

Setting Practical choice Important qualification
Transport RTMPS YouTube recommends encrypted RTMPS; use the event’s supplied ingest URL.
Video codec H.264 The sample uses libx264, which may not be present in every FFmpeg build.
Audio codec AAC or MP3 The sample encodes AAC at 128 kbps and 44.1 kHz; check the source audio and destination needs.
Rate control CBR YouTube lists CBR in its RTMP/RTMPS encoder guidance.
Keyframes Every 2 seconds recommended YouTube’s maximum is 4 seconds; frame-based GOP values must reflect output fps.
Bitrate examples 1080p30: 5 Mbps; 720p30: 6 Mbps These are YouTube’s H.264 recommendations accessed in 2026, not guarantees of quality or connectivity.

It can seem counterintuitive that the published 720p30 recommendation is higher than the 1080p30 recommendation. Do not infer a general rule from those two values: use YouTube’s current settings for your chosen resolution and frame rate, then ensure your upload connection can sustain the bitrate with headroom. YouTube’s current encoder settings are the reference for format recommendations.

Rank #3
Sale
Apple 2026 MacBook Pro Laptop with Apple M5 Pro chip with 18-core CPU and 20-core GPU: Built for AI, 16.2-inch Liquid Retina XDR Display, 48GB Unified Memory, 1TB SSD, Wi-Fi 7; Space Black
  • FAST RUNS IN THE FAMILY — The 16-inch MacBook Pro with the M5 Pro or M5 Max chip brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. With all-day battery life, double the starting storage,* and a breathtaking Liquid Retina XDR display, it’s pro in every way.*
  • BUCKLE UP — Along with a next-generation CPU, faster unified memory, and up to 2x faster SSD storage,* M5 Pro and M5 Max feature a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance and on-device training capabilities. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR AI — Apple silicon, and every major component that powers it, is designed to run demanding on-device AI workloads like LLM inference and training. And Apple Intelligence helps you write, express yourself, and get things done effortlessly with groundbreaking privacy protections at every step.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.*
  • MACOS RUNS APPS FAST — All your go-to apps run lightning fast in macOS, including built-in apps like FaceTime and Messages. Plus, built-in virus protection and free software updates help keep your Mac running smoothly and securely.

Decide whether to re-encode or copy the source streams

The example re-encodes video and audio. That makes it easier to control codec, bitrate, and keyframe cadence, but it uses Mac CPU or hardware resources according to the build and settings. If the source already has compatible streams, stream copy may avoid re-encoding; however, copy cannot apply filters and can fail when the target container needs information the source does not contain. For predictable keyframes and broad compatibility, re-encoding is the safer starting point.

Before changing the command, inspect the source file’s actual streams and confirm the installed FFmpeg version supports the requested encoders. If libx264 is unavailable, consult documentation corresponding to that build and choose an encoder it provides; do not assume a particular macOS architecture, FFmpeg package, or encoder configuration.

Rank #4
Apple 2025 MacBook Pro Laptop with Apple M5 chip with 10‑core CPU and 10‑core GPU: Built for AI, 14.2-inch Liquid Retina XDR Display, 24GB Unified Memory, 1TB SSD Storage; Space Black
  • SUPERCHARGED BY M5 — The 14-inch MacBook Pro with M5 brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. Featuring all-day battery life and a breathtaking Liquid Retina XDR display with up to 1600 nits peak brightness, it’s pro in every way.*
  • HAPPILY EVER FASTER — Along with its faster CPU and unified memory, M5 features a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR APPLE INTELLIGENCE — Apple Intelligence is the personal intelligence system that helps you write, express yourself, and get things done effortlessly. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.
  • APPS FLY WITH APPLE SILICON — All your favorites, including Microsoft 365 and Adobe Creative Cloud, run lightning fast in macOS.*

Test, monitor, and end the stream

  1. Start with a private or otherwise appropriate test event if available, using representative motion and audio rather than a still frame alone.
  2. Run the command and monitor YouTube Live Control Room for stream health and warning messages. YouTube recommends testing and monitoring during the event.
  3. Listen for audio problems and watch for dropped frames, stalls, or an ingest error. Confirm the Mac’s upload connection can sustain the selected output.
  4. To stop the encoder, press q in its Terminal window or use Ctrl+C. Confirm in Live Control Room that the event ends as intended.
  5. YouTube says streams under 12 hours are automatically archived when ended. Do not assume the same archive behavior for a stream lasting 12 hours or longer.

Do not close Terminal or put the Mac to sleep while relying on this local workflow; FFmpeg is running on the computer that is sending the stream.

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

Troubleshooting common failures

Symptom Likely cause What to check or change
Unknown encoder 'libx264' or encoder not found The installed FFmpeg build does not include that encoder. Check the build’s available encoders and the documentation for that FFmpeg version. Use a supported encoder or install a build that includes the encoder you need.
YouTube does not receive the stream Wrong event URL or key, key copied incorrectly, or event not ready. Copy the server URL and key again from that event’s Live Control Room. Keep the key private; reset it if exposed.
Stream connects but reports format or ingest problems Output settings do not match the event’s expected configuration, or the source/container combination is incompatible. Use RTMPS, H.264 video, AAC or MP3 audio, CBR, and a supported frame rate. Check the event’s stream settings and YouTube’s current encoder guidance.
Motion stutters or frames drop The selected bitrate exceeds stable upload capacity, or the Mac cannot encode at the chosen settings. Reduce output resolution, frame rate, or bitrate as appropriate; test the connection and encoding load with representative content before the full stream.
Keyframes arrive at an unexpected cadence GOP values were chosen without accounting for frame rate. Calculate the frame count for a two-second interval at the output fps and keep the interval below YouTube’s four-second maximum.
Audio is missing or wrong The source lacks the expected audio stream, or FFmpeg is encoding a different stream than intended. Inspect the file’s audio stream and revise mapping or audio options for that file. Test by listening before the event.
Video plays too quickly or too slowly The file is not being paced as a local file for live output, or a real-time input is being rate-limited incorrectly. For a local file, use -re before the input as shown. Do not use low-rate -re on real live or network input.
It stops after one playback The loop option is missing or placed after the input. Put -stream_loop -1 before the corresponding -i.
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

FFmpeg on a Mac is a do-it-yourself route: the computer and connection must stay available while it sends the file. StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos, not from a camera. Upload a recording or build a playlist, add your YouTube stream key once, and go live; StreamNeo loops it from the cloud.

Best Value
Sale
Apple 2025 MacBook Pro Laptop with Apple M5 chip with 10‑core CPU and 10‑core GPU: Built for AI, 14.2-inch Liquid Retina XDR Display, 16GB Unified Memory, 1TB SSD Storage; Silver
  • SUPERCHARGED BY M5 — The 14-inch MacBook Pro with M5 brings next-generation speed and powerful on-device AI to personal, professional, and creative tasks. Featuring all-day battery life and a breathtaking Liquid Retina XDR display with up to 1600 nits peak brightness, it’s pro in every way.*
  • HAPPILY EVER FASTER — Along with its faster CPU and unified memory, M5 features a more powerful GPU with a Neural Accelerator built into each core, delivering faster AI performance. So you can blaze through demanding workloads at mind-bending speeds.
  • BUILT FOR APPLE INTELLIGENCE — Apple Intelligence is the personal intelligence system that helps you write, express yourself, and get things done effortlessly. With groundbreaking privacy protections, it gives you peace of mind that no one else can access your data — not even Apple.*
  • ALL-DAY BATTERY LIFE — MacBook Pro delivers the same exceptional performance whether it’s running on battery or plugged in.
  • APPS FLY WITH APPLE SILICON — All your favorites, including Microsoft 365 and Adobe Creative Cloud, run lightning fast in macOS.*
  • Nothing has to stay on at home: the stream runs in the cloud, so your computer can be off.
  • One flat price per slot for any quality up to 4K 60fps as uploaded, with no re-encode and no quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card; one free day per account.

Monthly: $9.99 per month. See StreamNeo for the service details, then 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 *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
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.