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

To loop a prerecorded video on YouTube Live with FFmpeg and an NVIDIA GPU, place -stream_loop -1 and -re before the input, encode with the locally available h264_nvenc encoder, and send the output to the RTMPS ingest address and stream name provided by YouTube. For H.264, set CBR, use YouTube’s recommended bitrate for your chosen resolution and frame rate, and target a two-second keyframe interval. The command below is a starting template—not a tested, ready-to-run configuration—so check your FFmpeg build and verify stream health in YouTube Studio before broadcasting publicly.

What you need before starting

  • An FFmpeg build that includes h264_nvenc, compatible NVIDIA hardware, and the required drivers and runtime support. NVIDIA branding alone does not establish NVENC compatibility.
  • A prerecorded video whose video, audio, frame rate, and timestamps you have checked. FFmpeg’s -stream_loop -1 repeats the input indefinitely; -re reads it at its native rate so a file is paced like a live feed. These are separate options.
  • A YouTube live stream configured to receive an encoder feed. Copy the ingest address and stream name shown in that stream’s configuration; they are not universal constants. YouTube recommends RTMPS, which encrypts data in transit through Google’s servers. YouTube’s encoder settings explain the recommended connection, and the Live Streaming API documentation describes ingest URL and stream-name fields.

Keep the stream key private. Do not publish it in a command example, screenshot, repository, or other material. Depending on the encoder, the stream name may be appended to the ingest URL or entered separately.

Choose an output mode and bitrate

Use the H.264 recommendations below as a starting point for the corresponding ingest resolution and frame rate. YouTube’s figures are recommended video bitrates, not guarantees of quality or minimum requirements. Choose a mode your upload can sustain reliably, and consult the current YouTube settings table before going live because platform guidance can change. The figures below are YouTube’s H.264 recommendations on a page accessed in 2026; no publication year is shown.

Ingest resolution and frame rate Recommended H.264 video bitrate
2160p60 50 Mbps
2160p30 42 Mbps
1440p60 34 Mbps
1440p30 21 Mbps
1080p60 17 Mbps
1080p30 14 Mbps
720p60 8 Mbps
720p30 8 Mbps
480p30 4 Mbps
360p30 4 Mbps

For YouTube’s H.264 guidance, use CBR, target a two-second keyframe interval, and do not exceed four seconds. YouTube’s advanced guidance also specifies square pixels, progressive scan, two B-frames, one reference frame, and CABAC. For SDR, it specifies Rec. 709 and 8-bit. Stereo audio guidance is AAC or MP3 at 44.1 kHz and 128 Kbps; for 5.1 audio, YouTube lists AAC at 384 Kbps. Match the output to the source and chosen mode rather than blindly forcing a frame rate or scaling setting.

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
Sale
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card
  • AI Performance: 767 AI TOPS
  • OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode)
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Axial-tech fan design features a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • A 2.5-slot design maximizes compatibility and cooling efficiency for superior performance in small chassis

Check what your FFmpeg build and GPU support

  1. Check the installed encoder options with ffmpeg -h encoder=h264_nvenc. NVENC preset names, tuning choices, rate-control details, and available capabilities depend on the FFmpeg build, GPU, and drivers.
  2. Inspect the source streams and timestamps before building the command. Confirm which video and audio tracks you intend to send, whether audio is present, and whether the source frame rate and duration are suitable for the output.
  3. If the source has multiple tracks, map the intended streams explicitly. If video and audio come from separate files, loop and pace each input independently, then map the intended streams; do not assume arbitrary files will remain synchronized without local inspection and validation.

NVIDIA documents -rc cbr as constant-bitrate rate control for streaming applications with strict bandwidth constraints. Its examples are general starting points, not a guarantee of performance for every live-streaming setup. FFmpeg still has work beyond encoding: it reads and demuxes files, may decode or filter video, handles audio, maps streams, and muxes the output. NVENC does not make CPU use zero. See NVIDIA’s FFmpeg guide for Video Codec SDK 13.1.

Build the looping RTMPS command

This illustrative H.264 template shows the key option placement. It has not been tested as a production command. Replace the bitrate and GOP placeholders with values for your selected mode, confirm the encoder accepts the options, and substitute the RTMPS destination and stream name supplied by YouTube.

Rank #2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5070 Ti
  • Integrated with 16GB GDDR7 256bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system
ffmpeg -stream_loop -1 -re -i "input.mp4" 
  -map 0:v:0 -map 0:a:0? 
  -c:v h264_nvenc -rc cbr -b:v <youtube_h264_recommended_rate> 
  -g <frame_rate_times_2> -pix_fmt yuv420p 
  -c:a aac -ar 44100 -b:a 128k 
  -f flv "<rtmps_ingestion_url>/<stream_name>"

Set loop, pacing, and input options in the right order

-stream_loop -1 is an input option: put it before the -i for the file you want repeated. -re is also placed before that input to read a prerecorded source at its native rate. FFmpeg options generally apply to the next input or output, so their position matters. The command structure follows the FFmpeg command-line manual.

Replace the bitrate and GOP placeholders

