October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
FFmpeg

How to Stream Prerecorded Videos to YouTube 24/7 with FFmpeg on Linux

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

To loop a prerecorded video on YouTube Live, create an encoder stream in YouTube Studio, copy its stream URL and stream key, then run FFmpeg on Linux with -re for real-time playback and -stream_loop -1 for an infinite input loop. You still need a machine, network connection and supervised FFmpeg process that can keep running; the loop alone does not guarantee 24/7 uptime.

What you need before you start

  • A YouTube channel that can create live streams, plus access to YouTube Studio’s Live Control Room.
  • A Linux host with an FFmpeg build that includes the input support, video encoder and output protocol you plan to use. Distribution packages differ, so do not assume every build includes libx264 or RTMPS support.
  • A prerecorded video file that FFmpeg can read, and an internet connection with sustained upload capacity for your selected output bitrate.
  • Enough CPU capacity if FFmpeg must encode or resize the video. No universal Linux hardware specification is established for this workflow; test your own host under the settings you intend to use.

Check the installed build before relying on a command: ffmpeg -version shows build information, and ffmpeg -encoders lists available encoders. If the command below reports that libx264 is unavailable, use a build that includes it or adapt the encoder settings to one your build supports.

Create the YouTube encoder stream

  1. In YouTube Studio, select Create > Go Live. Create a stream or schedule one from the Manage tab in Live Control Room.
  2. Open the stream’s Stream settings and copy the stream URL and selected stream key. Use the exact ingest URL YouTube shows for that stream; prefer its RTMPS URL when your FFmpeg build supports it.
  3. Keep the key private. YouTube describes stream keys as password-like credentials: someone who obtains yours may be able to send a feed to your stream. Do not publish it in scripts, terminal screenshots, logs or process listings. If it is exposed, reset it in Live Control Room.
  4. Review the stream settings, including auto-start and auto-stop if you intend to use them. A scheduled stream can appear as upcoming and may let viewers opt in to reminders; interface behavior can change.

YouTube’s Live Control Room provides the encoder URL and key. RTMPS is RTMP over TLS/SSL, which encrypts the encoder-to-YouTube connection. These setup and security details are documented in YouTube Help’s live-stream settings guidance, accessed October 3, 2026.

Choose compatible output settings

Match the codec, resolution, frame rate, bitrate and keyframe interval to YouTube’s current encoder settings table and to what your source and Linux host can sustain. YouTube’s published H.264 bitrate guidance, accessed October 3, 2026, includes these examples:

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.
Output format YouTube H.264 guidance
720p at 30 fps 3 Mbps minimum; 8 Mbps recommended
1080p at 30 fps 5 Mbps minimum; 14 Mbps recommended
1080p at 60 fps 6 Mbps minimum; 17 Mbps recommended
1440p at 30 fps 7 Mbps minimum; 21 Mbps recommended
2160p (4K) at 30 fps 11 Mbps minimum; 42 Mbps recommended

These are YouTube’s ingest recommendations, not a guarantee of viewer quality or proof that your connection can sustain the rate. The figures vary by codec, resolution and frame rate; consult YouTube’s current table for the format you actually plan to send. Leave upload headroom rather than setting the stream at the full measured capacity of your connection.

  • YouTube lists H.264, H.265/HEVC and AV1 as RTMP/RTMPS video codec options, supports frame rates up to 60 fps, and lists AAC or MP3 for audio.
  • YouTube calls for constant bitrate encoding and recommends a 2-second keyframe interval, advising not to exceed 4 seconds.
  • The example command below uses H.264, AAC and 30 fps. Its 6 Mbps video bitrate is above YouTube’s stated H.264 minimum for 1080p30, but below the listed 14 Mbps recommendation. It is an example, not the recommended 1080p30 setting.

Loop one video with FFmpeg

Replace the input path and output endpoint in this template with your actual file and the ingest URL and key from Live Control Room. This is a template, not a tested command. It assumes the input can be decoded and the FFmpeg build includes libx264 and RTMPS support. It resizes the picture to fit inside a 1920-by-1080 frame, adding bars if the source has a different aspect ratio.

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.
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -map 0:v:0 -map 0:a:0? 
  -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2" 
  -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 
  -f flv "rtmps://INGEST_HOST/APP/STREAM_KEY"

