October 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 PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk4 min

How to Keep Frame Rate Constant When Looping Videos to YouTube with FFmpeg

Use FFmpeg’s -stream_loop to repeat a video and re-encode at the intended output frame rate for a predictable YouTube upload.

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.

Use FFmpeg’s -stream_loop to repeat the whole input, and re-encode with an output frame rate to make the result constant-frame-rate (CFR). For example, -stream_loop -1 loops forever; -r 30 targets 30 fps. Keep the input’s actual intended frame rate unless you have a reason to convert it: YouTube recommends encoding and uploading at the rate the video was recorded.

Loop the whole video and encode at a constant frame rate

This example makes a one-hour MP4 from an input with video and possibly audio. It targets 30 fps; replace that with the source’s intended frame rate and change 3600 to the desired duration in seconds.

As an Amazon Associate I earn from qualifying purchases.

ffmpeg -stream_loop -1 -i input.mp4 -map 0:v:0 -map '0:a?' -t 3600 
  -c:v libx264 -r 30 -pix_fmt yuv420p 
  -c:a aac -movflags +faststart output.mp4
  • -stream_loop -1 repeats the entire input indefinitely. It is an input option, so place it before -i.
  • -map 0:v:0 selects the first video stream. -map '0:a?' selects audio if present, but does not fail if the input has none.
  • -t 3600 limits the output to 3,600 seconds, or one hour.
  • -c:v libx264 encodes the video as H.264; -r 30 sets the requested output rate during encoding.
  • -pix_fmt yuv420p selects a widely compatible pixel format, while -c:a aac encodes audio as AAC.
  • -movflags +faststart moves MP4 metadata toward the start of the file for playback convenience.

This is an illustrative starting point, not a tested command for every input. Inspect the source streams and review the finished file, especially if it has unusual timestamps, variable frame rate, multiple tracks, or an audible or visible seam where the loop restarts.

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

Choose the right frame rate before encoding

Preserve the recorded rate when possible

YouTube Help says: “Content should be encoded and uploaded in the same frame rate it was recorded.” Its listed common rates are 24, 25, 30, 48, 50, and 60 fps; other rates are acceptable too. If the source rate is fractional, use its actual rational value—for example, 30000/1001 rather than rounding it to 30—when that is the intended rate.

#1 Best Overall
Alienware Aurora Gaming Desktop, RTX 5070, Intel Core Ultra 7 265F
  • Legend perfected: Modern design with a matte basalt black finish in an optimized chassis with customizable AlienFX lighting zones, including the striking stadium lighting.
  • Game changing graphics: Step into the future of gaming and creation with the NVIDIA GeForce RTX 5070 graphics, powered by NVIDIA Blackwell architecture.
  • Marathon gaming unlocked: This high-performance technology ensures clean energy is consistently available, unleashing the top-level power of Intel Core Ultra 7 265F processor as you game, livestream, and multi-task for hours on end.
  • Total command: Alienware Command Center software allows you to create and edit AlienFX lighting across the ecosystem, choose and monitor your performance mode across distinct power states, and create custom gaming profiles for your whole library.
  • Dell Services: 1 Year Onsite Service provides support when and where you need it. Dell will come to your home, office, or location of choice, if an issue covered by Limited Hardware Warranty cannot be resolved remotely.

Know what changing the rate does

When FFmpeg re-encodes, output -r duplicates or drops frames to reach the requested rate. It does not create genuinely new motion. Converting a 24 fps source to 30 fps, for example, requires a different frame cadence; the new frames may be repeats. Avoid choosing an arbitrary rate merely to meet a supposed YouTube requirement.

You can also express constant-rate synchronization explicitly with -fps_mode cfr, alongside an output rate, such as -r 30 -fps_mode cfr. FFmpeg defines CFR mode as duplicating or dropping frames to attain the requested constant rate.

Rank #2
Dell Optiplex 7050 SFF Desktop PC Intel i7-7700 4-Cores 3.60GHz 32GB DDR4 1TB SSD WiFi BT HDMI Duel Monitor Support Windows 11 Pro Excellent Condition(Renewed)
  • Model: Dell OptiPlex 7050 Small Form Factor (SFF)
  • Processor: Intel Core i7-7700 3.60 GHz
  • Memory: 32GB DDR4 Ram
  • Storage: 1TB Solid State Drive (SSD) Fast Boot + Storage
  • Operating System: Windows 11 Pro (64-bit)

Why stream copy does not make frame rate constant

Stream copy, such as -c:v copy, passes the encoded video through without decoding and re-encoding its frames. It therefore cannot duplicate or drop frames to change cadence. In this mode, output -r only signals a rate to the muxer; if that rate conflicts with packet timestamps, the file may be invalid. Use stream copy when preserving the existing encoded stream matters and its cadence is already suitable—not as a frame-rate conversion method.

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

Repeat the whole input or loop selected frames

Method What repeats Best fit
-stream_loop The complete input file Repeating a full video or building a longer output from it
Video loop filter Selected frames Frame-level looping effects or repeating a short section of frames

For a finite number of input repetitions, replace -1 with the desired loop count. FFmpeg defines 0 as no repetition and -1 as infinite repetition. The loop filter is a separate frame-level tool; for ordinary whole-file repetition, -stream_loop is the direct option.

