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

To loop a local video into YouTube Live, use FFmpeg’s -stream_loop -1 to repeat the input, -re to read it at its normal pace, and an output profile that matches YouTube’s current ingest guidance. The loop repeats the file; it does not keep a dropped connection, crashed process, or failed YouTube event alive. For unattended streaming, test the full setup and provide separate monitoring and restart handling.

What continuous streaming with FFmpeg actually requires

A continuous YouTube stream has three separate jobs: read and repeat the source video, encode it to a compatible live-stream profile, and keep the process and network operating. FFmpeg can loop the file and encode it, but the machine running FFmpeg, the connection, the source file, the stream key, and the YouTube live event remain dependencies.

YouTube transcodes incoming live video for viewers. Set FFmpeg for YouTube’s ingest requirements and your source and upload capacity; you do not need to pre-encode every playback format YouTube may deliver.

Choose the YouTube ingest settings

Use YouTube’s current encoder guidance rather than copying a bitrate from a command written for a different resolution, frame rate, or codec. The recommendations below are platform settings, not a guarantee of picture quality on every source or network. See YouTube’s encoder settings, bitrates, and resolutions.

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.

Protocol, codec, and video format

  • Protocol: RTMP or RTMPS. YouTube recommends RTMPS, which encrypts data in transit to and through Google’s servers. Use the exact stream URL shown for your event in Live Control Room.
  • Video codec: H.264, H.265/HEVC, or AV1; YouTube’s guidance supports up to 60 fps. Encoder support varies by FFmpeg build and hardware, so confirm the encoder is available before using a codec other than H.264.
  • Bitrate mode: CBR (constant bitrate).
  • Keyframes: every 2 seconds is recommended; do not exceed 4 seconds.
  • SDR: Rec. 709, 8-bit is the recommended profile. For HDR, YouTube recommends H.265; its guidance does not support AV1 for HDR.
  • Advanced video settings: YouTube also recommends square pixels, progressive scan, 2 B-frames, 1 reference frame, and CABAC where applicable.

Audio

YouTube accepts AAC or MP3 audio. For stereo, its advanced recommendations specify AAC at 44.1 kHz and 128 kbps. For 5.1 audio over RTMP/RTMPS, use AAC; the recommended settings are 48 kHz and 384 kbps. Make sure the selected audio settings match the actual source channels.

Choose a bitrate for the actual profile

For H.264, YouTube’s published table gives the following minimum and recommended video bitrates. H.265/HEVC and AV1 have different recommendations, so do not apply H.264 values to those codecs.

Video profile H.264 minimum H.264 recommended H.265/AV1 minimum H.265/AV1 recommended
720p at 30 fps 3 Mbps 8 Mbps not stated in the cited YouTube encoder settings table for this comparison not stated in the cited YouTube encoder settings table for this comparison
1080p at 30 fps 5 Mbps 14 Mbps 4 Mbps 10 Mbps
1080p at 60 fps 6 Mbps 17 Mbps 4 Mbps 12 Mbps

The values are YouTube’s current recommendations; select the row for the codec, resolution, and frame rate you are actually sending. If your upload cannot sustain the recommended bitrate with headroom, choose a lower profile that it can support reliably rather than configuring a bitrate the connection cannot maintain.

Get the event URL and protect the stream key

Create or select the YouTube Live event in Live Control Room, then copy the stream URL and stream key displayed for that event. Do not substitute an example URL or assume the URL format: use the destination YouTube provides. Treat the key like a password. Keep it out of public scripts, screenshots, and logs; if it is exposed, reset it in the live stream settings.

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

Build an FFmpeg loop command

This template is for a local file, H.264 at 1080p30, and a 14 Mbps video bitrate when the connection can sustain it. It is an example, not a tested universal command: validate it with your file, installed FFmpeg build, selected YouTube profile, and the stream URL from Live Control Room. Replace the destination placeholders privately; never publish a real stream key.

ffmpeg -re -stream_loop -1 -i "input.mp4" 
  -c:v libx264 -preset veryfast -b:v 14M -maxrate 14M -bufsize 28M 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "RTMPS_URL_FROM_LIVE_CONTROL_ROOM/STREAM_KEY"

Why these options and their order matter

  • -re reads the input at its native frame rate rather than sending a file as fast as the computer can read it. -stream_loop -1 loops the input indefinitely. Both are input options and appear before -i.
  • -i "input.mp4" is the local source. Replace it with the correct file path.
  • -c:v libx264 selects FFmpeg’s H.264 software encoder. -preset veryfast trades compression efficiency for lower encoding work; if the machine cannot encode in real time, reduce the workload or use a supported hardware encoder and validate its output profile.
  • -b:v 14M and -maxrate 14M set the target and maximum video rate in this example; -bufsize 28M is a two-second rate-control buffer at that rate. This matches YouTube’s H.264 1080p30 recommended video bitrate only if your source and connection can support that profile.
  • -r 30 sets the output frame rate to 30 fps. -g 60 and -keyint_min 60 request a 60-frame keyframe interval, which is 2 seconds at 30 fps; -sc_threshold 0 disables scene-cut keyframes so the interval remains regular. If you change frame rate, recalculate the GOP length: at 60 fps, 120 frames gives a 2-second interval.
  • -c:a aac -b:a 128k -ar 44100 encodes stereo-oriented AAC audio at the recommended 128 kbps and 44.1 kHz settings. Confirm the input has the audio you expect.
  • -f flv selects the output format used for RTMP/RTMPS publishing. FFmpeg options generally apply to the next input or output, so keep input options before the input and output encoding options before the destination URL. See the FFmpeg command-line documentation and FFmpeg documentation.

