October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
DocumentaryTube
Admit one · Blog

How to Loop an MP4 in FFmpeg for a Continuous YouTube Live Stream

A practical guide to looping one MP4 with FFmpeg and sending it to YouTube Live, with a command example, encoder settings, Studio setup and troubleshooting.
Opened Runtime7 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To loop an MP4 indefinitely while sending it to YouTube Live, put -stream_loop -1 before the input and use -re to read the file at its normal playback rate. Then encode a YouTube-compatible live feed and send it to the server URL and stream key shown in YouTube Studio. The example below is a starting point—not a tested, universal command—so verify the source file, stream preview, audio and loop transition before relying on it.

What you need before starting

  • An FFmpeg build available on the computer that will run the stream.
  • A YouTube channel eligible to live stream. YouTube says the channel must be verified and must have had no live-streaming restrictions in the past 90 days; see YouTube’s live-streaming eligibility and testing guidance.
  • An MP4 file you have the rights to stream, plus stable upload bandwidth suitable for the chosen resolution and frame rate.
  • A server URL and stream key from YouTube Studio’s encoder stream setup. Treat the key like a password; do not share or publish it.

Start with an FFmpeg loop command

Replace input.mp4 with the path to your file. Replace the output destination with the exact ingest server URL and key provided in YouTube Studio. YouTube recommends RTMPS; use the RTMPS endpoint when Live Control Room provides one. Follow the URL/key format expected by your encoder setup rather than assuming every account uses the same endpoint.

ffmpeg -stream_loop -1 -re -i input.mp4 
  -c:v libx264 -preset veryfast -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 "rtmp://a.rtmp.youtube.com/live2/YOUR_STREAM_KEY"

This illustrative command assumes 30 fps: a GOP of 60 frames targets a two-second keyframe interval. Its 4,500 Kbps video bitrate is only an example and does not match YouTube’s recommended bitrate for every resolution or frame rate. Use the matching recommendation below and choose a rate your reliable upload connection can sustain. The shown RTMP address is an example; substitute the exact server URL and key supplied in Studio.

What the loop and pacing options do

  • -stream_loop -1 requests infinite repeats of the input file. Place it before the -i it applies to.
  • -re reads the file at its native frame rate, pacing file playback like a live source instead of sending the content as fast as the computer can process it. FFmpeg cautions against using this option on an actual live input.
  • -c:v libx264 and -c:a aac encode video and audio into a broadly compatible example output. YouTube also lists H.265/HEVC and AV1 video, and AAC or MP3 audio, in its encoder guidance.
  • -f flv selects the output container used for this RTMP-style example.

The command is assembled from documented FFmpeg options and YouTube guidance; it has not been run or tested against your file. A particular FFmpeg build, source stream layout, audio format, pixel format or loop-boundary timestamps may require changes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
KAMRUI Pinova P2 Mini PC, AMD Ryzen 7330U(4 Cores, 8 Threads, Up to 4.3GHz), 16GB RAM 256GB SSD, Zen3 Architecture 7nm Processor, 8MB L3 Smart Cache Mini Computers,Triple 4K Display Home/Business
  • 【AMD Ryzen 7330U】 – The Efficiency-Tuned Powerhouse,AMD Ryzen 7330U (Zen 3, SMT, 4C/8T) in KAMRUI P2 mini PC crushes rivals: Intel i3-10110U (2C/4T, 2019) and N95 (4 efficiency cores, no HT, single-channel memory). Vs predecessor Ryzen 3 4300U (4C/4T): ~50% faster single-core, ~46% multi-core, 8MB L3 cache (vs 4MB). Beats both Intel chips hugely in multi-core, making heavy multitasking, coding, data work smooth at just 15W TDP. High-end power in a cool, efficient box.
  • 【AMD Radeon Graphics】– Triple 4K Vision & Fluidity,The integrated Radeon Graphics (based on the modern Vega architecture with 6 CUs) is a visual beast, outclassing the iGPU offerings from both AMD's prior generation and Intel. The Intel UHD Graphics (i3-10110U/N95) struggles with single-channel memory and low execution units, crippling its gaming performance and barely handling basic 4K video without stuttering. While the older Radeon Vega 5 (4300U) was decent, our 7330U's Radeon Graphics (6 CUs) pushes the boundaries, delivering higher graphics clock speeds (up to 1.8GHz) and significantly better rendering capabilities. It can drive triple 4K@60Hz displays with zero lag, edit photos/videos.
  • 【Generous Storage & Easy Expansion】The KAMRUI Pinova P2 mini desktop computers comes with 16GB LPDDR4X RAM (higher frequency, lower power) for buttery‑smooth multitasking, and a 256GB M.2 SSD for blazing fast boot‑up, quick file transfers, and no more long loading screens. It also features two storage expansion slots (1x M.2 2280 SATA/NVMe PCIe 3.0 slot + 1x M.2 2280 SATA slot), supporting up to 4TB total (not included). You’ll have all the space you need for projects, media, and important data.
  • 【Triple 4K Display Output】The KAMRUI Pinova P2 mini desktop pc is equipped with HDMI 2.0 ×1 + DP 1.4 ×1 + USB 3.2 Gen2 Type‑C ×1 (with DP Alt Mode), enabling simultaneous triple 4K@60Hz output. Whether for home entertainment, remote work, or conference room presentations, it delivers an immersive visual experience. Two USB 3.2 Gen2 Type‑A ports (up to 10Gbps – 21x faster than USB 2.0) make data transfers and device expansion a breeze.
  • 【USB 3.2 Gen2 Type‑C: 10Gbps & Versatile Connectivity】The USB 3.2 Gen2 Type‑C port on the KAMRUI P2 small pc supports 10Gbps data transfer speeds and can also output DisplayPort 1.4 video. Together with Gigabit LAN, Wi‑Fi, and Bluetooth, you get a fast, flexible, and productive connected environment – wired or wireless.