Enter the H.264 bitrate for your chosen resolution and frame rate from the table. Set the GOP length to roughly twice the output frame rate for the recommended two-second interval: for example, 60 frames at 30 fps or 120 frames at 60 fps. The template’s -g value is a placeholder, not a universal value. Confirm closed-GOP behavior and the relevant options for your installed encoder; YouTube’s API can flag open GOPs and overly long keyframe intervals.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4. System Requirements: Minimum 850W PSU with 16-pin 12V-2x6 (12VHPWR) connector required. Verify before purchasing.
  • Military-grade components deliver rock-solid power and longer lifespan for ultimate durability. Compatibility: 348mm (13.7") length, 3.6 slots, 4.3 lbs. Confirm case clearance and slot spacing. GPU bracket included.
  • Protective PCB coating helps protect against short circuits caused by moisture, dust, or debris
  • 3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans
  • Phase-change GPU thermal pad helps ensure optimal thermal performance and longevity, outlasting traditional thermal paste for graphics cards under heavy loads

Map and validate audio

-map 0:a:0? makes the first audio stream optional in FFmpeg. It does not establish that YouTube will accept a video-only feed: YouTube’s API reports missing audio as an ingest health issue. If the source has no audio, add a deliberate silent or music input and map it appropriately; use music only when you have the necessary rights. If you use a separate audio file, inspect timing and synchronization rather than assuming the two inputs will stay aligned.

Protect the key and test the destination

Use the RTMPS ingest destination and stream name shown in YouTube’s live configuration. Avoid putting a real key in reusable shell history where possible. Process arguments may be visible to local users, so use a protected environment or another secret-handling method appropriate to your host and tools. Run a private test before scheduling a public broadcast.

Rank #4
Sale
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5060
  • Integrated with 8GB GDDR7 128bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

Verify the stream in YouTube

A running FFmpeg process only shows that FFmpeg is attempting to send data; it does not prove YouTube is receiving a healthy stream. Open the stream’s status and health information in YouTube Studio after connecting. The YouTube Live Streaming API documentation lists ingest issues including missing audio or video, unsupported codecs, bitrate problems, video-ingestion starvation, open GOP, and excessive GOP duration. Resolve any reported issue and confirm that the picture, sound, and repeat boundary behave as intended before making the stream public.

Troubleshoot common problems

  • h264_nvenc is unavailable or fails to initialize: Check that the installed FFmpeg build exposes the encoder with ffmpeg -h encoder=h264_nvenc. Confirm that the specific GPU, driver, and runtime support the build’s NVENC requirements.
  • The source plays once instead of looping: Put -stream_loop -1 before the -i for the input to repeat.
  • The feed runs too quickly: For a prerecorded input, put -re before the relevant -i to pace reads at the file’s native rate.
  • YouTube reports missing or incorrect audio/video: Inspect the source streams and map the intended video and audio tracks explicitly. If there is no audio, provide a deliberate audio input rather than relying on optional mapping.
  • YouTube reports bitrate, GOP, or codec problems: Compare actual output resolution, frame rate, H.264 bitrate, keyframe interval, audio format, sample rate, and channels with the current YouTube encoder guidance. Check FFmpeg’s encoder-specific options and do not assume an option from a different NVENC generation applies to your build.
  • The local process runs but YouTube has no healthy ingest: Confirm the event’s RTMPS address and stream name, then inspect YouTube’s stream status and health diagnostics. A working local process is not proof of a valid connection or stream.
  • The loop boundary has a pause, jump, or audio discontinuity: Review the source’s timestamps, duration, and audio/video alignment. Validate the repeated transition during a private test; unusual timestamps or a separate audio track may need additional handling.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Rights and YouTube policy checks

Before broadcasting a loop, confirm you have the rights to the video and every audio track. A technically valid stream does not establish that the material is authorized or eligible for YouTube features. Review YouTube’s applicable copyright and channel policies for your content, and test the actual ingest privately without treating successful encoding as policy approval.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
ASUS TUF Gaming GeForce RTX 5070 12GB GDDR7 OC EditionGaming Graphics Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4 OC mode: 2640MHz/Default mode: 2610MHz (Boost Clock)
  • Military-grade components deliver rock-solid power and longer lifespan for ultimate durability
  • Protective PCB coating helps protect against short circuits caused by moisture, dust, or debris
  • 3.125-slot design with massive fin array optimized for airflow from three Axial-tech fans
  • Phase-change GPU thermal pad helps ensure optimal thermal performance and longevity, outlasting traditional thermal paste for graphics cards under heavy loads

Or let it run in the cloud

If you do not want a computer, OBS, and your home connection to stay on, StreamNeo keeps an uploaded video or playlist looping to YouTube from the cloud. The setup is three steps:

  1. Upload a recording or build a playlist.
  2. Add your YouTube stream key once.
  3. Go live; StreamNeo loops the uploaded video from the cloud.

Nothing has to stay on at home; each slot streams the uploaded quality up to 4K 60fps at one flat price per slot, with no re-encode or quality tiers; and StreamNeo automatically recovers if YouTube drops the stream. The first day is free with no card, one free day per account. The monthly price is $9.99 per month.

Quick Recap

SaleBestseller No. 1
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card
ASUS Dual GeForce RTX 5060 Ti 16GB GDDR7 OC Edition Gaming Graphics Card
AI Performance: 767 AI TOPS; OC mode: 2632 MHz (OC mode)/ 2602 MHz (Default mode); Powered by the NVIDIA Blackwell architecture and DLSS 4
$792.99
Bestseller No. 2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5070 Ti; Integrated with 16GB GDDR7 256bit memory interface
Bestseller No. 3
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
ASUS TUF Gaming GeForce RTX™ 5080 16GB GDDR7 OC Edition Graphics Card
3.6-slot design with massive fin array optimized for airflow from three Axial-tech fans; Auto-Extreme precision automated manufacturing helps ensure higher reliability
$1,831.31
SaleBestseller No. 4
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5060; Integrated with 8GB GDDR7 128bit memory interface
$459.99
Bestseller No. 5
ASUS TUF Gaming GeForce RTX 5070 12GB GDDR7 OC EditionGaming Graphics Card
ASUS TUF Gaming GeForce RTX 5070 12GB GDDR7 OC EditionGaming Graphics Card
3.125-slot design with massive fin array optimized for airflow from three Axial-tech fans; Auto-Extreme precision automated manufacturing helps ensure higher reliability
$937.39

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.