Adjusting resolution, frame rate, or bitrate

The template does not scale the picture to a chosen resolution. If the file’s dimensions or frame rate do not match the profile you intend to send, inspect the source and add deliberate scaling or frame-rate conversion as needed; converting can affect quality and processing load. Keep output resolution and frame rate within YouTube’s supported profile, use the corresponding codec-specific bitrate guidance, and set the keyframe interval in seconds rather than copying a frame count from a different frame rate.

At 1080p60 H.264, for example, YouTube recommends 17 Mbps and a 2-second keyframe interval corresponds to 120 frames. Do not use the 1080p30 example’s 60-frame GOP unchanged at 60 fps, because that would make the interval one second.

Can stream copy avoid encoding?

Possibly, if the source already has compatible video and audio codecs and satisfies YouTube’s ingest profile. FFmpeg’s -c copy avoids re-encoding, which can reduce CPU use, but it cannot change resolution, frame rate, bitrate, keyframe cadence, or incompatible codec details. Check the source properties and the resulting stream health before relying on stream copy; it is not a safe default for an arbitrary file.

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

Check upload capacity before going live

YouTube recommends roughly 20% upload-bandwidth headroom above the total streaming bitrate. For one stream, compare the measured sustained outbound capacity with the combined video and audio bitrate, not with download speed. Shared Wi-Fi, office traffic, or other streams can reduce the bandwidth available to FFmpeg. For primary and backup streams sent simultaneously, account for both streams. YouTube’s streaming tips note that the total bitrate cannot exceed available upload bandwidth.

  • Measure upload performance on the connection and route the encoder will use; a speed-test result is not a guarantee that capacity will remain available during the event.
  • Prefer a stable wired connection when practical. An Ethernet cable can avoid some Wi-Fi variability, but it cannot guarantee sufficient bandwidth or prevent an upstream outage.
  • If the connection is constrained, reduce resolution, frame rate, or bitrate together as appropriate, then repeat the full test.

Test and monitor the continuous stream

Set up the event in advance and test with a representative segment that includes the motion and audio of the real program. YouTube’s guidance is direct: “Make sure to test before you start your live stream.” Check both YouTube’s preview and stream-health messages before making the stream public.

  1. Start the event setup in Live Control Room and confirm the selected stream URL and key.
  2. Run FFmpeg before the intended public start. Check its console output for connection errors, encoder failures, and repeated warnings.
  3. Inspect the Live Control Room preview and stream-health status. Confirm that the picture, motion, audio, resolution, and frame rate are as expected.
  4. Verify playback on the channel or event watch page. If recording an archive locally as part of your setup, verify that the archive file continues to grow.
  5. For a production that depends on backup or failover, deliberately test that procedure. YouTube suggests stopping the primary encoder or disconnecting its Ethernet for a failover test; a single FFmpeg process does not thereby gain automatic failover.

For unattended operation, arrange process supervision, restart policy, and alerting outside this example command. The right implementation depends on your operating system and deployment; there is no universal restart command that guarantees zero interruption.

Latency and HDR trade-offs

Choose latency based on how viewers will use the stream: lower latency can matter for audience interaction, while normal latency may suit a program that prioritizes a less interactive viewing experience. YouTube notes that 4K/2160p is not eligible for its low-latency optimization and is set to normal latency. For HDR, follow YouTube’s H.265 guidance rather than assuming an SDR H.264 or AV1 command is suitable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common FFmpeg and YouTube Live problems

FFmpeg says it cannot connect

Check that the event is active and that you copied its current stream URL and key accurately. Confirm the machine can reach the destination, the RTMPS URL is exactly the one provided by Live Control Room, and no firewall or network policy is blocking the connection. Reset the key if you suspect it was exposed.

YouTube reports poor stream health or dropped frames

Compare the outbound bitrate with sustained upload capacity and retain YouTube’s recommended headroom. Check for network sharing or Wi-Fi variation, then lower the sending profile if necessary and test again. A resolution or bitrate that is technically valid can still fail on an unstable or undersized connection.

Keyframes are too far apart or irregular

Check the output frame rate and GOP together. A GOP of 60 frames is a 2-second interval at 30 fps, not at 60 fps; use 120 frames at 60 fps for the same interval. Confirm the encoder is actually producing the requested cadence.

The video or audio does not match the intended profile

Inspect the source’s codec, dimensions, frame rate, pixel format, and audio channels. The command’s output settings and the event’s ingest profile must agree. Stream copy will not repair a mismatch; explicitly encode or convert the properties that need changing.

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.

The stream stops when the file reaches its end

Confirm -stream_loop -1 is placed before -i and that the input file can be read. This option repeats the input while the FFmpeg process is running; it does not restart FFmpeg if the process exits, restore a broken network route, or guarantee that YouTube reconnects.

The stream drops and does not resume

Looping is not reconnection logic. Check FFmpeg’s logs and YouTube’s stream-health messages, then restart or recover the publishing process using a tested supervisor or operational procedure. If the stream is business-critical, test a separate encoder or configured failover path rather than assuming one process can recover from every failure.

Or let it run in the cloud

If maintaining a computer, network, and FFmpeg process at home is the part you want to avoid, 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. Nothing has to stay on at home; it plays uploads rather than broadcasting a live camera.

  • One flat price per slot for the uploaded quality, up to 4K 60fps, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream; this does not remove the need to choose suitable content and protect your stream key.
  • The first day is free, with no card required. The Monthly plan is $9.99 per month.

Start your free StreamNeo 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.

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