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
VGSources
Blog

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

Use tee and queued branches to record segmented files with splitmuxsink while sending an FLV stream to YouTube through rtmpsink.
Length6 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use GStreamer’s tee element to fan out a shared capture pipeline into two queued branches: send one to splitmuxsink for sequential local recordings, and send the other through an FLV muxer to rtmpsink for YouTube. This is a pipeline design, not a universal copy-and-run command: the exact source, audio/video links, encoding chain and RTMP endpoint depend on your setup.

How the two-output pipeline works

The source and any processing that both outputs can share feed a tee. Put a queue immediately on each branch so recording and network output can run independently rather than blocking each other as readily.

  • Recording branch: queue → splitmuxsink, which creates sequential files.
  • YouTube branch: queue → stream-specific encoding or parsing → flvmux → rtmpsink.

The GStreamer Project describes tee as a one-to-many pipe fitting and splitmuxsink as a bin that muxes streams into files subject to time or size limits (tee documentation; splitmuxsink documentation). Its RTMP sink documentation demonstrates an FLV muxer upstream of rtmpsink (rtmpsink documentation).

Topology sketch

[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 and stream key>"

This is schematic, not tested command-line syntax. A real pipeline may need separate audio and video paths, explicit linking or a different order of parsing and encoding. Confirm that the installed elements and chosen codecs negotiate compatible caps. The documentation does not establish one universally correct way to combine YouTube’s current server URL and key in rtmpsink’s location; follow the current encoder instructions in YouTube Studio and validate the endpoint locally. Never put a real stream key in published examples, source repositories or logs.

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.

Choose where encoding happens

The right placement depends on whether the local recording and YouTube output can use the same encoded streams.

Encode once before the tee

If both outputs can use the same codecs and encoded format, encoding before the tee can avoid duplicating encoder work. Ensure the downstream recording muxer and FLV muxer both accept the resulting streams.

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.

Branch before encoding

If the local files and live output need different codecs, resolutions or other encoding choices, branch earlier and use a separate encode chain on the live branch (or on both branches as needed). This adds workload; test CPU or GPU capacity and timing on the target machine.

Neither design is a universal winner. The trade-off depends on codec compatibility, the desired recording container and quality, available encoder headroom, storage throughput and the stability of the upload connection.

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.

Configure splitmuxsink for usable local files

splitmuxsink wraps a muxer and sink, beginning a new file when the mux contents approach a configured maximum size or time. For video, it splits at keyframe boundaries. It defaults to mp4mux and filesink, and those can be changed. It supports exactly one input video stream, with accompanying audio and subtitle streams, according to the GStreamer Project reference.

Set the file pattern and threshold

Use a location pattern such as record-%05d.mp4 to give successive files distinct names. Set max-size-time in nanoseconds or max-size-bytes in bytes; a value of zero disables that limit. Choose a threshold that suits your storage and expected segment lengths.

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

Account for keyframes and closed GOPs

Video splits happen on keyframes, not at arbitrary exact instants. A segment can therefore exceed its nominal time or size threshold when the next keyframe is later; the minimum segment size is one GOP. For independently playable video segments, use closed GOPs. If predictable time-based boundaries matter, use a regular keyframe interval. The documented send-keyframe-requests property can request a keyframe at each time threshold, but it only works when max-size-bytes=0.

Consider asynchronous finalization only for a reason

With async-finalize=true, the old muxer/sink pair is detached to finish the preceding fragment while a new pair starts. In this mode, configure muxer-factory and sink-factory rather than direct muxer and sink object properties. This is an option to evaluate for the workload, not a guarantee that storage bottlenecks or other failures will disappear.

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.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Prepare YouTube before connecting the live branch

  1. Verify the channel and enable live streaming. YouTube Help says first-time activation can take at least 24 hours after the first request; enable it ahead of a scheduled test (YouTube Help: stream across platforms; page accessed 2026-10-03).
  2. In YouTube Studio’s current encoder workflow, obtain the RTMP server URL and stream key. The exact interface and endpoint details may change, so use the current instructions shown for your account.
  3. Supply the endpoint and key securely to the application or pipeline. Treat the key as a credential, and do not expose it in logs or shared code.
  4. Confirm the selected encoder and muxer produce streams accepted by flvmux, and that the resulting FLV reaches rtmpsink and connects to YouTube.

The cited official material does not prescribe one best codec, bitrate, resolution, frame rate, keyframe interval or audio profile for every channel and network. Set those for your source, encoder and available upload, then check YouTube’s current guidance and validate the complete stream.

Build and validate in stages

  1. Test capture and encoding alone. Check that expected audio and video are present, timestamps advance and output caps match what the next elements need.
  2. Add the recording branch. Let multiple segments complete. Open them, inspect timestamps and verify that split timing reflects the configured threshold and GOP boundaries.
  3. Add the queued live branch. Check FLV negotiation and confirm that the RTMP connection reaches YouTube using the current server URL and stream key.
  4. Run both branches together on the target machine. For a meaningful duration, watch for dropped buffers, encoder load, storage throughput, upload stability and GStreamer bus errors. Capacity requirements vary by workload; the official references provide no universal thresholds.
  5. Test shutdown and failure handling. Close the pipeline cleanly so the muxer can finalize the current file. Do not assume a forced process termination leaves the last segment complete and playable.

Common problems and fixes

Symptom Likely cause What to check
A branch stalls or the other output is disrupted Missing queues or downstream backpressure Put a queue on each tee branch; inspect logs and buffer flow to identify which branch is falling behind.
Pipeline will not link or negotiate Incompatible pads, caps, codecs or missing plugins Check each element’s available pads and negotiated caps. Verify audio and video are linked into the appropriate muxers and that the required plugins are installed.
RTMP connection fails or YouTube receives no usable stream Incorrect or stale server URL/key, unsupported FLV inputs, or a connection problem Recheck the current YouTube encoder endpoint and key, verify the FLV chain, and inspect GStreamer errors without printing the secret key.
Segments are longer or larger than the configured limit Splitting waits for a video keyframe; a GOP can exceed the threshold Use a suitable regular keyframe interval; for time-driven requests, consider send-keyframe-requests with max-size-bytes=0.
Individual video segments do not play independently GOPs are not closed, or the final file was not finalized Configure closed GOPs for standalone segments and shut down the pipeline cleanly before relying on its last file.
Dropped buffers, recording gaps or unstable live output under combined load Encoder, storage or upload capacity is insufficient for this workload Measure each path separately, then together; reduce workload or adjust the design based on the bottleneck found. No single capacity figure applies to every source and machine.

Or let it run in the cloud

If your goal is an always-on YouTube channel rather than capturing a live camera or building a GStreamer pipeline, StreamNeo is a separate option for looping uploaded videos from the cloud. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay powered on at home; it streams your upload as made, up to 4K 60fps at one flat price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month. It streams to YouTube and plays uploaded videos; it is not a camera-capture replacement. Start the free day on 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.

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

  1. How To Create Custom Stickers & Shoutouts In Monster Hunter WildsMonster Hunter WildsBlog20min
  2. How to Get XL Gogoat in Pokemon Legends Z-A (An Extra-Large Gogoat)Pokemon Legends Z-ABlog20min
  3. How to Get Rotting Lightbringer in Diablo 4Diablo 4Blog17min
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Outdated Drivers Are Slowing You DownFree scan - exact matches

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.