For a prerecorded 24/7 YouTube stream from an Indian VPS, start with H.264 video, CBR, AAC stereo audio, and a two-second keyframe interval. At 720p30, YouTube recommends 8 Mbps video; at 1080p30, it recommends 14 Mbps. Use the higher setting only if your source, VPS encoder, and sustained outbound connection can all handle it. An Indian server location does not by itself guarantee a stable route to YouTube.
Recommended FFmpeg settings
YouTube’s current H.264 live-encoder guidance recommends the following video bitrates. These are platform recommendations, not measured performance guarantees for a particular VPS or network.
| Output format | YouTube H.264 video bitrate | Keyframe interval |
|---|---|---|
| 720p at 30 fps | 8 Mbps recommended; 3 Mbps minimum | 2 seconds |
| 720p at 60 fps | 8 Mbps recommended; 3 Mbps minimum | 2 seconds |
| 1080p at 30 fps | 14 Mbps recommended; 5 Mbps minimum | 2 seconds |
| 1080p at 60 fps | 17 Mbps recommended; 6 Mbps minimum | 2 seconds |
For stereo audio, use AAC at 128 kbps and 44.1 kHz. YouTube’s general encoder guidance also calls for progressive video, square pixels, and Rec. 709 for SDR. It recommends a two-second keyframe interval and says not to exceed four seconds. For encryption in transit, YouTube recommends RTMPS; RTMP and RTMPS are supported ingest protocols. See YouTube’s encoder settings and bitrate guidance.
Starting command for a prerecorded video
This template loops an MP4 and re-encodes it as 720p30-compatible H.264 settings, using the 8 Mbps recommendation as an example. It does not scale or normalize the source, so the output dimensions and frame rate depend on the input and filters. Adapt and verify the command for your media, installed FFmpeg build, and chosen YouTube ingest endpoint; it is not a tested, universal command.
Free tools Windows power users keep installed
One-click scans. No signup required.
#1 Best Overall
ffmpeg -re -stream_loop -1 -i input.mp4
-map 0:v:0 -map 0:a:0?
-c:v libx264 -preset veryfast -pix_fmt yuv420p
-r 30 -g 60 -keyint_min 60 -sc_threshold 0
-b:v 8M -maxrate 8M -bufsize 16M
-c:a aac -b:a 128k -ar 44100 -ac 2
-f flv "$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
What to change for another output
- 1080p30: Configure the source and encoder to produce 1080p30, and use YouTube’s 14 Mbps H.264 recommendation only if the VPS can encode it and sustain the upload rate. If it cannot, choose a lower supported format such as 720p30.
- 60 fps: Set the output frame rate and GOP to match. At 60 fps, a two-second GOP is 120 frames, so use
-r 60 -g 120 -keyint_min 120; select the corresponding YouTube bitrate from the table. - Audio-less input: The optional audio map,
-map 0:a:0?, allows FFmpeg to proceed when there is no audio stream. Confirm that the resulting output behaves as intended in YouTube’s preview.
The example’s -g 60 at 30 fps sets a 60-frame GOP, or two seconds. Its -b:v and -maxrate set the target and maximum video rate; -bufsize configures the rate-control buffer. Check the encoded output rather than assuming the input matches the selected resolution, frame rate, and bitrate.
Use the exact YouTube stream destination
- In YouTube Studio, open the Live Control Room and create or select the stream.
- Copy the current stream URL and stream key from YouTube’s live-stream settings. The URL, protocol, and output format must match the ingest endpoint and your FFmpeg build. YouTube’s workflow is described in Manage live stream settings.
- Supply the URL and key to FFmpeg in the form expected by that endpoint. The command’s
$YOUTUBE_RTMPS_URLand$YOUTUBE_STREAM_KEYare placeholders for values you manage; they are not literal YouTube settings. - Treat the stream key like a password. Do not expose it in public scripts, logs, or shell history; rotate it in YouTube if it is disclosed.
When to use -re—and when not to
-re makes FFmpeg read an input at its native rate, which is useful when a prerecorded file would otherwise be processed faster than real time. FFmpeg documents this as input-rate control and cautions against using low read rates with actual capture or live inputs. For a live capture or live network stream, do not blindly add -re; use settings appropriate to that input. See FFmpeg’s command-line documentation.
Rank #2
Keeping FFmpeg alive through a temporary publishing failure
A basic FFmpeg process may exit if publishing fails. FFmpeg documents a FIFO muxer pattern that continues processing in real time and attempts recovery after temporary output failures:
ffmpeg -re -i input.mp4
-c:v libx264 -c:a aac
-f fifo -fifo_format flv
-drop_pkts_on_overflow 1 -attempt_recovery 1 -recovery_wait_time 1
-map 0:v:0 -map 0:a:0?
"$YOUTUBE_RTMPS_URL/$YOUTUBE_STREAM_KEY"
This is an illustration of FFmpeg’s documented recovery options, not a complete bitrate-tuned replacement for the earlier template. Configure it for the actual source, destination format, and FFmpeg version. The recovery options do not guarantee YouTube will preserve one uninterrupted public event after a disconnect, and they do not replace process supervision, monitoring, or a recovery test. Protocol reconnect controls are protocol- and build-dependent; consult FFmpeg’s protocol documentation before relying on one.
Rank #3
What an Indian VPS changes—and what it does not
The available YouTube guidance gives encoder settings, not India-specific bitrates, ingest addresses, or VPS-provider recommendations. A server’s location alone does not establish sustained upload capacity or a stable route to YouTube. Before committing to a provider, verify:
- Sustained outbound bandwidth and any traffic or data-transfer limits.
- CPU capacity under the exact FFmpeg codec, resolution, frame rate, and preset you plan to use.
- Network and acceptable-use terms for continuous streaming.
- What happens during provider maintenance, server restarts, or temporary network loss.
- Actual route and stream behavior from the selected server, tested against YouTube.
There is no provider comparison or India-specific performance result established here. Test from the VPS you intend to use and inspect YouTube’s stream health rather than treating a provider’s advertised location or bandwidth as proof of a reliable 24/7 stream.
Rank #4
Test and monitor before relying on the stream
- Confirm that the YouTube channel is eligible to live stream and create the stream in Live Control Room.
- Choose a resolution and frame rate your VPS can encode and upload reliably, then apply the corresponding bitrate, codec, audio, and keyframe settings.
- Run a private or otherwise non-public test with representative motion and audio. Check the Live Control Room preview and stream-health messages.
- Monitor YouTube stream health and playback, along with FFmpeg’s process status, CPU, and network. If you record locally, also monitor disk space.
- Deliberately test recovery and verify in Live Control Room what happens after a temporary interruption.
YouTube advises testing before going live, monitoring stream health and messages, checking the Live Control Room preview, and continuing to monitor audio and video quality. Its guidance is available in YouTube live streaming tips.
Common problems and fixes
| Symptom | Likely cause | What to check or change |
|---|---|---|
| FFmpeg exits or cannot publish | Invalid or stale stream key, wrong stream URL, unsupported protocol/container combination, or network failure | Copy the current URL and key from Live Control Room, verify the endpoint format against your FFmpeg build, and inspect FFmpeg’s error output. Keep credentials out of logs you share. |
| Stream health warns about bitrate or connection | VPS egress is insufficient or unstable for the selected output | Check sustained outbound performance from the VPS and provider traffic limits. Reduce resolution or frame rate and use the matching YouTube recommendation if the connection cannot sustain the current setting. |
| Video stutters or CPU stays saturated | The VPS cannot encode the chosen format and preset in real time | Check CPU use during representative content. Lower the output format or adjust encoding settings, then test again; do not assume a nominal vCPU count guarantees real-time encoding. |
| Output format differs from the intended resolution or frame rate | The input does not match the target, and the template contains no scaling filter | Inspect the input and encoded output. Add an explicit scale or frame-rate conversion only when needed, then confirm the result and keyframe interval. |
| Audio is missing or unsuitable | Input audio is absent, mapped differently, or not encoded as expected | Inspect the input streams and output preview. The optional audio map handles no audio stream, but it does not create audio. |
| Publishing does not resume after a disconnect | FFmpeg exited, the failure is not covered by the selected recovery path, or YouTube does not resume the same event as expected | Check process supervision and logs, confirm applicable protocol behavior for your build, and test recovery in Live Control Room before relying on it. |
Copyright and live-stream policy checks
Using FFmpeg to loop a file does not establish that you have the rights to stream its contents or that a channel meets YouTube’s monetization rules. Before making a 24/7 stream public, confirm you are authorized to use the video and audio, and review YouTube’s current copyright and live-stream requirements. A technically healthy stream is not, by itself, evidence of policy compliance.
Or let it run in the cloud
If you do not want to maintain a VPS, FFmpeg process, and recovery setup, StreamNeo is a cloud service for keeping a YouTube channel live from uploaded videos. Upload a recording or build a playlist, add your YouTube stream key once, and go live. Nothing has to stay on at home. It streams the uploaded video as made, up to 4K 60fps, at one price per slot regardless of quality; it does not re-encode. If YouTube drops the stream, StreamNeo automatically attempts recovery. The first day is free with no card.
Every slot includes one always-on stream, 10 GB of storage per slot pooled across active slots, 24/7 looping and playlists, automatic recovery, and support from the StreamNeo team. The same product is included on each plan; only the billing period changes. The monthly option is $9.99 per month. For five or more slots, contact support. StreamNeo streams to YouTube only and plays uploaded videos; it does not stream from a camera. See StreamNeo for details, or start the free first day.
Quick Recap
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.

