Ubuntu/Linux Vultr VPS पर FFmpeg को systemd service के रूप में चलाएँ और Restart=always सेट करें। इससे FFmpeg process बंद या crash होने पर service उसे फिर शुरू कर सकती है। लेकिन अगर process चलता रहे और YouTube पर वीडियो अटक जाए, तो केवल यह restart policy पर्याप्त नहीं है—उसके लिए progress/health watchdog और YouTube Live Control Room में जाँच भी चाहिए।
यह तरीका क्या संभालता है—और क्या नहीं
Vultr VPS पर FFmpeg वीडियो को YouTube Live तक भेजता है; systemd उस process की निगरानी करके उसके exit होने पर उसे दोबारा शुरू करता है। Vultr का streaming-server संदर्भ Ubuntu पर streaming setup दिखाता है, जबकि FFmpeg की भूमिका media processing और output भेजना है (Vultr setup guide; FFmpeg documentation)।
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Launch Windows Server VPS by VULTR (Japanese Edition) | $8.69 | Buy on Amazon |
As an Amazon Associate I earn from qualifying purchases.
- Process exit या crash: systemd restart policy उपयोगी है।
- Silent freeze: FFmpeg process जीवित हो सकता है, जबकि output आगे न बढ़े। इस स्थिति को पहचानने के लिए अलग progress/health check चाहिए।
- YouTube ingest या network समस्या: service status से अकेले यह साबित नहीं होता कि दर्शकों को stream मिल रही है। Live Control Room के stream-health संकेत और watch page पर playback जाँचें।
systemd service और progress monitoring को अलग जिम्मेदारियाँ समझें; एक दूसरे का पूरा विकल्प नहीं है (FFmpeg systemd guide; YouTube encoder settings)।
Recommended Free Tools
पहले YouTube और VPS की तैयारी करें
Stream key को सुरक्षित रखें
YouTube stream key को password और address की तरह संवेदनशील मानता है (YouTube stream settings)। उसे public script या repository में न रखें और command में सीधे लिखने से बचें, क्योंकि command shell history या process विवरण में दिखाई दे सकती है। नीचे के उदाहरण में key restricted-permission environment file से ली जाती है। YouTube Live Control Room में key reset करने पर उस file में नई key डालकर service restart करनी होगी।
#1 Best Overall
Encoder output को YouTube की settings से मिलाएँ
YouTube की encoder guidance RTMP/RTMPS, H.264/H.265/AV1 विकल्प, CBR और अधिकतम 60 fps तक frame rate बताती है। Keyframe interval 2 सेकंड सुझाया गया है और 4 सेकंड से अधिक न रखने की सलाह है। 720p30 H.264 के लिए YouTube की प्रकाशित सिफारिश 3–8 Mbps है; ये guidance values हैं, किसी खास VPS या source के लिए performance guarantee नहीं (YouTube encoder settings)।
उपलब्ध upload bandwidth stream के कुल bitrate से अधिक रखें। YouTube लगभग 20% headroom छोड़ने की सलाह देता है; network disruption stream तोड़ सकती है (YouTube streaming tips)।
systemd service बनाएँ
नीचे Ubuntu/Linux के लिए एक ढाँचा है। अपने distro, FFmpeg binary path, input file और YouTube ingest URL के अनुसार इसे जाँचें। यह किसी विशिष्ट Vultr VPS पर परीक्षण किया हुआ command set नहीं है। उदाहरण मानता है कि dedicated उपयोगकर्ता ffmpeg और directories पहले से बनाई गई हैं।
-
Dedicated उपयोगकर्ता और config file तैयार करें
अलग unprivileged account बनाएँ और उसे केवल आवश्यक media तथा config तक पहुँच दें। उदाहरण के लिए key file
/etc/ffmpeg/youtube.envहो सकती है। उसे केवल service owner/root पढ़ सके, ऐसी permissions रखें।sudo install -d -m 0750 -o root -g ffmpeg /etc/ffmpeg sudo install -m 0640 -o root -g ffmpeg /dev/null /etc/ffmpeg/youtube.env sudoedit /etc/ffmpeg/youtube.envइस file में environment variable रखें, जैसे
YOUTUBE_STREAM_KEY=...। वास्तविक key को साझा न करें। सिस्टम परffmpegनाम का group/account न हो तो पहले अपने distro के अनुरूप बनाएँ; ownership उसी वास्तविक service account/group से मिलनी चाहिए। -
FFmpeg command तैयार करें
एक उदाहरण invocation नीचे है।
/usr/bin/ffmpeg,/srv/media/video.mp4, ingest hostname और encoding विकल्प अपने setup के अनुरूप बदलें। YouTube Live Control Room में दिखाया गया ingest URL इस्तेमाल करें।/usr/bin/ffmpeg -nostdin -re -stream_loop -1 -i /srv/media/video.mp4 -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -ar 44100 -f flv "rtmps://YOUR_INGEST_URL/live/${YOUTUBE_STREAM_KEY}"यह केवल उदाहरण है: 4500 kbps video bitrate और 30 fps को तभी रखें जब source, चुनी गई resolution, VPS क्षमता और उपलब्ध upload bandwidth के लिए वे उचित हों। 30 fps पर 60-frame GOP दो सेकंड का keyframe interval देता है।
-nostdinbackground service में console-input checks से process suspend होने की संभावना से बचाता है, जैसा FFmpeg FAQ बताती है (FFmpeg FAQ)।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.आपके FFmpeg build और YouTube event configuration के अनुसार codec, audio तथा protocol विकल्प जाँचें। यदि पहले से तैयार input stream को बिना encode किए भेज रहे हैं, तो encoding flags का चुनाव अलग होगा; अनुमान से flags न जोड़ें।
-
Service unit लिखें
/etc/systemd/system/ffmpeg-youtube.serviceबनाएँ:[Unit] Description=FFmpeg YouTube Live stream Wants=network-online.target After=network-online.target [Service] Type=simple User=ffmpeg Group=ffmpeg EnvironmentFile=/etc/ffmpeg/youtube.env ExecStart=/usr/bin/ffmpeg -nostdin -re -stream_loop -1 -i /srv/media/video.mp4 -c:v libx264 -preset veryfast -b:v 4500k -maxrate 4500k -bufsize 9000k -r 30 -g 60 -keyint_min 60 -sc_threshold 0 -c:a aac -b:a 128k -ar 44100 -f flv rtmps://YOUR_INGEST_URL/live/${YOUTUBE_STREAM_KEY} Restart=always RestartSec=5 [Install] WantedBy=multi-user.targetअपनी unit में ingest URL और command को सही रूप में रखें; यदि URL में shell expansion की जरूरत है, तो
systemdकीExecStartparsing के अनुरूप सावधानी से configure करें। एक सरल विकल्प एक executable wrapper script है जो restricted config पढ़कर FFmpeg शुरू करे। Secrets को unit file या public script में न रखें।RestartSec=5restart से पहले पाँच सेकंड का विराम देता है; इसे अपने reconnect व्यवहार के अनुसार समायोजित किया जा सकता है। -
Unit लोड करके शुरू करें
sudo systemctl daemon-reload sudo systemctl enable --now ffmpeg-youtube.service sudo systemctl status ffmpeg-youtube.serviceenableboot पर service शुरू करने के लिए सेट करता है;--nowउसे अभी शुरू भी करता है।Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Scan for outdated or missing drivers - takes under a minute3Repair Windows errors before they cause bigger problemsSpecial offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy. -
Logs और YouTube पर परिणाम सत्यापित करें
sudo journalctl -u ffmpeg-youtube.service -fLogs में FFmpeg errors, connection failures और restart attempts देखें। साथ में YouTube Live Control Room में stream-health messages देखें और public watch page पर playback जाँचें। YouTube स्वयं event के दौरान stream health monitor करने और messages देखने की सलाह देता है (YouTube encoder settings)।
अटकने वाली stream के लिए progress watchdog जोड़ें
Restart=always तभी काम आता है जब process exit करे। अगर FFmpeg जीवित है पर media timestamp या output progress नहीं बढ़ रहा, तो systemd इसे अपने-आप crash नहीं मानेगा। FFmpeg का progress output किसी file/pipe में लिखवाएँ और अलग watchdog से जाँचें कि हाल की अवधि में progress बदला है या नहीं। पुराना progress मिलने पर watchdog service restart करा सकता है।
Watchdog बनाते समय timeout को source के स्वभाव, reconnect की अवधि और नेटवर्क में सामान्य उतार-चढ़ाव से बड़ा रखें, ताकि अस्थायी रुकावट पर अनावश्यक restart न हो। FFmpeg log activity को अकेले progress न मानें: लगातार messages आना यह प्रमाण नहीं कि YouTube तक उपयोगी frames पहुँच रहे हैं। Watchdog के बाद भी Live Control Room और watch page से पुष्टि करें।
आम समस्याएँ और सुधार
- Service शुरू होते ही बार-बार restart होती है:
systemctl statusऔरjournalctlमें file path, permissions, FFmpeg arguments और ingest URL की त्रुटि देखें। पहले command को service user के रूप में जाँचें। - FFmpeg चलता है, लेकिन YouTube पर stream नहीं दिखती: stream key और ingest URL की पुष्टि करें, Live Control Room के health संकेत पढ़ें, और outbound connectivity तथा bitrate जाँचें। Process का active दिखना YouTube ingest का प्रमाण नहीं है।
- Key reset के बाद connection विफल: restricted config file में नई key डालें और service restart करें:
sudo systemctl restart ffmpeg-youtube.service। - दर्शकों को frozen video दिखता है, service active है: यह process-exit recovery से अलग silent-freeze मामला है। Progress watchdog और YouTube stream-health जाँच लागू करें।
- बार-बार network disconnect: bitrate को उपलब्ध upload capacity के अनुरूप रखें और headroom दें; नेटवर्क बाधा से भेजना टूट सकता है (YouTube streaming tips)।
- पुनः शुरू होने पर YouTube event अपेक्षा से अलग व्यवहार करता है: YouTube के अनुसार 12 घंटे से छोटी streams स्वतः archive होंगी। लगातार stream और archive व्यवहार अपने channel/event setup में सत्यापित करें; हर stream के लिए एक सार्वभौमिक lifecycle या restart schedule स्थापित नहीं है (YouTube encoder instructions)।
Or let it run in the cloud
अगर VPS पर FFmpeg, systemd और watchdog बनाए रखना नहीं चाहते, तो StreamNeo YouTube के लिए cloud service है: वीडियो upload करें, YouTube stream key जोड़ें और go live करें। यह uploaded video को 24/7 loop करता है—घर का computer या internet connection चालू रखने की जरूरत नहीं।
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minute- आपका video जिस quality में बना है, उसी में stream होता है, 4K 60fps तक; हर quality के लिए एक ही price per slot है।
- YouTube stream गिरने पर automatic recovery है।
- पहला दिन बिना card के free है।
Monthly plan: $9.99 per month. StreamNeo पर पहला दिन मुफ्त शुरू करें।
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.