The angle-bracket-free endpoint text is still a placeholder: copy the full URL shown for your stream and insert the key using a protected method. Do not paste a real key into a public example or commit it to a shared script. Restrict access to any file that contains credentials; YouTube’s instruction to treat the key like a password is the reason for this precaution.

What the important options do

  • -re reads a file at its native real-time rate instead of sending it as fast as FFmpeg can process it.
  • -stream_loop -1 is an input option that loops the input indefinitely. Keep it before the corresponding -i; FFmpeg documents -1 as infinite looping.
  • -map 0:v:0 selects the first video stream. -map 0:a:0? selects the first audio stream if one exists; the question mark makes that map optional.
  • -vf scales the picture to fit a 1080p canvas without stretching it. If you do not want to resize, remove this filter and ensure the output dimensions and bitrate suit the actual source.
  • -r 30 sets the output to 30 fps. -g 60 sets a 60-frame GOP, corresponding to a 2-second keyframe interval at 30 fps.
  • -b:v and -maxrate set the example video bitrate and ceiling; -bufsize configures the rate-control buffer. Change these together to match the target YouTube recommendation and your connection.
  • -c:a aac -b:a 128k -ar 44100 encodes audio as AAC at the shown bitrate and sample rate. If the source has no audio, the optional map means FFmpeg can proceed without an audio stream; verify the resulting preview is acceptable.
  • -f flv selects the output container used for the RTMP/RTMPS feed. The URL must be the exact endpoint associated with your YouTube stream key.

For a 1080p30 H.264 output using YouTube’s listed recommendation, change the video bitrate values to 14 Mbps only if your host and sustained upload capacity can support it. Confirm the complete settings against YouTube’s current table and the stream’s Live Control Room configuration.

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.

Start the feed and verify it in YouTube Studio

  1. Run the command on the Linux host. Watch FFmpeg’s output for input, encoder, connection or authentication errors.
  2. In Live Control Room, check that YouTube receives the feed and inspect the preview and stream health. Confirm that both video and audio are present and playing as intended.
  3. Start or confirm the broadcast in Live Control Room as appropriate for the stream’s settings. Do not announce the stream until you have tested the full path.
  4. Monitor the stream after it starts. YouTube advises testing before going live and checking audio, video and stream health; encoder output alone does not establish that viewers are receiving a healthy broadcast.

If you scheduled the stream, check how its scheduled start and any auto-start or auto-stop settings behave for your channel before depending on them. YouTube’s interface and controls can change.

Keep a Linux stream running continuously

An infinite input loop only repeats a file while the FFmpeg process and its dependencies remain available. For a continuous feed, the host must stay on, the process must remain healthy, the source must remain readable, the CPU must keep up if encoding is needed, and the upstream connection must sustain the output. Plan for monitoring and recovery rather than treating a successful launch as an uptime guarantee.

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
  • Test the entire stream path for a meaningful period before relying on it. Watch CPU use, upload stability, stream health and the actual audio/video output.
  • Keep logs somewhere with enough disk space, and alert on process exit or loss of the feed. Avoid logging secrets.
  • Test what happens after a network interruption and after a host restart. A process supervisor or equivalent restart mechanism may help with process failure, but it cannot fix a bad key, a missing source file, an unavailable host or a YouTube-side interruption.
  • For a local PC or a Linux VPS/dedicated server, compare sustained upload capacity, encoding headroom, storage, restart controls, administration effort and provider limits. These are operating considerations, not a benchmark of a particular machine or hosting company.

FFmpeg documents a FIFO muxer recovery pattern for RTMP output, using options such as -f fifo, -fifo_format flv, -attempt_recovery 1 and -recovery_wait_time 1. Treat it as a mechanism to retry some temporary output failures, not a solution for every outage. Check the installed FFmpeg version’s documentation and test the behavior before adopting it; reconnect settings do not solve host failure, invalid credentials, a disabled stream, source errors or YouTube-side interruptions.

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

