October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober 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 Pre-Recorded Videos to YouTube Live from Ubuntu with FFmpeg

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

You can send a local video file to YouTube Live from Ubuntu with FFmpeg by enabling live streaming on your channel, copying the event’s RTMPS ingest URL and stream key from YouTube Studio, then running FFmpeg with real-time input, compatible encoding, and the correct destination. For a scheduled event, starting FFmpeg is not enough: check the preview in Live Control Room and click Go live.

Before you start

  • Your YouTube channel must be verified and must not have had live-streaming restrictions in the previous 90 days. YouTube’s eligibility and setup guidance is in its live streaming help.
  • Have the video file and a working internet connection on the Ubuntu computer. This method runs FFmpeg locally, so the computer and connection need to remain available for the stream’s duration.
  • Install an FFmpeg build that includes the encoders, muxer, and RTMPS support you intend to use. Availability depends on the build; check ffmpeg -version and ffmpeg -protocols, and inspect available encoders with ffmpeg -encoders.
  • Keep the stream key private. Treat it like a password: do not put it in a shared script, screenshot, public log, or command history. Reset it in YouTube’s stream settings if you think it has been exposed.

Create the YouTube Live event and get its ingest details

  1. Open YouTube Studio and go to Create > Go live to open Live Control Room. Create an immediate stream or schedule one for later.
  2. In the stream or encoder settings, copy the stream URL and the stream key for that event. Use the RTMPS address where available. YouTube describes RTMPS as an encrypted extension of RTMP in its RTMPS setup guide.
  3. Use the endpoint currently displayed in your account. Do not copy a hostname from an online command example: YouTube’s ingest address and the key are tied to your setup and event.

A scheduled event can be promoted and can offer reminders. Its public start is still a separate action: after the encoder connects, inspect the Live Control Room preview and click Go live when you are ready.

Choose settings that fit the source and connection

YouTube’s current encoder settings list RTMP/RTMPS ingest, recommend RTMPS, and support H.264, H.265/HEVC, or AV1 video. Recommendations can change, so consult that page before a real event, especially if you are using a codec other than H.264.

  • Frame rate and keyframes: YouTube supports up to 60 fps, recommends a two-second keyframe interval, and says not to exceed four seconds. Set the GOP length to twice the source frame rate for a two-second interval: for 30 fps, 60 frames; for 60 fps, 120 frames.
  • Rate control and bitrate: use constant bitrate (CBR). For H.264, YouTube lists recommended ranges of 5–14 Mbps at 1080p30, 6–17 Mbps at 1080p60, 3–8 Mbps at 720p30, and 3–8 Mbps at 720p60. Choose a rate your upload connection can sustain; these are ingest recommendations, not a guarantee of stable delivery.
  • Audio: YouTube lists AAC or MP3 for RTMP/RTMPS. For stereo, its recommendations specify 44.1 kHz and 128 Kbps; for 5.1 audio, 48 kHz and 384 Kbps, with AAC required for 5.1 over RTMP/RTMPS.
  • Color: for SDR, YouTube recommends Rec. 709. Match the output to your source rather than assuming every file has the same resolution, frame rate, audio streams, or color characteristics.

These settings govern the encoded feed, not necessarily the existing file as-is. If the source’s frame rate, resolution, codec, or audio layout differs, FFmpeg may need to convert it. YouTube recommends checking upload capacity and testing with representative movement and audio.

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.

Run FFmpeg to send the video

The following is an illustrative H.264/AAC command pattern, not a tested command for every Ubuntu FFmpeg build, input file, or YouTube endpoint. Replace the placeholders, adapt the frame rate and GOP, and verify that your build supports libx264 and RTMPS before relying on it.

