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
DocumentaryTube
Admit one · Blog

How to Use GStreamer splitmuxsink to Record and Stream to YouTube at Once

Use GStreamer tee to record sequential local files with splitmuxsink while sending a separate FLV/RTMP branch to YouTube. Learn the setup, keyframe limits and troubleshooting steps.
Opened Runtime6 min Written byDocumentaryTube Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use a GStreamer tee to split one program into two queued branches: send one to splitmuxsink for segmented local recording, and send the other through an FLV muxer to rtmpsink for YouTube. The topology is straightforward; the exact source, encoding chain, caps and RTMP endpoint depend on your devices, installed plugins and current YouTube encoder settings.

Pipeline layout: fan out to recording and streaming

A tee duplicates the flow to separate outputs. Put a queue on each branch so downstream work can proceed independently: one branch writes local segments, and the other sends an FLV stream over RTMP. The GStreamer Project documents tee as a one-to-many pipe fitting and splitmuxsink as a bin that muxes streams into files with time or size limits (tee; splitmuxsink).

[source] ! [shared capture / conversion / encoding as appropriate] ! tee name=t
  t. ! queue ! splitmuxsink location="record-%05d.mp4" max-size-time=<nanoseconds>
  t. ! queue ! [stream-specific encode or parse chain] ! flvmux ! rtmpsink location="<YouTube RTMP URL>/<stream-key>"

This is a topology sketch, not a copy-and-run command. A real pipeline must account for whether audio and video arrive as separate streams, which elements handle encoding, whether the chosen muxers and sinks are installed, and how the application provides credentials. In particular, the sketch does not establish one universal way to combine YouTube’s current server URL and key in rtmpsink‘s location; confirm the endpoint details in YouTube Studio and test the configured pipeline locally.

Decide where encoding happens

  • Encode before the tee: both branches can receive the same encoded stream, avoiding a second encode. Confirm the recording muxer accepts that stream and that the encoded video has keyframes suitable for segment boundaries.
  • Branch before encoding: each output can have a different codec or profile, but separate encoders require enough CPU, GPU or other encoder capacity. The right choice depends on the formats each output accepts and the machine’s headroom.

Neither layout is a universal winner. Choose based on codec compatibility, desired recording container and split behavior, available encoder capacity, storage throughput and RTMP upload stability. GStreamer and YouTube’s references do not specify a single codec, bitrate, resolution, frame rate, keyframe interval or audio profile that works for every source and network.

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.

Configure splitmuxsink and understand its boundaries

splitmuxsink wraps a muxer and sink, then starts another file when the muxed contents approach a configured time or size threshold. Its splits occur at video keyframe boundaries, not at arbitrary exact instants. It defaults to mp4mux and filesink; the muxer and sink can be changed. See the GStreamer splitmuxsink reference for properties and version-specific details.

Choose a filename pattern and limit

Give location a pattern that distinguishes sequential files, such as record-%05d.mp4. Set either max-size-time in nanoseconds or max-size-bytes in bytes for the intended split threshold; zero disables the corresponding limit. A threshold is not necessarily an exact duration or file size: the minimum file size is one GOP, so a segment may exceed the limit when keyframes are farther apart than the threshold.

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.

Make segments independently playable

For video parts to play independently, the stream needs closed GOPs. Plan the encoder’s GOP structure with the recording use case in mind. If you want more predictable time-based boundaries, the documented send-keyframe-requests property can request a keyframe at each time threshold; it is effective only when max-size-bytes=0. Keyframe requests and actual split timing still depend on the encoder and pipeline behaving as expected.

Consider asynchronous finalization only for a reason

With async-finalize=true, the old muxer and sink can finish the previous fragment asynchronously while a new pair starts. In this mode configure muxer-factory and sink-factory rather than the direct muxer and sink object properties. Evaluate this against your workload; it is not a guarantee that a slow disk or other storage bottleneck will disappear.

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.

Prepare YouTube and the RTMP branch

YouTube requires a verified channel with live streaming enabled. YouTube Help says enabling a first live stream takes at least 24 hours after the first request, so do not leave activation until just before a scheduled broadcast. The encoder workflow supplies a server URL and stream key; consult YouTube’s current instructions for your account and encoder (YouTube Help: stream across platforms).

