October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
FFmpeg

How to Stream an FFmpeg Playlist to YouTube with a Looping Background Video

Use FFmpeg’s concat demuxer for playlist order, loop the background input separately, overlay the video if needed, and test YouTube’s current ingest and encoder settings before going live.

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

Use FFmpeg’s concat demuxer to play a text-file playlist in order, and loop the background as a separate input with -stream_loop -1. If you want the background behind the playlist video, combine the two with a filtergraph, then explicitly map the video and audio you want to send to YouTube. The command depends on your files, audio choice and FFmpeg build, so validate it with a test stream before broadcasting.

Choose the right playlist and background setup

This guide assumes “playlist” means a text file listing local media files. FFmpeg’s concat demuxer reads those files consecutively; it does not make an online playlist, directory, or arbitrary feed behave like the same input. The background is a separate video input that repeats while the playlist plays.

  • Sequential playback only: use the playlist as the video source. No background composition is needed.
  • Playlist video over a background video: use an overlay filtergraph. The playlist is the foreground; the background input sits underneath it.
  • Playlist audio with a background image: use the image as the visual layer and choose playlist audio deliberately. Still-image input handling varies by format and FFmpeg build; an image-loop or duration-based input strategy may be more suitable than video looping.
  • Different playlist formats: construct an input appropriate to the source rather than treating a streaming URL, directory sequence, and concat list as interchangeable.

The concat demuxer expects the files to have compatible streams, codecs and time bases. Duration estimates can also produce timestamp gaps or artifacts. See the FFmpeg concat demuxer documentation.

Build and check the playlist file

Create a plain-text file such as playlist.txt, with paths to each file in playback order. For example:

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.
file '/media/part-1.mp4'
file '/media/part-2.mp4'
file '/media/part-3.mp4'

Then use the concat demuxer input option -f concat -safe 0 -i playlist.txt. The -safe 0 option permits paths that the demuxer’s safe mode would otherwise reject; use it only when you trust the paths in the file. Keep paths valid from the directory where you run FFmpeg, or use absolute paths.

Before streaming, inspect the files and confirm that they have compatible streams and time bases. If cuts produce freezes, gaps, or timestamp errors, normalize the source files to consistent formats and check duration metadata. FFmpeg’s concat demuxer does not automatically make substantially different media files seamless.

Prepare YouTube’s stream destination

In YouTube Live Control Room, obtain the ingestion address and stream key for the specific broadcast. YouTube’s LiveStreams API reference describes the ingestion address and stream name associated with a live stream. Do not paste a real key into a public command, shared script, or article; use a private placeholder such as YOUR_STREAM_KEY while adapting the examples.

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 an FFmpeg RTMPS workflow, use the RTMPS endpoint and stream name/key provided for your stream. Google documents RTMPS as a secure ingestion option using the rtmps protocol and port 443; endpoint details come from YouTube, so do not substitute a guessed address. See YouTube RTMPS ingestion.

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

Stream a playlist with a looping background video

The example below overlays the playlist video, resized to fit within a 1920×1080 frame, over a 1920×1080 looping background. It takes audio from the playlist. Replace the background path, playlist path, endpoint and key, and confirm that the chosen resolution and frame rate match your media and YouTube’s current recommendations.

ffmpeg -re 
  -stream_loop -1 -i /media/background.mp4 
  -f concat -safe 0 -i /media/playlist.txt 
  -filter_complex "[0:v]scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080[bg];[1:v]scale=1920:1080:force_original_aspect_ratio=decrease[fg];[bg][fg]overlay=(W-w)/2:(H-h)/2:shortest=1[v]" 
  -map "[v]" -map 1:a? 
  -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 12000k 
  -r 30 -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmps://YOUR_YOUTUBE_INGESTION_ENDPOINT/YOUR_STREAM_KEY"

This is a documentation-based starting point, not a universal preset or tested command. The 6000k video bitrate is an example only: YouTube’s appropriate bitrate depends on resolution and frame rate. Check the relevant row in YouTube’s current encoder settings, bitrates and resolutions before using a resolution-specific value.

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.

Understand the input order and loop

FFmpeg numbers inputs in command-line order. Here, input 0 is the background video because -stream_loop -1 appears immediately before its -i; input 1 is the concat playlist. FFmpeg documents -1 as infinite looping for that input. The playlist itself is read consecutively and is not repeated by this option. Consult the FFmpeg documentation for input options, stream selection and complex filtergraphs.

Understand the filter and stream maps

The filtergraph scales and crops the background to fill the output frame, scales the playlist video to fit inside it, then overlays that foreground in the center. If the playlist video should fill the frame instead, change its scaling/cropping strategy. The explicit -map "[v]" selects the composed video, while -map 1:a? selects playlist audio if present; the question mark makes that audio mapping optional if no audio stream exists. If your intent is silence, omit audio mapping and audio encoding rather than assuming an input has sound.

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

