October 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 ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
continuous streaming

How to Encode and Loop a Video for Continuous YouTube Live Streaming with FFmpeg

A practical FFmpeg setup for looping a local video into YouTube Live, with YouTube ingest settings, network checks, and failure troubleshooting.

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

To loop a local video into YouTube Live, run FFmpeg with real-time input reading and infinite input looping, encode to a YouTube-compatible profile, and publish to the stream URL and key from YouTube Live Control Room. The loop repeats the file; it does not keep the network, FFmpeg process, or YouTube event alive if one of those fails. For a continuous broadcast, test the full route and monitor it.

What the FFmpeg workflow does—and what it does not

There are three separate jobs: FFmpeg reads the local file at its normal playback rate, loops it, then encodes and sends it to YouTube. YouTube receives that feed and transcodes it for viewers; your encoder needs to meet YouTube’s ingestion requirements, not create every viewer playback format.

-stream_loop -1 tells FFmpeg to repeat an input indefinitely, while -re reads it at native frame rate rather than sending the file as fast as the computer can process it. Neither option guarantees an uninterrupted broadcast. The source file, FFmpeg process, network connection, stream key, and YouTube event must all remain usable.

Choose a YouTube ingest profile

Use YouTube’s current encoder settings for the selected codec, resolution, and frame rate rather than copying a bitrate from an unrelated setup. YouTube lists RTMP/RTMPS, H.264, H.265/HEVC, or AV1 video, AAC or MP3 audio, up to 60 fps, and constant bitrate (CBR). It recommends a 2-second keyframe interval and says not to exceed 4 seconds. Use RTMPS when available; YouTube says it encrypts data in transit to and through Google’s servers.

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.
#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.
Profile example Codec YouTube minimum bitrate YouTube recommended bitrate
720p at 30 fps H.264 3 Mbps 8 Mbps
1080p at 30 fps H.264 5 Mbps 14 Mbps
1080p at 60 fps H.264 6 Mbps 17 Mbps
1080p at 30 fps H.265/HEVC or AV1 4 Mbps 10 Mbps
1080p at 60 fps H.265/HEVC or AV1 4 Mbps 12 Mbps

These are YouTube’s published encoder recommendations, not a guarantee of image quality on every source or network route. Select a bitrate your measured upload connection can sustain. The H.264 1080p30 command below uses YouTube’s 14 Mbps recommended video bitrate; audio bitrate is additional to that figure.

Frame rate, keyframes, and picture format

A 2-second keyframe interval means 60 frames at 30 fps or 120 frames at 60 fps. The GOP settings in the example match the 30 fps case; changing the frame rate without changing the GOP changes the interval. For SDR, YouTube’s advanced recommendations include Rec. 709 and 8-bit video. Its other advanced recommendations include square pixels, progressive scan, 2 B-frames, 1 reference frame, and CABAC.

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.

For HDR, YouTube recommends H.265; its guidance says AV1 is not supported for HDR. YouTube’s encoder settings list up to 60 fps. Also consider latency needs: YouTube says 4K/2160p is not eligible for its low-latency optimization and is set to normal latency.

Audio

YouTube accepts AAC or MP3. For stereo, its advanced recommendations include 44.1 kHz and 128 kbps. For 5.1 audio over RTMP/RTMPS, AAC is supported, with 48 kHz and 384 kbps recommended. The example command produces stereo AAC at 44.1 kHz and 128 kbps; confirm that this suits the source and event.

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.

Get the stream destination and protect the key

  1. In YouTube Studio, open Live Control Room and create or select the live stream.
  2. Copy the stream URL and stream key shown for that event. Use the exact destination YouTube provides; do not assume every account or event uses an identical URL format.
  3. Treat the key like a password. Keep it out of public commands, screenshots, logs, and support posts. If it is exposed, reset it in the stream settings and update the encoder.

The command below uses a clearly marked placeholder in place of the real destination and key. Replace it locally with the values from Live Control Room.

Loop and encode a local file with FFmpeg

This is a template for a local file and a 1080p, 30 fps H.264 target. Validate it against your file, installed FFmpeg build, selected YouTube profile, and event destination before relying on it unattended.

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
ffmpeg -re -stream_loop -1 -i "input.mp4" 
  -r 30 -c:v libx264 -preset veryfast -b:v 14M -maxrate 14M -bufsize 28M 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUTUBE_STREAM_URL/STREAM_KEY"