ffmpeg -re -stream_loop -1 -i input.mp4 
  -c:v libx264 -preset veryfast -b:v 6000k -maxrate 6000k -bufsize 12000k 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv 'rtmps://CURRENT_INGEST_URL/STREAM_KEY'
  1. Replace input.mp4 with the local file path. -re reads the file at approximately its native playback rate instead of sending it as fast as the machine can process it.
  2. Keep -stream_loop -1 only if you want continuous repeat playback. Remove it for one pass. A loop repeats the file; it does not create new material or change YouTube’s content policies.
  3. Adjust -g and -keyint_min for the source frame rate. The example’s value of 60 corresponds to a two-second interval only for 30 fps. For 60 fps, use 120. The command’s 6000 Kbps video bitrate is an example, not a universal setting; choose a value within YouTube’s current range for your resolution and frame rate that your connection can sustain.
  4. Replace the destination with the RTMPS URL and key copied from Live Control Room. Avoid pasting a real key into a shared script or a shell command that will be saved in history. Use a protected secret-handling method appropriate to your setup.

FFmpeg options and supported encoders vary by version and build. If an option or encoder is unavailable, check the local FFmpeg help and build details rather than assuming Ubuntu packages all include the same features.

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.

Preview, go live, monitor, and stop

  1. For a scheduled stream, start FFmpeg at least 15 minutes before the scheduled time, as YouTube recommends, and wait for the event preview in Live Control Room. For an immediate stream, monitor the incoming feed there as well.
  2. Check YouTube’s stream-health messages, confirm the expected video and audio, and verify the event is accessible from its watch page or channel page. A running FFmpeg process alone does not confirm a good or public stream.
  3. For a scheduled event, click Go live in Live Control Room when the preview is ready. YouTube also recommends setting up the encoder well ahead of time, testing the expected kind of motion and audio, and continuing to monitor quality.
  4. When finished, end the event in Live Control Room where applicable, then stop FFmpeg. YouTube says streams under 12 hours are automatically archived; do not assume that statement applies to longer sessions.

Troubleshooting

  • No connection or a timeout: confirm the event’s current RTMPS URL and key, check that the destination uses the right scheme and server, and verify RTMPS support in your installed FFmpeg build.
  • TLS or SSL error: make sure you copied the RTMPS address rather than an RTMP one. If the endpoint otherwise appears correct, YouTube’s guidance suggests trying port 443 where appropriate; use the current account-provided endpoint rather than constructing a server address from memory.
  • No preview in Live Control Room: check that FFmpeg is sending to the URL and key for the selected event, inspect FFmpeg’s output for errors, and check YouTube’s control-room messages.
  • Buffering or unstable ingest: test upload capacity, lower resolution or bitrate to a sustainable level, and test using representative motion. The chosen bitrate must fit the available upstream connection.
  • Missing or unsupported audio: inspect the input’s audio streams and FFmpeg mapping, then use an audio codec and sample rate supported by the selected ingest settings. YouTube currently lists AAC or MP3 for RTMP/RTMPS.
  • FFmpeg rejects an option or encoder: inspect ffmpeg -version, ffmpeg -encoders, and ffmpeg -protocols. The installed build may not include the requested encoder or protocol support.
  • Stream runs but viewers cannot watch it: verify preview, stream health, the event’s public status, and audio/video playback on the watch page. A process that has not exited can still be sending a feed with a wrong key, poor quality, or the wrong event state.

Copyright and YouTube channel rules

Using a prerecorded file does not grant permission to stream its music, gameplay footage, or other included material. Make sure you have the rights or permissions needed for the video and audio, and review YouTube’s applicable copyright rules before broadcasting. A continuously repeated video also remains subject to YouTube’s channel and monetization policies; looping it with FFmpeg does not guarantee eligibility or monetization.

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

Or let it run in the cloud

If your goal is an always-on YouTube stream rather than learning or operating a local FFmpeg workflow, StreamNeo is a cloud option: upload a recording or build a playlist, add your YouTube stream key once, and go live. It plays uploaded videos, not a live camera feed, and keeps the stream running without leaving an Ubuntu computer or home connection on. Every slot streams the upload as provided, up to 4K 60fps, at one flat price per slot; it also includes automatic recovery if YouTube drops the stream. The first day is free with no card. Monthly pricing is $9.99 per month.

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.
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
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.

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.

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.

Read next

Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair 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.