Choose YouTube-compatible encoder settings

YouTube’s published recommendations are configuration guidance, not a guarantee of stream quality. Match bitrate to the selected codec, resolution and frame rate, and test the actual stream. The figures below are YouTube recommendations for H.264 video and stereo audio in guidance accessed in 2026.

Output YouTube-recommended bitrate
720p at 30 fps, H.264 8 Mbps
1080p at 30 fps, H.264 10 Mbps
1080p at 60 fps, H.264 17 Mbps
Stereo audio 128 Kbps

These are the available examples, not an exhaustive bitrate table. Consult YouTube’s current encoder settings and bitrate guidance for other output combinations. Its guidance recommends constant bitrate (CBR), a two-second keyframe interval and says not to exceed four seconds. The example’s -g 60 and -keyint_min 60 target two seconds only at 30 fps; at a different frame rate, set the GOP in frames accordingly. The example does not force every advanced encoding parameter YouTube discusses.

Rank #2
GMKtec M5 Ultra Gaming Mini PC Ryzen 7 7730U 32GB RAM 512GB SSD Desktop
  • Office Gaming Mini PC - UPGRADED GMKtec Nucbox M5 Ultra Series is equipped with the powerful AMD Ryzen 7 7730U processor, 8 Cores/16 Threads, Base 2.00GHz (Power Saving Quiet Mode) with Turbo Boost up to 4.50GHz (Performance Mode) in BIOS settings, Based on the ZEN 3+ architecture, this small but powerful mini pc delivers satisfying results in productivity, office work, and gaming. 35% Performance increase over AMD Ryzen 5 7430U/ Ryzen 7 5700U, 5600U, 5560U, 5500U.
  • 32GB DDR4 RAM & 512GB PCIe SSD - Installed with DDR4 32GB RAM Dual Channel (2x16GB), the Nucbox M5 Plus mini pc support expansion to 64GB RAM. Featured with 512GB M.2 2280 PCIe 3.0 SSD, support dual slot expansion to 4TB SSD. (Upgrades not included)
  • DUAL NIC LAN 2.5G RJ45 - Fast Network Speeds: Enjoy up to 2500Mbps data transmission speed without worrying about lagging. Ideal for working, gaming, and surfing the internet. Great for Untangle, Pfsense or as a server office PC.
  • Mini Desktop Computer with 4K Triple Screen Display - Nucbox M5 Ultra integrates AMD Radeon Graphics 8 Cores 2000 MHz GPU to deliver powerful graphics processing power to easily handle the demands of complex design software, 4K@60Hz UHD video editing, and playback. It can connect to 3 display screens simultaneously.
  • Fast Internet WiFi 6E + BT5.2 Connection - GMKtec Mini PC with WiFi-6E Wireless, have 2.5G/5G/6G triple band, more faster and lower latency. Bluetooth 5.2 allowing you more quickly to connect other wireless devices (headset, mouse, keyboard, etc.) Interface features 2*USB3.2 ports, 2*USB2.0 ports, 1*HDMI 2.0 port(4K@60Hz), 1*USB-C port(PD/DP/DATA), 1*DP Port, 1*Audio 3.5mm (HP&MIC), 1*DC Power Port.

YouTube’s advanced recommendations also include square pixels, progressive scan, two B-frames, one reference frame and Rec. 709 for SDR. Use the settings appropriate to your source and encoder; avoid changing color or scan characteristics without checking the result.

