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

To loop an entire video and make an encoded output use a constant frame rate, put -stream_loop -1 before the input and re-encode with an output frame rate such as -r 30 or -fps_mode cfr. Use the source’s intended frame rate unless you have a reason to convert it: YouTube recommends encoding and uploading at the frame rate the video was recorded.

Loop the video and encode at a constant frame rate

This example repeats an MP4 indefinitely, encodes a one-hour output at 30 fps, and includes audio if the input has an audio stream:

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
  • Replace input.mp4 with your file and output.mp4 with the desired output filename.
  • Replace 30 with the intended frame rate. If the source rate is fractional, use the exact rational rate where appropriate, such as 30000/1001.
  • Change 3600 to the output duration in seconds. The command stops after that duration even though the input is set to loop indefinitely.
  • -stream_loop -1 is an input option, so it must appear before -i input.mp4. FFmpeg uses -1 for infinite repetition.
  • -map '0:a?' maps audio when present but allows the command to continue when the input has no audio. The video map selects the first video stream.

This is a starting point, not a guarantee for every source. Check the finished file’s playback and audio/video alignment, particularly if the source has unusual timestamps, variable frame rate, multiple tracks, or an audible or visible seam where the loop restarts.

Choose the frame rate before you encode

First determine the source’s intended frame rate and decide whether the output should preserve it. YouTube lists 24, 25, 30, 48, 50, and 60 fps as common rates, and says other rates are acceptable. Its recommendation is: “Content should be encoded and uploaded in the same frame rate it was recorded.” YouTube Help: YouTube recommended upload encoding settings.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#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.

Preserve the source rate

For footage intended to be 25 fps, use -r 25; for footage intended to be 29.97 fps, use a rational value such as -r 30000/1001. Preserving the intended cadence avoids an unnecessary conversion. Variable-frame-rate files can require additional inspection: do not assume a single reported rate captures every timestamp irregularity.

Convert only when you have a target-rate reason

If you encode at a different rate, FFmpeg may duplicate or drop frames to reach it. That changes the cadence; it does not create genuinely new motion. FFmpeg documents the output -r behavior as duplicating or dropping frames before encoding to achieve the selected constant output rate. FFmpeg documentation: Video Options.

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)

Use CFR deliberately, not as a stream-copy label

Re-encoding with output -r

The example command re-encodes video with -c:v libx264. In that mode, output -r can set the encoded rate; FFmpeg duplicates or drops frames as needed. To state the constant-frame-rate intent explicitly, you can add -fps_mode cfr alongside the output rate, for example -r 30 -fps_mode cfr. FFmpeg defines cfr as duplicating or dropping frames to attain the requested constant rate. FFmpeg documentation: Video Options.

Stream copy does not convert the cadence

Using -c:v copy avoids decoding and re-encoding the video, but it also means FFmpeg does not duplicate or drop frames to produce CFR. An output -r value with stream copy only signals a rate to the muxer; if that rate conflicts with packet timestamps, the resulting file may be invalid. Use stream copy when preserving the existing encoded stream matters more than changing frame cadence—not as a way to make variable cadence constant.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
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.

Choose whole-file looping or frame looping

Method What repeats When to use it
-stream_loop -1 The entire input file, indefinitely. Use it for repeating a complete video as the input to a longer encode or stream workflow.
Video loop filter Selected frames within the video. Use it for a frame-level effect or a short section that must repeat, rather than repeating the whole input.

For a finite number of whole-input repetitions, replace -1 with the desired loop count; 0 means no repetition. FFmpeg documents the input looping option and the separate video loop filter in its command-line documentation.

Check YouTube’s upload encoding recommendations separately

Looping and frame-rate conversion do not by themselves determine whether an export follows YouTube’s recommended upload encoding settings. For MP4 uploads, YouTube’s recommendations include H.264 video, 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. It recommends BT.709 for standard-dynamic-range color. These are platform recommendations, not mandatory settings for every workflow. YouTube Help: YouTube recommended upload encoding settings.

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

YouTube’s SDR bitrate recommendations vary by resolution and frame-rate group. For example, its table lists 1080p at 8 Mbps for standard frame rates and 12 Mbps for high frame rates; for 2160p/4K it lists 35–45 Mbps and 53–68 Mbps, respectively. Those are recommendations, not guaranteed quality outcomes or universal required bitrates. Consult YouTube’s current table for the resolution and frame-rate group you intend to upload.

The sample command uses H.264 and 4:2:0 pixel format, but it does not explicitly set every YouTube recommendation, such as profile, GOP structure, or bitrate. Add those only when your delivery requirements call for them and verify the resulting encode.

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

Troubleshoot common results

  • The output still is not constant frame rate: confirm that video is being re-encoded rather than copied, and set an output rate with -r; optionally add -fps_mode cfr.
  • The motion looks uneven after conversion: compare the source’s intended rate with the requested rate. Conversion can duplicate or drop frames; return to the source rate if no conversion is needed.
  • The output ends too soon or too late: check -t, which sets the requested output duration in seconds. Remember that -stream_loop -1 supplies repeated input but does not set the output duration.
  • The command fails on a silent video: retain the optional audio mapping -map '0:a?'; without the question mark, mapping a missing audio stream can fail.
  • There is a pause, click, or jump at the loop seam: inspect the source’s ending and beginning, including audio and timestamps. Repetition cannot make mismatched endpoints seamless.
  • The file behaves incorrectly after adding -r with -c:v copy: remove the frame-rate override or re-encode. Stream copy does not perform frame duplication or dropping.

Or let it run in the cloud

If the goal is a YouTube channel that stays live with uploaded videos, StreamNeo runs the stream from the cloud: upload a recording or playlist, add your YouTube stream key, and go live. Nothing has to stay on at home; it streams the upload as made, up to 4K 60fps at one price per slot, and automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly: $9.99 per month. See StreamNeo, or start the free 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.