Use FFmpeg’s concat demuxer to play compatible prerecorded story videos in playlist order, pace them in real time, loop the sequence, and send it to YouTube Live over RTMPS. The files must have matching stream layouts, codecs, and time bases for reliable concat-demuxer playback; otherwise, normalize them or use the concat filter and re-encode.
What you need before you start
- An FFmpeg build with the demuxer and encoders your files and output require. Availability depends on the platform and how FFmpeg was compiled.
- Local video files in the intended story order, with compatible streams and reliable duration metadata.
- A YouTube channel eligible to create a live stream, plus the RTMPS ingest URL and stream key shown in its Live Control Room. Channel-specific eligibility and controls can vary.
- A stable upload connection capable of sustaining the bitrate you choose.
Check the installed build with ffmpeg -version. To see whether the H.264 encoder used in the example is available, run ffmpeg -encoders and look for libx264. The example also requires the concat demuxer and AAC support.
Prepare and check the story files
Make the playlist
Create a plain-text file named playlist.txt in playback order:
file 'story-01.mp4'
file 'story-02.mp4'
file 'story-03.mp4'
Paths are relative to the working directory from which you run FFmpeg, unless you provide absolute paths. The concat script may also begin with the exact line ffconcat version 1.0. Quote or escape paths containing spaces or special characters. The command below uses -safe 0, which relaxes the demuxer’s path restrictions: use it only with a playlist and paths you trust. Prefer safe relative paths where practical.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →#1 Best Overall
- 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.
Confirm concat compatibility
The concat demuxer joins files at the packet level rather than blending or re-encoding them. FFmpeg’s documentation says, “All files must have the same streams (same codecs, same time base, etc.).” Compare every file’s stream count, codecs, time base, frame rate, resolution, audio sample rate, and channel layout. Duration metadata also needs to be reliable: the demuxer uses each file’s duration to calculate timestamps for the next one, so incorrect durations can produce gaps or artifacts at boundaries.
Use FFprobe, included with many FFmpeg builds, to inspect each file—for example, ffprobe -v error -show_streams -show_format story-01.mp4. Repeat for each playlist entry and check the relevant stream and duration fields. If the inputs differ in resolution, frame rate, codec, audio layout, or time base, normalize or transcode them first, or use FFmpeg’s concat filter and re-encode. The concat filter is the documented route when re-encoding is needed.
Rank #2
- 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.
Set the YouTube Live output settings
Open YouTube Live Control Room and copy the RTMPS ingest URL and stream key assigned to your broadcast. Treat the key like a password: do not expose it in screenshots, logs, shared scripts, or public command history. The example uses environment variables so the secret does not have to be written directly into the command:
export YOUTUBE_RTMPS_URL='paste-your-rtmps-ingest-url-here'
export YOUTUBE_STREAM_KEY='paste-your-stream-key-here'
Set the output to the selected live-stream format and choose a bitrate your upstream connection can sustain steadily. YouTube’s current encoder guidance for RTMP/RTMPS lists H.264, H.265/HEVC, and AV1 video up to 60 fps; CBR encoding; AAC or MP3 audio; and a recommended keyframe frequency of two seconds, not exceeding four seconds. These are recommendations, not a promise of quality or a substitute for testing your source and connection. For stereo audio, YouTube recommends 128 Kbps at 44.1 kHz.
Rank #3
- 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.
| H.264 output example | YouTube recommended video bitrate |
|---|---|
| 1080p at 30 fps | 10 Mbps |
| 1080p at 60 fps | 17 Mbps |
The values above are YouTube’s recommended H.264 bitrates in its guidance accessed in 2026; the page does not state a publication year. The command below instead uses 5 Mbps as an illustrative starting value, not a YouTube recommendation. Choose resolution, frame rate, and bitrate for your material and available upload capacity.
Run the continuous livestream
For compatible H.264/AAC source files, this command reads the playlist at native playback speed, repeats it indefinitely, encodes the output, and sends it to YouTube over RTMPS:
Rank #4
- 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
ffmpeg -re -stream_loop -1 -f concat -safe 0 -i playlist.txt
-c:v libx264 -preset veryfast -b:v 5M -maxrate 5M -bufsize 10M
-g 60 -keyint_min 60 -sc_threshold 0
-c:a aac -b:a 128k -ar 44100 -ac 2
-f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
-rereads file input at its native frame rate so the content is paced like a live feed.-stream_loop -1requests infinite repetition. Both are input options, so they appear before-i playlist.txt.-f concatselects the concat demuxer;-safe 0permits paths that would otherwise fail its safety checks.-b:vand-maxrateset the example video rate, while-bufsizesets the encoder buffer size.-g 60 -keyint_min 60sets a 60-frame GOP. That corresponds to a two-second keyframe interval only when the output is 30 fps. At another frame rate, adjust the GOP to meet YouTube’s two-second recommendation and keep the interval no longer than four seconds.-c:a aac -b:a 128k -ar 44100 -ac 2encodes stereo AAC at 128 Kbps and 44.1 kHz, matching YouTube’s stated stereo audio recommendation.-f flvselects the conventional RTMP/RTMPS output container. The endpoint combines the account-specific URL and stream key shown in Live Control Room.
This is a template, not a tested universal command. It assumes the installed build includes libx264 and AAC support, a 30 fps output for the 60-frame GOP, and a source and connection suited to the selected bitrate. If your encoder expects the ingest URL and stream key as separate fields, configure them in the form that encoder requires.
When stream copy may work
If all input streams already match one another and are acceptable to YouTube, stream copy with -c copy can reduce CPU use by avoiding re-encoding. It does not fix mismatched streams, unreliable timestamps, or unsuitable codecs. Verify the output codecs, timestamps, container, and ingest acceptance before relying on it; use re-encoding when compatibility requires it.
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Best Value
- 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.
Test and monitor before relying on the loop
- Start the command with representative files, including stories with the most demanding motion and audio.
- Watch the YouTube Live Control Room preview and stream-health indicators. Confirm that video and audio arrive, the selected settings are accepted, and transitions between files do not show gaps or artifacts.
- Observe at least one file boundary and, if possible, the transition from the last playlist entry back to the first. Check FFmpeg’s output for errors or dropped connections.
- Keep the machine and its network connection available while this command runs. FFmpeg in this setup is a local process; it does not keep running if the computer or connection stops.
Troubleshoot common failures
| Symptom | Likely cause | What to check or change |
|---|---|---|
| FFmpeg cannot open a playlist entry or stops at a file boundary | Incorrect path, quoting, or file access; alternatively, mismatched streams or incorrect duration metadata | Check the working directory and every playlist path. Quote or escape special characters. Use FFprobe on each input and compare streams, time bases, and durations; normalize or use the concat filter and re-encode if the files are not compatible. |
| “Unsafe file name” or path-related concat error | The demuxer rejects a path under its safety rules | Use safe relative paths, or use -safe 0 only for a trusted local playlist. |
| Visible or audible jump, gap, or artifact at a transition | Different stream layouts or unreliable duration and timestamp information | Compare stream count, codecs, time bases, frame rate, resolution, audio sample rate and layout, and duration metadata. Normalize the files or use the concat filter with re-encoding. |
| YouTube does not accept the ingest connection | Incorrect or outdated RTMPS URL or key, or output settings inconsistent with the selected stream | Copy the URL and key again from Live Control Room, then check codec, bitrate, and keyframe interval against the stream configuration. YouTube notes that RTMPS SSL errors can require the correct rtmps URL and, in some cases, port 443. |
| Stream connects but playback is unstable or the machine struggles | Encoding load or bitrate exceeds what the computer or upstream connection can sustain | Check FFmpeg’s output and YouTube’s stream health. Lower the target bitrate or output demands, or use stream copy only when the source streams are already compatible and accepted. |
RTMPS or HLS?
For a conventional H.264/AAC live feed, RTMPS is the straightforward choice. YouTube describes HLS as an alternative for HDR or codecs unsupported by RTMP, but HLS uses segmented delivery and has greater latency. It also requires specific playlist, segment-duration, format, and HTTPS-method settings; do not switch protocols without configuring those requirements.
Or let it run in the cloud
If you want a continuous YouTube stream without leaving a computer and home connection running, StreamNeo keeps uploaded videos playing from the cloud. The setup is: upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded video rather than broadcasting a camera feed.
Quick Recap
- Nothing has to stay on at home; the stream runs from the cloud.
- Each slot streams your upload as made, up to 4K 60fps, at one flat price per slot with no re-encode or quality tiers.
- It automatically recovers if YouTube drops the stream.
- The first day is free with no card, one free day per account.
- The monthly option 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.




