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

You can loop a prerecorded video into YouTube Live with FFmpeg on Linux by reading the file at real-time speed, encoding it to YouTube-compatible settings, and sending it to the ingest URL with your stream key. A looped command alone does not make a reliable 24/7 service: the Linux host, process, storage, and internet connection must stay healthy, and you need a recovery plan.

What you need before you start

  • A YouTube channel with live streaming enabled and access to YouTube Studio’s Live Control Room.
  • A Linux host that can remain on and has enough sustained upload capacity for the selected video bitrate. If FFmpeg will transcode the video, it also needs enough CPU capacity to encode continuously.
  • An input video that you have the rights to stream, and sufficient disk space for the file and any logs you retain.
  • An FFmpeg build with the encoder and output protocol you plan to use. Available encoders and protocols vary by how FFmpeg was packaged for your Linux distribution.

Check the installed build before configuring the stream:

ffmpeg -version
ffmpeg -hide_banner -encoders | grep -E 'libx264|aac'
ffmpeg -hide_banner -protocols | grep -E 'rtmp|rtmps'

The commands use grep; if it is not installed, inspect FFmpeg’s encoder and protocol lists directly. The example below requires libx264 for video encoding and support for the RTMPS output protocol.

Create a YouTube encoder stream and protect its key

  1. In YouTube Studio, select Go Live. Create a stream or schedule one from the Manage tab.
  2. Open the stream’s settings in Live Control Room. Copy the stream URL and the stream key shown there. Use the RTMPS URL if your FFmpeg build supports it.
  3. Keep the stream key private. YouTube describes stream keys as password-like credentials: someone who obtains yours may be able to send a feed to your stream. If it is exposed, reset it in Live Control Room and update your encoder configuration.
  4. If you scheduled the stream, review its auto-start and auto-stop controls. A scheduled stream can appear as upcoming and let viewers opt into reminders; the exact interface behavior may change.

Prefer a protected configuration mechanism to putting the key directly in a command, script, shell history, process listing, log, or screenshot. Restrict access to any file that contains it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
  • Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

Choose YouTube-compatible encoder settings

YouTube’s current H.264 ingest table, accessed October 3, 2026, lists these example bitrate figures. They are ingest guidance, not a guarantee of the quality viewers will see. The recommended bitrate depends on resolution and frame rate; leave upload headroom rather than running a connection at its limit.

H.264 resolution and frame rate Listed minimum video bitrate Listed recommended video bitrate
720p at 30 fps 3 Mbps 8 Mbps
1080p at 30 fps 5 Mbps 14 Mbps
1080p at 60 fps 6 Mbps 17 Mbps
1440p at 30 fps 7 Mbps 21 Mbps
2160p (4K) at 30 fps 11 Mbps 42 Mbps

Use the current YouTube encoder-settings table for the codec, resolution, and frame rate you actually intend to send; the examples above do not cover every combination. 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 audio. It specifies constant bitrate encoding and recommends a 2-second keyframe interval, advising not to exceed 4 seconds.

Rank #2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
  • Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM)
  • Includes 128GB Micro SD Card pre-loaded with 64-bit Raspberry Pi OS, USB MicroSD Card Reader
  • CanaKit Turbine Black Case for the Raspberry Pi 5
  • CanaKit Low Noise Bearing System Fan
  • Mega Heat Sink - Black Anodized

Loop one video with FFmpeg

For a single file, FFmpeg’s -stream_loop -1 input option repeats the input indefinitely. The -re option reads the file at its native real-time rate instead of sending it as fast as the machine can process it. Both options belong before the corresponding -i.

This template targets a 30 fps H.264/AAC stream and assumes a 1080p input. Supply the complete RTMPS output URL—combining the ingest address and stream key exactly as shown by YouTube—through a protected configuration mechanism as YOUTUBE_RTMPS_URL. The URL must not be printed or logged.

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
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
  • CanaKit Raspberry Pi 5 Essentials Starter Kit
ffmpeg -re -stream_loop -1 -i "/path/to/video.mp4" 
  -map 0:v:0 -map 0:a:0? 
  -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 "$YOUTUBE_RTMPS_URL"
  • Replace /path/to/video.mp4 with the actual file path. The optional audio map, -map 0:a:0?, lets FFmpeg proceed if the input has no audio stream.
  • -r 30 sets the output to 30 fps; -g 60 sets a 60-frame GOP, or a 2-second keyframe interval at that frame rate.
  • The example’s 6 Mbps video bitrate is above YouTube’s listed H.264 minimum for 1080p30, but below its 14 Mbps recommendation. It is an example, not a claim that YouTube recommends 6 Mbps. Confirm the appropriate value for your content, connection, and current ingest table.
  • The command assumes the installed build includes libx264. If it does not, use an encoder available in your build and verify its compatibility with YouTube’s current ingest settings.
  • No scaling filter is included: the example does not resize the source. Match the intended output resolution and frame rate to your input, or deliberately add and test scaling and frame-rate conversion.

Start with a short private or otherwise low-risk test. Check the incoming preview and stream health in Live Control Room, listen for audio, and verify that the picture is stable before relying on the feed. YouTube advises testing before a live stream and monitoring audio and video.