Use a playlist instead of one file

A single file needs only the input loop. A playlist requires more preparation: do not assume clips with different media properties will join cleanly. FFmpeg’s concat demuxer expects inputs with matching stream layouts and timing properties, including compatible codecs and time bases. A September 2024 FFmpeg-user mailing-list discussion also describes problems with mixed formats and recommends normalizing clips; that is community guidance, not a formal guarantee.

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.
  1. Normalize playlist clips to a consistent resolution, frame rate, video codec, pixel format, audio layout and time base.
  2. Test the playlist and its transitions before sending it to a live stream. Check for missing audio, freezes, abrupt changes or playback gaps.
  3. Only then configure the playlist input and loop behavior for the FFmpeg workflow you have chosen. The exact command depends on how your playlist is prepared; a single-file command should not be treated as a ready-made mixed-format playlist solution.

Long-stream archives, DVR and YouTube policy

YouTube says streams under 12 hours are automatically archived. Do not assume a continuous stream of arbitrary length will produce one complete archive. YouTube also says DVR may be limited or unavailable for streams longer than 12 hours, and viewers cannot seek to a point before the live stream began.

Using FFmpeg to send prerecorded material does not by itself establish that a channel or video is eligible for monetization or complies with YouTube policy. The official encoder setup guidance explains how to send and operate a stream, but does not determine whether a particular channel’s repetitive prerecorded 24/7 content meets monetization or content-policy requirements. Check YouTube’s current rules for your channel and material before relying on monetization or assuming the content is permitted.

Troubleshooting common FFmpeg and YouTube Live problems

Symptom Likely cause What to check or do
FFmpeg reports an unknown encoder such as libx264 The installed build does not include that encoder. Check ffmpeg -encoders and use a build with the encoder or adapt the command to one available in your build.
YouTube does not show an incoming feed Wrong ingest URL or key, unsupported output protocol, network issue, or FFmpeg error. Compare the endpoint and key with the stream’s Live Control Room settings; check that the build supports RTMPS; inspect FFmpeg’s error output and the Control Room status.
The connection is rejected or the stream key no longer works The key may be incorrect, reset, or associated with a different stream. Copy the key and URL for the intended stream from Live Control Room. If the key was exposed, reset it and update the protected configuration used by FFmpeg.
The feed stutters, drops frames or has poor stream health Insufficient sustained upload capacity, CPU encoding overload, or output settings that do not fit the host and connection. Check CPU use and upload stability; lower the output workload or select a suitable bitrate and resolution; leave upload headroom and test again.
Video plays but audio is absent The input has no audio stream, or audio mapping/encoding is not producing a usable output. Confirm the source contains audio, inspect the FFmpeg mapping and output messages, and check the YouTube preview. The optional audio map permits an input without audio; it does not create an audio track.
The picture is stretched, cropped or has bars The source aspect ratio differs from the 16:9 canvas used in the example. Review the scale and pad filter. It preserves the source aspect ratio by fitting the image and adding bars; change the output canvas or filter only if that matches your intended presentation.
A playlist has glitches or mismatched sound and picture Clips have incompatible stream layouts, codecs, frame rates, time bases or audio properties. Normalize the clips to consistent properties, then test the concatenation and transitions before going live.
The feed stops after an interruption FFmpeg exited, the host or network failed, or YouTube stopped accepting the output; a reconnect retry may not cover the cause. Inspect logs and Live Control Room, test the failure scenario, and arrange process supervision and alerting. Confirm separately whether the host, credentials, source and stream are still available.

Or let it run in the cloud

If you want the prerecorded loop without leaving a Linux computer or VPS running, 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. StreamNeo loops the uploaded video in the cloud; it does not go live from a camera.

  • Nothing has to stay on at home: the stream runs from the cloud rather than your computer and home connection.
  • Every quality up to 4K 60fps is streamed as uploaded, at one flat price per slot with no quality tiers.
  • It automatically attempts recovery if YouTube drops the stream.
  • The first day is free with no card, with one free day per account. The monthly option is $9.99 per month.

StreamNeo streams to YouTube only. See StreamNeo for details, or start your free 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.

Read next

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.