Rank #3
ZYNEEX Prebuilt Gaming Desktop PC, AMD Ryzen 5 5500, GeForce RTX 3050 6GB,16GB DDR4 3200MHz RAM, 1TB NVMe SSD, ARGB Air Cooling, Wi-Fi,Tower Computer for Gaming, Streaming, Editing
  • 【POWERFUL PERFORMANCE】 – AMD Ryzen 5 5500 6-Core 12-Thread Desktop Processor (up to 4.2GHz). Effortlessly handle 3A games, 4K video editing, and multitasking.
  • 【SMOOTH GAMING】 – Equipped with GeForce RTX 3050 6GB GDDR6 Graphics Card. Experience high-frame-rate 1080P gaming with ray tracing.
  • 【FAST & AMPLE STORAGE】 – 16GB DDR4 3200MHz RAM + 1TB NVMe SSD. Enjoy rapid game loads, quick file transfers, and ample space for your entire library.
  • 【KEEP COOL】 – Advanced ARGB air cooling system with multiple fans. Maintains stable performance and low noise even during marathon gaming sessions.
  • 【READY TO USE】 – Features built-in Wi-Fi, multiple USB ports, HDMI and DisplayPort (DP) outputs for flexible monitor connectivity. A complete prebuilt gaming computer, plug and play right out of the box.

Check YouTube’s upload recommendations separately

Looping and frame-rate conversion control how FFmpeg builds the file. YouTube’s other upload recommendations concern the encoded file’s compatibility and quality, not the loop operation itself. For video uploads, YouTube recommends MP4, H.264, progressive scan, High Profile, two consecutive B-frames, a closed GOP with a GOP length of half the frame rate, CABAC, and 4:2:0 chroma subsampling. For standard dynamic-range video, it recommends BT.709 color space.

YouTube’s recommended SDR bitrates vary by resolution and frame-rate group. Examples are 8 Mbps for 1080p at standard frame rates and 12 Mbps for 1080p at high frame rates; for 2160p/4K, the corresponding recommendations are 35–45 Mbps and 53–68 Mbps. These are recommendations, not guaranteed quality levels or mandatory fixed rates.

Rank #4
Thermaltake LCGS View i570-170 Gaming Desktop (Intel Core™ i9-14900KF, ToughRam 32GB DDR5 6000MT/s RGB Memory, NVIDIA® GeForce RTX™ 5070, 1TB NVMe M.2, WiFi, Windows 11) V17B-B76B-570-LCS
  • Intel Core i9-14900KF CPU, B760 chipset motherboard, 32GB DDR5 6000MT/s RGB Memory, 1TB NVMe M.2, WiFi, Windows 11
  • NVIDIA GeForce RTX 5070, Display Port/HDMI
  • Closed Loop Liquid Cooling with 240mm Radiator
  • 2x USB 3.0, 1x Headphone, 1x Mic
  • PSU Power cover with Filtered Ventilated Vertical Side mount Radiator support

Troubleshoot common results

  • The video still has variable frame rate: confirm that FFmpeg is re-encoding and that an output rate or CFR mode is set. Stream copy does not reshape frame cadence.
  • The output duration is wrong: check -t and express it in seconds for this example. Verify that the input can be read repeatedly and inspect timestamps if the source has unusual timing.
  • There is no audio: the optional audio map allows silent inputs, so an output without audio may be expected. If the source has multiple audio tracks, this example selects only the first.
  • The loop restart is abrupt or clicks: inspect the transition between the end and start of the source. A whole-file loop repeats that seam; the command does not smooth it.
  • Playback or upload compatibility is poor: check the output container, codec, scan type, pixel format, and color space against YouTube’s upload guidance, and review the encoded file before uploading.
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 a 24/7 YouTube stream from uploaded videos rather than a finished file to upload, StreamNeo can keep the loop running without a computer or home connection staying on. Upload a recording or build a playlist, add your YouTube stream key once, and go live. It streams the uploaded video as made, up to 4K 60fps, at one flat price per slot; it does not re-encode. It can automatically recover if YouTube drops the stream. The first day is free with no card, one free day per account. Monthly service is $9.99 per month. StreamNeo streams to YouTube only. Learn about StreamNeo, or start the free day.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
HP Workstation PC Desktop Computer | Editing and Design | NVIDIA Quadro K1200 4GB GPU | Intel Core i5 | 32GB DDR4 RAM, 1TB SSD + 4TB HDD | Wi-Fi 5G + Bluetooth | Windows 11 Pro (Renewed)
  • Content Creation Workstation PC: Powered by the Intel Hexa-Core i5 (8th Gen) processor with 32GB DDR4 RAM and NVIDIA's Quadro K1200 4GB Graphics Card, this Workstation PC Computer is built for creative environments
  • NVIDIA's Quadro K1200 4GB Graphics Card: Graphic support built to be an efficient workstation for creative applications like photo and video editing, 3D Design, AutoCAD, and much more
  • Software Compatibility: Workstation PC for use with independent software vendors (ISV) and certified for use with modeling, rendering, and engineering software from Adobe, AutoCAD, 3DS Max, and many more
  • Massive Storage Solutions: An ultra-fast 1TB Solid State Drive (SSD) setup as the primary boot device; Boot and load programs with little to no lag; An additional 4TB Hard Disk Drive (HDD) is installed for additional storage; Never run out of storage
  • Connectivity for Creative Projects: USB 3.0 (x5) | USB 2.0 (x4) | USB Type-C (x1) | DisplayPort (x2) | Serial Port (x1) | VGA Port (x1) | Audio Combo Jack (x1) | Audio In (x1) | Audio Out (x1) | RJ-45 Ethernet (x1) | Internal SATA (x3)

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 Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

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.