Use a playlist instead of one file

A single file only needs loop handling. A playlist of separate files adds the risk of mismatched streams and awkward transitions. FFmpeg’s concat demuxer expects files to share stream layout and timing properties, including compatible codecs and time bases.

Rank #4
SANOOV Raspberry Pi 5 4GB Kit, 4GB RAM Single Board Computer with Active Cooler and ABS Case, Complete Raspberry Pi 5 Starter Kit for IoT Robotics Retro Gaming
  • All-in-One Complete Kit: This SANOOV RPi 5 bundle comes with Raspberry Pi 5 4GB RAM single board, active cooler, durable ABS case and screwdriver. No extra parts needed, ready to use right out of the box for beginners and hobbyists
  • Powerful Single Board Computer: Equipped with 4GB RAM and high-performance processor, delivers fast running speed for 4K playback, AI projects, programming and daily computing tasks. SANOOV for raspberry pi 5 4GB is equipped with broadcom 64 quad-core Arm Cortex A76 processor with gigabit ethernet and upgraded with IEEE 802.11ac Wi-Fi, Bluetooth 5.0 dual-band 2.4Ghz and 5Ghz and Power Over Ethernet (POE). Upgrading delivers 2-3 x speed vs Pi 4, redefining the experience
  • Efficient Active Cooler: Effectively lowers operating temperature and prevents performance throttling. Runs quietly even under long-time heavy load, ensures stable operation all day long. SANOOV RPi 5 4GB kit offer an active cooler, which combines an aluminium heatsink with a high-performance PWM fan. Active cooler is fully compatible with the Pi OS, which can effectively reduce the temperature of RPi5 and ensure its good performance during long-term high load operation
  • Sturdy ABS Protective Case: Well-fitted for Raspberry Pi 5 board, can be secured with 4 screws to effectively protect the Pi 5 motherboard from damage, reserves full access to all ports and buttons. SANOOV uses ABS material to produce the case, which has a softer texture and feel. Meanwhile, SANOOV case adopts a layered design for easy disassembly and installation. (Tip: The Case cannot install M.2 HAT Add on Board and Solid State Drive!)
  • Wide Application & Full Compatibility: Seamlessly compatible with official OS and mainstream peripheral accessories for Raspberry Pi 5. Whether you are a beginner, student, electronics hobbyist or professional developer, this all-in-one kit meets your diverse needs. It excels in IoT projects, robotics design, retro gaming devices, home media servers and other DIY creations. Backed by a large global community, you can easily find guides, technical support and shared projects online
  1. Normalize clips to a consistent resolution, frame rate, video codec, pixel format, audio layout, and time base before concatenating them.
  2. Test the resulting sequence, including transitions and audio between clips, before scheduling a continuous broadcast.
  3. Do not assume that a list of mixed-format files will join seamlessly. A September 2024 FFmpeg-user discussion describes issues with mixed formats and recommends normalizing inputs; that is community guidance, not a formal guarantee.

Keep the feed running and recover from failures

A continuous FFmpeg stream depends on more than the loop flag. The host must stay on, the process must remain healthy, the upload connection must sustain the chosen bitrate, and any transcoding workload must fit the machine’s available CPU. There is no universal hardware specification established for every file and encoding configuration.

  • Supervise the process: use an appropriate service manager or supervisor, retain useful logs without recording the stream key, and alert on process exit or loss of the feed.
  • Plan for network interruptions: FFmpeg documents FIFO muxer recovery options for retrying RTMP output after temporary failures. Its example uses -f fifo, -fifo_format flv, -attempt_recovery 1, and -recovery_wait_time 1. Check the installed FFmpeg version and test any adapted command before depending on it.
  • Test the actual failure path: verify how your supervisor and output recovery behave after a temporary network interruption and after a process restart.
  • Keep the limits clear: reconnect logic cannot fix a stopped host, invalid or reset credentials, a disabled stream, a missing source file, or an interruption on YouTube’s side. It is a recovery mechanism, not an uptime guarantee.

