Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PC×
Skip to content
DocumentaryTube
constant frame rate

How to Stream a Video File to YouTube Live at a Constant Frame Rate with FFmpeg

A practical FFmpeg workflow for real-time file playout to YouTube Live, with constant-frame-rate conversion, matching GOP settings, bitrate guidance and troubleshooting.

By DocumentaryTube Team 7 min read
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To stream a prerecorded file to YouTube Live at a constant 30 fps, have FFmpeg read it in real time, convert its output cadence with -vf "fps=30", encode it, and send it to the ingest URL and stream key shown in YouTube Studio. For 30 fps, a 60-frame GOP gives a two-second keyframe interval. The command below is a starting point: choose resolution and bitrate for your source and the upstream connection that must sustain the stream.

Live playout is different from uploading a video

A live stream sends a real-time feed to YouTube’s live ingest endpoint using a protocol such as RTMP or RTMPS and the stream URL and key from YouTube Studio. An ordinary upload creates a video file for YouTube to process. The frame-rate guidance differs: YouTube’s live encoder recommendations cover ingest settings, while its upload guidance says to encode and upload at the frame rate the video was recorded. See YouTube’s live encoder settings and YouTube’s upload encoding guidance.

Workflow Destination and timing Frame-rate approach Relevant controls
Live file playout Live ingest; play the file at real-time speed Choose an output cadence and convert to it when encoding Stream URL and key, protocol, keyframe interval, sustained bitrate
Normal video upload Upload a completed file for processing Use the recording frame rate, as YouTube recommends File/container and upload encoding settings

Prepare the FFmpeg command

This example loops input.mp4, converts the video to 30 fps, encodes H.264 and AAC, and sends an FLV stream to YouTube. Replace the endpoint placeholder with the server URL and stream key provided in YouTube Studio; do not share or publish the key.

ffmpeg -re -stream_loop -1 -i input.mp4 
  -vf "fps=30" 
  -c:v libx264 -preset veryfast -pix_fmt yuv420p 
  -b:v 10M -maxrate 10M -bufsize 20M 
  -g 60 -keyint_min 60 -sc_threshold 0 
  -c:a aac -b:a 128k -ar 44100 
  -f flv "rtmp://SERVER/STREAM_KEY"

The command is an illustrative starting point, not a tested or universally suitable recipe. It assumes an FFmpeg build that includes libx264; available encoders depend on how FFmpeg was built. The 10 Mbps video bitrate is YouTube’s recommended H.264 bitrate for 1080p30 live ingest, not a guarantee that your connection can sustain it. YouTube’s live recommendations vary by codec, resolution and frame rate; for H.264, the page lists 8 Mbps for 720p30 and 17 Mbps for 1080p60. Consult the current live encoder table for your target and leave enough stable upload capacity for the entire stream.

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

What each important option does

  • -re reads the input at its native playback speed instead of sending the file as fast as the machine can process it. This is appropriate for playing a file as a live feed.
  • -stream_loop -1 repeats the input indefinitely. Omit it if the stream should end when the file finishes.
  • -vf "fps=30" converts the video to a 30-fps output cadence, dropping or duplicating frames as needed. Change 30 to the cadence you intend to send.
  • -c:v libx264 selects the H.264 encoder; -preset veryfast trades some compression efficiency for lower encoding workload. H.264 is used here as a straightforward compatibility profile; YouTube also lists H.265/HEVC and AV1 for live encoding.
  • -pix_fmt yuv420p selects a commonly used pixel format for this H.264 example.
  • -b:v, -maxrate and -bufsize set encoder rate-control parameters. These illustrative values do not guarantee a constant instantaneous bitrate. Choose suitable rate control for your encoder and verify behavior in a test.
  • -g 60 sets a 60-picture GOP. At 30 fps, that is two seconds between keyframes. -keyint_min 60 and -sc_threshold 0 are used here to maintain a fixed keyframe cadence in the example.
  • -c:a aac -b:a 128k -ar 44100 encodes audio as AAC at 128 kbps and 44.1 kHz. Check that the input has the intended audio and that it sounds correct in the live preview.
  • -f flv selects the FLV muxer used for this RTMP example. Use the endpoint and protocol appropriate to the stream configuration YouTube provides.

Make the output constant frame rate

Use an encoding filter or output frame rate

For a normal video file being transcoded, -vf "fps=30" is an explicit way to request 30-fps output. FFmpeg’s output -r 30 can also duplicate or drop frames before encoding to achieve the requested output frame rate. The FFmpeg documentation distinguishes output frame-rate conversion from input -r.

Do not confuse input -r with frame-rate conversion

