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.

To stream a prerecorded gaming video to YouTube Live from an Ubuntu VPS, install FFmpeg with APT, upload and inspect the video, then run FFmpeg with live input pacing and YouTube’s current server URL and stream key. Installation is only the first step: YouTube account eligibility, encoder settings, VPS capacity, and possible timestamp problems when looping all affect whether a rerun works.

Before you begin

  • An Ubuntu VPS with sudo access and APT configured.
  • A prerecorded gaming video stored on your computer, ready to upload to the VPS.
  • A YouTube channel eligible for live streaming, plus a stream created or selected in YouTube Studio’s Live Control Room.
  • Enough VPS CPU and outbound network capacity for the resolution, frame rate, and bitrate you choose.

YouTube says live streaming requires a verified channel with no live-streaming restrictions in the previous 90 days, and its current requirements page states a minimum age of 16. Check eligibility and confirm the Live Control Room accepts your stream before treating a command failure as an Ubuntu problem: YouTube live-streaming requirements.

Install and verify FFmpeg

Ubuntu packages FFmpeg through APT. On the VPS, run:

sudo apt update
sudo apt install ffmpeg
ffmpeg -version

The last command prints the installed build’s version and configuration. The package version depends on the Ubuntu release and configured repositories; do not assume every VPS has the same build. Ubuntu documents APT package operations in its server package-management guide, and maintains release-specific FFmpeg package documentation for Ubuntu 24.04 (Noble).

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
LAPGEAR Home Office Pro Lap Desk - Black Carbon, Fits 15.6” Laptops
  • Spacious Design: Measuring 21.1" wide and 14.1" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
  • Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy ergonomic support with the integrated cushioned wrist rest.
  • Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
  • Durable Surface: Work with confidence on our lap desk's solid surface, featuring a sleek black carbon color, ensuring optimal air circulation to prevent your laptop from overheating.
  • On-the-Go Convenience: With an integrated handle and lightweight design (2.8 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.

Upload and inspect the gaming video

Copy the file to the VPS

Use your preferred secure file-transfer method, such as SCP, and note the full path on the server. For example, if you upload the file to /home/ubuntu/, the path might be /home/ubuntu/gameplay.mp4. Replace that example with the actual path and filename; paths and capitalization must match exactly.

Check the media streams

Before going live, inspect the file’s streams and properties with:

Rank #2
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.
ffprobe -hide_banner /home/ubuntu/gameplay.mp4

Confirm the file opens and note its video and audio codecs, dimensions, and frame rate. If the file has no audio stream, remove the audio output options from the example command below rather than assuming FFmpeg can encode audio that is not present. If the file is damaged or uses an unsupported configuration, resolve that before troubleshooting YouTube ingest.

Get the YouTube destination and protect the stream key

In YouTube Studio, open the Live Control Room and create or choose the stream you intend to use. Copy the current server URL and stream key shown for that stream. YouTube’s setup instructions say: “To start streaming, enter your YouTube Live server URL and stream key into your encoder.” See YouTube’s encoder setup instructions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Yilador Webcam Cover 3 Pack, 0.03 inch Ultra Thin Laptop Camera Cover Slide
  • Note: Not suitable for MacBooks released after 2023 or devices with a protruding front camera; Not applicable to full-screen or notch-style tempered glass screen protectors; Do not use on the rear camera of the phone.
  • 💻 Why Do You Need a Webcam Cover Slide? — Safeguard your privacy by covering your webcam with our reliable webcam cover when not in use. Don't let anyone secretly watch you. Stay protected!
  • ✅ Thin & Stylish — Enhance your laptop's functionality and aesthetics with our 0.027" ultra-thin webcam covers. Seamlessly close your laptop while adding a touch of sophistication.
  • ✅ Fits Most Devices — Compatible with laptops, phones, tablets, desktops! Keep your privacy intact on Ap/ple, Mac/Book, iPh/one, iP/ad, H/P, L/novo, De/ll, Ac/er, As/us, Sa/msung devices.
  • ✅ 365 Days Protection — Our upgraded 3.0 adhesive ensures a strong hold that won't damage your equipment. Experience reliable, long-term privacy protection day in and day out.

Treat the stream key like a password: it routes your encoder’s feed to your stream. Do not publish it in an article, screenshot, public script, or shared terminal history. Keep it in a private configuration or environment variable where practical, and rotate it in YouTube Studio if it is exposed. Use the exact destination YouTube supplies; generic RTMP examples may not match the current ingest URL or stream configuration.

Choose settings that fit YouTube and your VPS

YouTube’s encoder guidance supports H.264, H.265/HEVC, or AV1 video, AAC or MP3 audio, constant bitrate (CBR), and frame rates up to 60 fps. It recommends a two-second keyframe frequency and says the interval should not exceed four seconds. Its bitrate table varies by codec, resolution, and frame rate; for H.264 it lists these recommended video bitrates:

Rank #4
AboveTEK Portable Laptop Lap Desk w/Retractable Left/Right Mouse Pad Tray, Non-Slip Heat Shield Tablet Notebook Computer Stand Table w/Sturdy Stable Work Surface for Bed Sofa Couch or Travel
  • Anti-Slip Surface - Transform your laptop into a mobile workstation with the AboveTEK portable laptop lap desk. The anti-slip surface provides a strong grip for laptops up to 15.6 inches(Diagonal), while the double rubber strip on the bottom ensures a stable display or typing experience on your lap, couch, or bed.
  • Retractable Mouse Pad - Retractable laptop mouse pad extends on both directions for the left/right handed with elevation along the edges for stopping mouse from falling off. The size of laptop tray is 14" X 9.7" and the size of mouse pad is 7.4" X 6.1".
  • Effective Heat Shield - The effective heat shield made of sturdy and thick material protects your laptop from overheating. Prioritizes your comfort and safety, an ideal lap pad or board for working anywhere.
  • EASY to Carry and Store - With an ergonomic and simplistic design, the lap desk is portable to store in a backpack. Only 15" in size, 2.2 lb of weight and with slim 0.6 inch thickness, it is ready to be easily carried around.
  • Widely Applicable - The smooth platform accommodates laptops and tablets up to 15.6 inches(Diagonal), making it a versatile accessory and one of the best gifts for mom, dad, students and professionals. Perfect for use as a laptop bed tray or tablet holder anywhere at home, library, or park.
H.264 output YouTube recommended video bitrate
720p at 30 fps 8 Mbps
1080p at 30 fps 14 Mbps
1080p at 60 fps 17 Mbps

These are YouTube’s recommendations, not a guarantee that a particular VPS can encode and send the stream reliably. Pick an output resolution and frame rate the VPS can sustain, then allow outbound network headroom above the stream bitrate. YouTube recommends RTMPS for secure ingest, a speed test, and a test with similar audio and motion while monitoring stream health. Check its current live encoder settings before streaming, because recommendations can change and settings depend on codec, resolution, and frame rate.

Run FFmpeg and send the video to YouTube Live

This illustrative command reads the file in real time, encodes H.264 video and AAC audio, and sends an FLV output to an RTMP-style destination:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Sale
LAPGEAR Home Office Lap Desk – Pink, Fits 15.6” Laptops
  • Spacious Design: Measuring 21.1" wide and 12" deep, our lap desk comfortably fits most laptops up to 15.6". Extra room for accessories ensures convenience.
  • Enhanced Functionality: Packed with handy features, including a 5x9" precision tracking mouse pad and a built-in phone slot for seamless work or video calls. Plus, enjoy laptop support with the integrated device ledge.
  • Cool Comfort: Enjoy a stable surface with our lap desk's dual bolster cushion, designed for comfort and airflow, keeping your lap cool during extended use.
  • Durable Surface: Work with confidence on our lap desk's solid surface, featuring a blush pink color, ensuring optimal air circulation to prevent your laptop from overheating.
  • On-the-Go Convenience: With an integrated handle and lightweight design (2.14 lbs), our lap desk is portable for travel or moving around the house, offering flexibility in any space.
ffmpeg -re -stream_loop -1 -i /home/ubuntu/gameplay.mp4 
  -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k 
  -pix_fmt yuv420p -g 60 -c:a aac -b:a 128k 
  -f flv 'rtmps://YOUTUBE_INGEST_URL/STREAM_KEY'

This is a template, not a universal preset. The example bitrate and keyframe setting are not a match for every resolution, frame rate, file, FFmpeg build, or YouTube recommendation. Substitute the actual video path and the exact server URL and key from Live Control Room, and adjust codec, output resolution, frame rate, bitrate, and keyframe interval to suit YouTube’s current guidance and the VPS. Do not leave placeholder credentials in a command you run.

The -re option paces input approximately in real time; the output muxer and destination protocol must also match the ingest setup. Ubuntu’s FFmpeg manual illustrates real-time input pacing and FLV output to an RTMP destination, while noting that RTMP destinations have server and application/path components: Ubuntu FFmpeg manual. Follow YouTube’s provided URL rather than constructing one from a generic example.

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

Looping a video: test timestamps before relying on a rerun

The command uses -stream_loop -1 to request infinite input looping, but do not assume every file and installed FFmpeg build will repeat cleanly. FFmpeg’s loop-filter documentation says looping does not change source timestamps and warns that it can generate non-monotonic timestamps. That can interfere with encoding or ingest at a loop boundary. The cited Ubuntu loop-filter manual is from the Bionic-era documentation, so verify behavior with your installed build and exact media file: Ubuntu FFmpeg filters manual.

  • Test the exact command and file before depending on an unattended rerun.
  • Watch FFmpeg’s output around the point where the video repeats for timestamp warnings or encoder errors.
  • Check YouTube Live Control Room’s stream health to distinguish a timestamp or encoding problem from a destination or network failure.
  • If timestamps fail at the boundary, investigate timestamp handling for the installed FFmpeg version and file rather than assuming a loop option alone fixes it.

Keep the DIY stream running on a VPS

After FFmpeg connects, leave the process running and monitor both its logs and YouTube’s stream health. A VPS avoids needing your home computer to stay on, but it does not remove the need to maintain the process, have adequate VPS resources and network capacity, or respond to a failed stream. Test the loop, audio, and output quality under conditions like the actual stream before relying on it.

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

Common problems and fixes

Symptom What to check Practical next step
ffmpeg: command not found Whether installation completed and the command is available in the shell. Run sudo apt update, install with sudo apt install ffmpeg, then verify with ffmpeg -version.
YouTube does not receive the feed Channel eligibility, the selected Live Control Room stream, and the exact server URL and stream key. Confirm the account meets YouTube’s live requirements; copy the current destination and key again, keeping the key private.
Connection drops or stream health degrades Outbound bandwidth headroom, network stability, and whether the VPS can sustain the selected encoding settings. Run a speed test, reduce output demands if needed, and test while monitoring Live Control Room stream health.
FFmpeg reports timestamp errors when the video repeats Warnings at the loop boundary and the behavior of the installed FFmpeg build with that file. Test the exact input and command; investigate timestamp handling instead of assuming looping rewrites timestamps.
Video arrives but audio is missing or wrong The input’s audio stream and the audio codec/output options. Inspect the file with ffprobe; remove audio encoding options if the source has no audio, or correct the source/encoding setup.

Or let it run in the cloud

If the goal is a YouTube channel that keeps prerecorded videos live without maintaining an FFmpeg process on your VPS, StreamNeo is a cloud service for looping uploaded videos and playlists to YouTube. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home; each slot streams the uploaded quality up to 4K 60fps at one flat price per slot, and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly billing is $9.99 per month. Start the free day with 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.