The example uses -re to read the inputs at a real-time rate. Check timing behavior with your actual media. If you want background audio, a separate music input, or audio from a different playlist stream, map and encode that source intentionally; do not map multiple audio streams accidentally.

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

Set codec, bitrate and keyframes for YouTube

The example encodes video as H.264 and audio as AAC, formats YouTube documents for RTMP/RTMPS. Its -g 60 and -keyint_min 60 correspond to a two-second interval at -r 30. YouTube recommends a two-second keyframe frequency and says not to exceed four seconds. If you change frame rate, recalculate the GOP length to preserve the intended interval. YouTube also specifies constant-bitrate encoding and lists frame rates up to 60 fps and supported video choices including H.264, HEVC and AV1 for the documented RTMP/RTMPS settings. Use the official settings page for the exact combination you intend to send.

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

Adapt the workflow to other compositions

Playlist video without a background

If you do not need a visual background, omit the background input and overlay filter. Map the playlist’s intended video and audio streams explicitly, then apply the required codecs, bitrate, keyframe interval and output format. This avoids spending compute on an unnecessary composition.

Background image instead of video

A still image is not a video loop. Choose an image-input method that supplies frames for the stream duration, such as an image loop or a duration-limited input strategy supported by your FFmpeg build. Then use it as the background layer in the filtergraph. Test this separately because still-image input options and timing differ from a looping video file.

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.

Playlist audio, background audio or silence

Decide on the audio source before building the final maps: playlist audio, background-video audio, a separate audio file, or intentional silence. YouTube’s documented RTMP/RTMPS audio options include AAC or MP3. If combining audio sources, use an audio filtergraph to mix them and manage levels rather than simply mapping both tracks as separate output streams.

RTMP, RTMPS and HLS ingestion

RTMP/RTMPS is the conventional encoder workflow used in the examples. HLS has different segment-based requirements and is not a drop-in replacement for an RTMPS URL. Google’s YouTube ingestion protocol comparison notes that HLS generally has higher latency than RTMP-based ingestion; choose the protocol supported by your channel workflow and current YouTube settings.

Preflight before the intended broadcast

  1. Resolve paths: confirm every playlist file and the background path exists and is readable by the FFmpeg process.
  2. Check media compatibility: inspect playlist files for matching stream layouts, codecs and time bases; investigate suspect durations or timestamps if transitions misbehave.
  3. Check maps and audio: confirm the filtergraph labels the intended background and foreground, and that each mapped audio stream exists or is optional.
  4. Check encoding and bandwidth: select the bitrate from YouTube’s current resolution/frame-rate guidance and ensure the connection has sufficient sustained upload capacity.
  5. Connect with current ingestion details: use the endpoint and stream key shown for the actual YouTube stream; keep the key private.
  6. Run a representative test: test representative motion and audio before the intended broadcast, then inspect YouTube’s stream health. YouTube Help explicitly says, “Make sure to test before you start your live stream.”

Troubleshoot common failures

  • “Impossible to open” or missing-file errors: check the working directory, quoted paths and permissions. Use absolute paths to remove ambiguity.
  • Concat errors or glitches at file boundaries: compare the files’ streams, codecs and time bases; verify duration metadata and normalize incompatible sources.
  • Background does not loop: make sure -stream_loop -1 is before the background input’s -i, not before the playlist input.
  • Black video or the wrong layer: verify input numbering and filter labels. In the example, [0:v] is the background and [1:v] is playlist video; map the filter output label.
  • No audio or an audio-map error: inspect whether the playlist actually contains audio. Keep the optional ? when audio may be absent, or map a deliberate alternate source.
  • YouTube rejects or reports an unhealthy stream: verify the current endpoint and key, codec, bitrate, resolution, frame rate and keyframe interval against YouTube’s encoder settings, then test again.
  • Stuttering or dropped frames: check encoder load and sustained upload capacity; lower resolution or bitrate to a value supported by the current YouTube guidance and your connection.

Or let it run in the cloud

If your goal is an always-on YouTube channel rather than learning to operate an FFmpeg process yourself, StreamNeo runs uploaded videos from the cloud: upload a recording or build a playlist, add your YouTube stream key once, and go live. Your computer and home connection do not have to stay on. Every slot streams the uploaded quality up to 4K 60fps at one flat price per slot, with automatic recovery if YouTube drops the stream. The first day is free with no card required; Monthly is $9.99 per month. StreamNeo is for YouTube and plays uploaded videos; it does not stream from a camera. Learn more at StreamNeo, or start the free 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.

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.

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 Patch Notes

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.