Replace input.mp4 with the local file path and replace the destination placeholder with the exact RTMPS URL and key from your event. Never publish a command containing a live key. In this example, -re and -stream_loop -1 are input-side options placed before -i; codec, rate-control, audio, output format, and destination options follow the input. FFmpeg command-line options generally apply to the next input or output, so ordering matters.

  • -r 30 sets the output frame rate to 30 fps for this target. Check the source and choose an appropriate profile rather than assuming this value suits every video.
  • -b:v 14M and -maxrate 14M set the example video rate to 14 Mbps. -bufsize 28M is twice that rate as an encoder buffer setting; these values do not make an unstable upload connection reliable.
  • -g 60 -keyint_min 60 -sc_threshold 0 set a 60-frame GOP for a two-second interval at 30 fps and prevent scene changes from altering the intended cadence. At 60 fps, use a matching 120-frame interval instead.
  • -preset veryfast trades encoding efficiency for lower CPU demand compared with slower x264 presets. If the machine cannot encode in real time, reduce the workload or use an encoder and profile that your hardware supports.
  • -f flv selects the output container commonly used for RTMP/RTMPS publishing.

The example is not a universal command or a tested guarantee. Check FFmpeg’s output and YouTube’s preview and stream-health messages before starting a public event. If you choose a lower resolution or another codec, select its matching bitrate from YouTube’s current guidance and revise the command accordingly.

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.
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.

When stream copy may work

If the source already has compatible codecs and encoding parameters, FFmpeg stream copy (-c copy) may avoid re-encoding and reduce CPU use. It cannot change resolution, frame rate, bitrate, keyframe cadence, or unsupported codec details. YouTube’s ingest requirements still apply, so do not use stream copy without checking the actual source and confirming the stream health.

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

Prepare the connection and keep watch

  • Measure outbound upload capacity, not download speed. YouTube recommends approximately 20% headroom beyond the total streaming bitrate, and shared Wi-Fi or office traffic can reduce capacity available to the encoder. Account for both feeds if you send primary and backup streams.
  • Prefer a stable connection and test the actual route from the machine that will run FFmpeg. A wired Ethernet connection can avoid some Wi-Fi variability, but does not guarantee enough bandwidth or an uninterrupted stream.
  • Set up the event in advance, start the encoder early, and check the Live Control Room preview before making the broadcast public. Test with representative motion and audio.
  • Monitor both FFmpeg’s process and log output and YouTube’s stream-health messages. Confirm that the video appears on the channel or watch page. If recording a local archive, check that the file continues to grow.
  • If the production has a configured backup encoder, test its failover deliberately—for example, by stopping the primary encoder or disconnecting its Ethernet connection. That test checks the configured backup behavior; it does not establish that one FFmpeg process reconnects or recovers automatically.
  • For unattended operation, arrange a process supervisor or restart policy and alerting appropriate to your operating system and deployment. The command alone supplies no universal restart or zero-interruption guarantee.

Troubleshoot common failures

Symptom Likely cause What to check or do
No preview or YouTube reports no incoming feed Wrong event destination, invalid key, or FFmpeg cannot publish Confirm that the event is live-ready and that the URL and key match Live Control Room. Check FFmpeg’s error output. If the key was exposed, reset it and replace it in the local command.
FFmpeg exits or reports an input error Incorrect file path, unreadable source, or an input issue Check the filename, path, file permissions, and whether the file plays locally. Confirm that the loop option precedes the input it is intended to affect.
Buffering, dropped frames, or poor stream health Insufficient or inconsistent upload capacity, or encoding load Measure available upload during the actual broadcast conditions, preserve YouTube’s recommended headroom, and check CPU load. Lower the target profile or bitrate if the connection cannot sustain it, then test again.
Unexpected keyframe interval GOP length does not match output frame rate Calculate frames per interval: 60 frames for two seconds at 30 fps, 120 at 60 fps. Set the output frame rate explicitly and match the GOP settings.
Image or audio does not match the source Output settings, codec compatibility, or source characteristics differ from the intended profile Review FFmpeg’s stream information and output logs, verify the selected YouTube profile, and test representative picture and sound in the preview before going public.
Stream stops after a disconnect or process failure The loop repeats media but does not supervise the process or repair the network Restore connectivity, restart or supervise FFmpeg as appropriate, and test any configured backup path. Monitor YouTube health after restart; do not assume a single command provides automatic recovery.

Check rights and YouTube suitability

Encoding a file for live delivery does not grant permission to broadcast it. Use material you own or are authorized to stream, including music and other embedded assets, and review YouTube’s applicable copyright and live-streaming rules before scheduling a recurring broadcast. Repeating a file technically is not evidence that a channel meets YouTube’s separate monetization or reused-content requirements; assess those policies independently rather than treating a successful ingest as approval.

Or let it run in the cloud

If you do not want a computer, FFmpeg process, or home connection to stay on, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It loops the uploaded video in the cloud; it does not broadcast from a camera and streams to YouTube only.

  • Nothing has to stay on at home for the cloud loop to keep running.
  • Each slot streams the file as uploaded, up to 4K 60fps, at one flat price per slot, with no re-encode or quality tiers.
  • StreamNeo automatically recovers if YouTube drops the stream.
  • The first day is free with no card; the free day is one per account.
  • Monthly billing is $9.99 per month. Other available billing periods are a day, a week, 6 months, or a year; cancel any time. UPI and cards are accepted in India, and card checkout is available worldwide.

See StreamNeo or its plans, then start the free first day.

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

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
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.