The GStreamer rtmpsink reference demonstrates an FLV muxer upstream of the sink, and the RTMP plugin index describes the sink as sending FLV content over RTMP (rtmpsink; RTMP plugin index). Ensure the selected encoders and muxer negotiate compatible caps and that the live branch connects to the endpoint YouTube currently provides.

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
  • Treat the stream key like a password. Do not publish a real key in examples, source repositories or logs.
  • Use YouTube Studio’s current server URL and stream key rather than assuming a permanent endpoint format.
  • Check the channel’s rights to the material being broadcast. A technically valid RTMP stream does not grant permission to use copyrighted video or audio; review YouTube’s current copyright and live-stream rules for your content.

Build and validate the pipeline in stages

  1. Test capture and encoding alone. Confirm the source is producing the expected audio and video, timestamps advance, and the output caps match the next elements in the chain.
  2. Add the recording branch. Record multiple completed segments. Check that they open, have advancing timestamps and split as expected given the GOP structure and configured limits.
  3. Add the queued live branch. Confirm the FLV-to-RTMP chain negotiates and reaches YouTube using the current server URL and stream key. Do not diagnose recording and RTMP failures at the same time if they can first be isolated.
  4. Run both branches together on the target machine. Watch for dropped buffers, encoder load, storage throughput, upload stability and GStreamer bus errors. No universal capacity threshold is established; the workload and hardware determine the margin you need.
  5. Test failure and clean shutdown. Check what happens if the network or an output fails, and close the pipeline cleanly so the muxer can finalize its current file. Do not assume an abruptly interrupted process leaves a complete, playable final segment.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common failures

Symptom Likely area to check Next step
Pipeline will not link or reports caps negotiation errors Elements may not agree on stream formats, or the required plugins may not be installed. Test the capture/encode path first; inspect negotiated caps and verify each muxer’s accepted inputs before reconnecting both branches.
Segments are longer or larger than the configured threshold Splits occur at video keyframes, and a file must contain at least one GOP. Review GOP length and threshold units. For time-based requests, consider send-keyframe-requests with max-size-bytes=0.
A completed segment does not play independently The video may not use closed GOPs, or the file may not have finalized properly. Check GOP configuration and test a clean pipeline shutdown; inspect more than the last segment to separate boundary problems from an interrupted final write.
YouTube does not receive the stream The endpoint or key may be wrong, live streaming may not be enabled, or the RTMP chain may not produce compatible FLV. Verify activation in YouTube Studio, refresh the supplied endpoint details, protect the key, and test the FLV-to-RTMP branch on its own.
Recording and stream both stutter or drop buffers The shared source, encoder, machine, disk or network may be overloaded. Compare each branch running alone with both together; monitor encoder load, storage throughput, upload stability and bus errors on the actual system.
Only the last file is incomplete after a stop The process may have exited before muxer finalization. Stop the pipeline cleanly and verify the finalized file before relying on it as an archive.

Or let it run in the cloud

If your goal is to keep uploaded video looping on a YouTube channel rather than capture a live camera or other source, StreamNeo is a different option from building a GStreamer pipeline: upload a recording or playlist, add your YouTube stream key once, and go live. Its cloud service keeps the stream running without a computer or home connection staying on.

  • Nothing has to stay powered on at home.
  • Uploaded video streams as made, up to 4K 60fps, at one price per slot rather than quality tiers.
  • StreamNeo automatically recovers if YouTube drops the stream.
  • The first day is free with no card, one free day per account.

Monthly: $9.99 per month. See 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.
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.

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. That’s Greece: How to Choose Your TripAdmit one · ArtThat's Greece: How to Choose Your TripOpened05 OCT 2026Runtime3 min
  2. Class of 92 – Out of Their League – Episode 1Admit one · SportsClass of 92 - Out of Their League - Episode 1Opened05 OCT 2026Runtime2 min
  3. The Rise of the NOTORIOUS: The story of Conor McGregorAdmit one · SportsThe Rise of the NOTORIOUS: The story of Conor McGregorOpened05 OCT 2026Runtime2 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.