A Linux VPS or dedicated server is one possible always-on host. Compare candidate hosts by sustained upload capacity, CPU headroom, storage, restart controls, administration effort, and provider limits; no specific host or machine configuration is established here.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
RasTech Raspberry Pi 5 8GB Kit with Active Cooler and Pi5 Case
  • 【What you Get】You will get 1*Pi 5 8GB Single Board,1*RasTech Case,1*Active Cooler,1*Screwdriver,1*Installation instructions,12-month free warranty, lifetime service, 24-hour prompt and friendly response.
  • 【More Connectors】There are two USB 3.0 ports(5Gbps simultaneously) and two USB 2.0 ports, which triple total bandwidth ,support any combination of up to two cameras or displays. Peak SD card performance is doubled through support for the SDR104 high-speed mode. It provides a smooth desktop experience for you. Offer Gigabit Ethernet and a PCIe interface, along with dual-band Wi-Fi and Bluetooth 5.0/BLE wireless capability. The RasTech Pi 5 Kit use the new 27W 5.1V 5A USB-C power connector.
  • 【 Support Dual 4Kp60 Display 】Each of the two microHDMI sockets can control a 4K display at 60 Hertz, now support HDR, offering super HD video for media streaming projects. RPi 5 is the first RPi model that comes with a PCI Express port (PCIe 2.0 x1 with 500 MB/s) to attach SSDs (requires separate M.2 HAT).
  • 【 Excellent Chips And Applications】Pi 5 is a full-size Pi computer using silicon built in-house at Pi. The RP1 “southbridge” provides the bulk of the I/O capabilities for Pi 5. Pi 5 is more friendly and convenient in the development of Internet of Things, Web development, machine identification, automatic control and other electronic equipment applications and network.
  • 【 Faster CPU, Better GPU 】 Pi 5 features a Broadcom BCM2712 64-bit quad-core Arm Cortex-A76 processor running at 2.4GHz, it delivers a 2–3× increase in CPU performance relative to RaspberryPi 4. The 800MHz VideoCore VII GPU is compatible to OpenGL ES 3.1 and Vulkan 1.2, substantial uplift in graphics performance. Pi 5 Offers lightning-fast CPU speed, a PCI Express interface, a Real Time Clock (RTC) and a power button and runs significantly cooler than Pi 4.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What long streams mean for archives and viewers

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

Copyright, reused content, and monetization

Using FFmpeg does not grant rights to the video, music, or other material in the stream. Confirm that you have the necessary rights and check YouTube’s current content and monetization policies for your material and channel. The encoder setup alone does not establish that repetitive prerecorded 24/7 content complies with every policy or qualifies for monetization.

Troubleshoot common problems

Symptom Likely cause What to check or do
FFmpeg reports an unknown encoder or cannot initialize libx264. The installed FFmpeg build does not include that encoder. Inspect the build’s encoder list. Install or use a build with a compatible encoder, then verify its output settings against YouTube’s current ingest recommendations.
The stream does not appear in Live Control Room. The output URL or key may be wrong, the stream may not be ready, or the output protocol may not be supported by the build. Check the precise URL and key in the stream settings, confirm the stream is active in Live Control Room, and verify RTMPS support. If the key may have been exposed, reset it and replace the configured value.
The preview buffers, drops frames, or the connection repeatedly fails. The upstream connection may not sustain the video bitrate, or the host may be overloaded. Check sustained upload capacity and CPU use. Leave bandwidth headroom; if necessary, lower the output bitrate or choose a lower resolution or frame rate that fits the source and connection.
Video plays but there is no sound. The source may not contain an audio stream, or its audio may not be mapped or encoded as expected. Inspect the input streams, confirm the intended audio track is present, and check the audio mapping and encoder output in FFmpeg’s logs without exposing the key.
The picture looks stretched, soft, or inconsistent. The input dimensions or frame rate may not match the chosen output settings, or FFmpeg may be processing the source differently than intended. Inspect the source’s resolution and frame rate, then set and test any required scaling or frame-rate conversion. Avoid assuming the example command resizes video.
The stream stops after a host restart or an interruption. The FFmpeg process may not be supervised, or the particular failure may not be recoverable by output retry logic. Check the service manager or supervisor, host restart behavior, logs, credentials, source-file availability, and the tested recovery configuration.
The broadcast runs longer than expected but its archive or DVR behavior differs. YouTube’s archive and DVR behavior has limits on very long streams. Plan around YouTube’s stated under-12-hour archive guidance and possible DVR limits for streams longer than 12 hours; do not promise a complete single archive for an arbitrarily long broadcast.

Or let it run in the cloud

If you would rather not keep a Linux machine and home connection running, StreamNeo keeps a prerecorded YouTube channel live from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. The computer at home can stay off. StreamNeo streams the uploaded video as made, up to 4K 60 fps, at one flat price per slot rather than quality-based tiers, and automatically recovers if YouTube drops the stream.

Each slot includes one always-on stream, 10 GB of storage per slot pooled across active slots, 24/7 looping and playlists, automatic recovery if YouTube drops, and StreamNeo team support. The first day is free with no card, once per account. Monthly billing is $9.99 per month. UPI and cards are available in India; card checkout is available worldwide. It is a YouTube-only service for uploaded videos, not a camera livestream.

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

Quick Recap

Bestseller No. 1
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
CanaKit Raspberry Pi 5 Starter Kit PRO - Turbine Black (128GB Edition) (8GB RAM)
Includes Raspberry Pi 5 with 2.4Ghz 64-bit quad-core CPU (8GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$259.95
Bestseller No. 2
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
CanaKit Raspberry Pi 5 16GB Starter Kit PRO - Turbine Black (128GB Edition) (16GB RAM)
Includes Raspberry Pi 5 16GB with 2.4Ghz 64-bit quad-core CPU (16GB RAM); CanaKit Turbine Black Case for the Raspberry Pi 5
$419.99
Bestseller No. 3
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit (4GB RAM)
CanaKit Raspberry Pi 5 Essentials Starter Kit
$189.99
  1. Upload your recording or build a playlist.
  2. Add your YouTube stream key.
  3. Go live.

Start your free first day with StreamNeo.

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.