Connect FFmpeg to YouTube Studio

  1. Confirm live access. Check that your channel meets YouTube’s current eligibility requirements in YouTube Help.
  2. Create or select an encoder stream. In YouTube Studio, open the live-stream setup and choose an encoder stream. Copy its server URL and stream key. YouTube’s encoder setup instructions explain the setup. Keep the key private; if it is exposed, reset it in Studio.
  3. Prepare the command destination. Use the exact ingest URL supplied by Studio, preferably its RTMPS endpoint when offered, and include the stream key in the form expected by your encoder. Do not paste a real key into a public post, shared script or screenshot.
  4. Start FFmpeg and inspect the preview. For a scheduled stream, wait for the encoder preview in Live Control Room and select Go live if the stream’s settings require it. Auto-start and control-room workflows can vary by stream configuration.
  5. Test and monitor. Before a long broadcast, test with representative motion and audio. Watch YouTube’s stream health and messages, and check that the picture, sound and repeat point behave as intended.
  6. End the broadcast deliberately. Stop FFmpeg’s output and end the stream in the control room where applicable. YouTube says streams under 12 hours are automatically archived; do not assume that applies to a stream lasting 12 hours or longer.

Check whether the MP4 repeats cleanly

-stream_loop -1 repeats the input; it does not guarantee a seamless transition or a valid continuous stream for every file. Watch at least one full repeat in a test stream. Listen for a gap or click in the audio and look for a pause, jump, black frame or timestamp error at the boundary. If the source itself ends with silence or a visual discontinuity, looping will repeat that too.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
BOSGAME E5 11 Pro Mini PC, AMD Ryzen 5300U 4C/ 8T, Business Home Office PC
  • 【AMD Ryzen 3 5300U CPU: Outperforms N150 & 3500U】 BOSGAME E5 mini PC is powered by the TSMC 7nm FinFET architecture AMD Ryzen 3 5300U processor (4 Cores, 8 Threads, up to 3.8GHz boost, 6MB total cache). Compared to low-end Intel N150 or 3500U chips which only have 4 single threads and throttle under load, the 5300U delivers over 30% faster multi-core speed. Run 30+ browser tabs, large Excel sheets, and Zoom meetings simultaneously without system lag.
  • 【8GB DDR4 RAM & 256GB NVMe SSD Storage】 Installed with high-speed 8GB DDR4 dual-channel memory and a fast 256GB M.2 2280 SSD, eliminating slow boot times and application loading delays. To accommodate growing data requirements, the upgradeable hardware design features dual SODIMM slots that allow you to expand memory up to 64GB RAM, ensuring smooth operation during heavy multitasking.
  • 【High-Capacity Dual M.2 SSD Storage Expansion】 Never worry about running out of space for your business files. In addition to the pre-installed 256GB system drive, the motherboard houses an extra empty internal M.2 2280 NVMe PCIe 3.0 slot. This allows you to easily add a second solid-state drive for up to an additional 2TB of storage capacity (upgrades not included) without needing to remove or reinstall the original operating system.
  • 【Radeon 6-Core Graphics & Triple 4K Displays】 Integrated with official AMD Radeon Graphics (6 Graphics Cores, 1500 MHz frequency) for casual gaming, photo editing, and crisp 4K media decoding. Featuring 1x HDMI 2.0 port, 1x DisplayPort, and 1x Full-Function Type-C port, the E5 outputs true 4K@60Hz resolution to three monitors at once. This multi-screen setup eliminates constant window-switching for traders, programmers, and office workers.
  • 【Dual 2.5GbE LAN Ports for Advanced Networking】 Experience fast wired network transmission speeds up to 2500Mbps without lagging or buffering. The integration of dual 2.5 Gigabit Ethernet ports (powered by Realtek RTL8125 controller) makes this compact computer an exceptional hardware choice for tech enthusiasts. Easily configure it into software routers, hardware firewalls (pfSense, OpnSense), home NAS servers, or local homelabs.

If the stream fails at the repeat point, read FFmpeg’s console output and test a re-encoded baseline such as the H.264/AAC pattern above. A stream-copy version using -c copy can be a faster experiment only when the codecs, stream layout and timestamps are compatible. Copying does not let FFmpeg reshape the encoded media to a target bitrate or keyframe interval, and it does not guarantee clean timestamps at the repeat point. Re-encoding gives more control over output settings but uses processing resources and cannot guarantee that every source problem will be fixed.

For a playlist of different files, do not assume the single-file loop command will concatenate them cleanly. A concat workflow may require matching stream structure and time bases; that is a separate setup from repeating one MP4.