Input -r has a different function: it ignores stored timestamps and generates timestamps at the specified rate, a behavior intended for raw formats. Do not place input -r before an ordinary timestamped video file as a casual fix for variable frame rate; use an encoding path that converts the output cadence instead.

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.

Stream copy cannot create a new cadence

-c:v copy passes the compressed video through without re-encoding its frames. It therefore cannot turn an arbitrary variable-frame-rate source into a new constant-frame-rate cadence. For CFR conversion, encode the video and request the target output rate. FFmpeg’s documentation describes these input and output options.

Match GOP length to the chosen frame rate

YouTube recommends a two-second keyframe interval for live encoding and says not to exceed four seconds. GOP length is measured in frames, so calculate it from the output frame rate. The FFmpeg all-options documentation defines GOP size in pictures; see YouTube’s recommendation and FFmpeg’s all-options reference.

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.
Output frame rate GOP for a two-second interval
25 fps 50 frames
30 fps 60 frames
60 fps 120 frames

For fixed-rate output, the codec time base should be 1/frame_rate and timestamp increments should be one, as described in the FFmpeg all-options documentation. In practice, choose the output cadence and matching GOP together, then check YouTube’s stream health for keyframe or frame-rate warnings.

Choose resolution, codec and bitrate for the actual stream

The example’s 1080p30 bitrate is not a default for every source. Match output resolution and frame rate to the material and the quality you want, then use the live bitrate recommendations for the selected codec and target. A recommended encoder bitrate is a platform setting, not proof that a particular internet connection can hold it steadily. If the upstream link varies or is shared, choose a conservative target and test it under realistic conditions.

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

YouTube lists RTMP/RTMPS, H.264, H.265/HEVC and AV1 for live encoder configurations, with frame rates up to 60 fps. The command above uses H.264; its bitrate examples apply only to the H.264 targets identified above. Check YouTube’s live settings table for the codec, resolution and frame rate you plan to send.

Test the stream before relying on it

  1. In YouTube Studio, create or open the live stream and copy the ingest URL and stream key into the command. Treat the key as a password.
  2. Run FFmpeg with representative footage, including the busiest motion and the audio you intend to use. Confirm the stream appears in YouTube’s preview and that picture and sound stay synchronized.
  3. Check the stream health indicators while it runs. YouTube recommends testing with similar audio and movement and monitoring stream health during the event; its encoder guidance and live streaming error messages explain common warnings.
  4. Only schedule or start the intended broadcast after checking the output cadence, keyframe interval, audio and sustained connection with a representative test.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common problems and fixes

  • YouTube reports an unsuitable frame rate: Confirm that the video is being encoded, not stream-copied, and that the output uses -vf "fps=30" or an appropriate output -r. Do not use input -r on a normal file as a substitute for conversion.
  • YouTube warns about keyframe timing: Match GOP size to output fps: for example, 60 frames at 30 fps. YouTube recommends two seconds and says not to exceed four; see its live error messages.
  • The stream buffers, drops frames or shows connection trouble: The configured bitrate may exceed stable upstream capacity, or encoding may be too demanding for the machine. Check stream health, reduce the target bitrate or output workload as appropriate, and test again against YouTube’s live recommendations.
  • FFmpeg says the encoder is unavailable: The installed build may not include libx264. Use an available compatible encoder or install an FFmpeg build that includes it, then confirm its supported options before adapting the command.
  • The stream does not start or reaches the wrong destination: Recheck the ingest URL and stream key in YouTube Studio, the selected protocol and the FLV output. Never paste a private key into public logs or posts.
  • The stream ends when the video ends: That is expected if looping is omitted. Add -stream_loop -1 before the input option when indefinite repeat is intended; omit it when a single play-through is desired.

Or let it run in the cloud

If your goal is an always-on YouTube stream of prerecorded videos, StreamNeo is a cloud alternative: upload a recording or build a playlist, add your YouTube stream key once, and go live. The cloud keeps playback running, so no computer, OBS or home connection has to stay on. It streams uploaded videos, not a live camera feed, and it is for YouTube.

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.
  • One flat price per slot for any quality up to 4K 60fps as uploaded, with no re-encode or quality tiers.
  • Automatic recovery if YouTube drops the stream.
  • The first day is free with no card; one free day per account.
  • Every slot includes one always-on stream, 10 GB storage per slot pooled across active slots, 24/7 looping and playlists, and StreamNeo team support. The product is the same on every plan; only the billing length changes.
  • Billing options: Daily $0.99 per day · Weekly $2.99 per week · Monthly $9.99 per month · 6 months $49.99 for 6 months · Yearly $89.99 a year.
  • UPI and cards are available in India; card checkout is available worldwide. For five or more slots, contact support.

See StreamNeo or its plan details. To try it, start at StreamNeo’s free first 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.

More from the Screening Room

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
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.