Rank #4
Sale
GMKtec G3S Mini PC Intel N95 Processor (Up to 3.4GHz) 8GB RAM 256GB M.2 SSD
  • 12th Intel Alder Lake N95 Processor – The GMKtec G3 S Mini PC is powered by the 12th Gen Intel N95 processor with 4 cores, 4 threads, 6MB cache and a burst frequency up to 3.4GHz. Compared with N100/N5105/N5100/N5095, the N95 delivers up to 36% overall performance improvement. Perfect for routine tasks, office work, and home entertainment, this compact mini desktop is more convenient than traditional bulky PCs.
  • 8GB RAM & 256GB SSD Storage – Pre-installed with 8GB DDR4 memory and a fast 256GB M.2 2242 SSD, the G3 S mini desktop offers quicker startup, smoother multitasking, and faster file transfers. Enjoy seamless performance whether you’re working on multiple applications, browsing, or streaming content.
  • Rich Interfaces & Connectivity – The G3 S mini computer comes equipped with USB 3.2 (up to 10Gbps), dual HDMI 2.0 (4K@60Hz), and a 3.5mm audio jack. With support for WiFi 5, Bluetooth 5.0, and Gigabit Ethernet (RJ45 1000MbE), it connects easily with monitors, projectors, printers, office equipment, and other peripherals, making it versatile for both home and business use.
  • Dual 4K Display Support – Featuring upgraded Intel UHD Graphics (up to 1000MHz), the G3 S supports 4K video playback and AV1 decoding for a smooth viewing experience. With dual HDMI outputs, you can connect two 4K@60Hz displays simultaneously, enabling efficient multitasking for work and entertainment.
  • GMKtec WARRANTY - GMKtec offers a 1-year limited GMKtec's warranty for each mini PC, starting from the date of the purchase. All defects due to design and workmanship are covered. With a professional after sales team always ready to attend to your needs, you can simply relax and enjoy your mini PC.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshoot common failures

Symptom What to check Practical next step
YouTube receives no signal Check FFmpeg’s output destination, server URL, stream key and console error. Confirm that the key belongs to the selected encoder stream. Copy the current URL and key from Studio, protect the key, and retry. If the key may have leaked, reset it.
Stream starts but YouTube reports poor health Check whether the chosen bitrate exceeds stable upload capacity and whether bitrate mode and keyframe interval match YouTube guidance. Try a lower supported resolution or frame rate and its corresponding bitrate recommendation; test before the full broadcast.
FFmpeg errors or playback breaks at the loop boundary Inspect the complete error output and note whether the failure happens exactly when the file repeats. Source timestamps, stream layout or codecs may be involved. Try re-encoding instead of -c copy. For diagnosis, record the FFmpeg version, source stream details from ffprobe, and the full command with the stream key redacted.
No audio, distorted audio or an unexpected channel layout Check whether the MP4 contains an audio stream, its codec and channel layout, and whether FFmpeg reports an audio conversion error. Use an AAC output configuration suitable for the source, then verify the sound in a test preview. The example’s stereo recommendation is 128 Kbps.
Video or audio jumps at every repeat Distinguish a discontinuity already present at the file’s end from an encoder or timestamp issue at the repeat point. Test a re-encoded output and inspect the source’s last and first frames and audio samples. Infinite looping alone does not create a gapless edit.

Or let it run in the cloud

If the goal is to keep a pre-recorded YouTube stream running without leaving a computer on, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key, and go live. It loops uploaded videos to YouTube; it is not a camera-streaming service.

  • Nothing has to stay powered on at home: playback runs in the cloud, so your computer and home connection do not need to remain on.
  • Each slot streams the upload as made, up to 4K 60fps, at one flat price per slot rather than quality tiers; 10 GB storage per slot is pooled across active slots.
  • It includes 24/7 looping and playlists, automatic recovery if YouTube drops the stream, and support from the StreamNeo team.
  • The first day is free with no card, once per account. The same product is on every plan; only the billing length changes. Cancel any time.

Monthly: $9.99 per month. Visit StreamNeo for details, or start your 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 *

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.

More from the Screening Room

  1. How to Migrate a 24/7 YouTube Stream to a New VPSAdmit one · BlogHow to Migrate a 24/7 YouTube Stream to a New VPSOpened04 OCT 2026Runtime6 min
  2. How to Run a YouTube Playlist on a Headless Linux Server—and Broadcast It LiveAdmit one · BlogHow to Run a YouTube Playlist on a Headless Linux Server-and Broadcast It LiveOpened04 OCT 2026Runtime6 min
  3. How to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootAdmit one · BlogHow to Make a 24/7 Indian Music YouTube Stream Restart After a Server RebootOpened04 OCT 2026Runtime6 min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver 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.