To rotate local videos through a YouTube Live stream, use FFmpeg to read the media files in sequence and a Python program to manage the YouTube Live API, launch and supervise FFmpeg, and handle recovery. The API schedules and binds broadcasts; it does not turn an ordinary YouTube channel playlist into a live video source. This guide applies to Ubuntu hosts and channels where live streaming is enabled; the documented workflow does not establish a separate India-only API process.
How the pieces fit together
You need two separate components. FFmpeg produces the audio-video feed from files on your Ubuntu machine. Python coordinates that process and, if you want scheduled events, calls YouTube’s API to create or select a stream, create a broadcast, bind them, and manage broadcast state.
- A live stream represents the incoming feed and its delivery settings.
- A live broadcast is the event viewers watch and a distinct YouTube video. A broadcast must be bound to a stream. Google says a stream can be reused for broadcasts at different times and can be bound to up to three broadcasts. See Google’s Live Streaming API overview.
- A playlist file for FFmpeg is a local list of media paths, not a YouTube channel playlist. The FFmpeg concat demuxer reads the listed files one after another, as though their packets were joined. See FFmpeg’s concat demuxer documentation.
The API does not manage your FFmpeg process. Your Python supervisor must treat API authentication, API calls, media playback, process exit codes, logging, and recovery as distinct jobs.
Choose a rotation strategy
One fixed list
For a stable set of videos, put paths in a concat-demuxer text file and start FFmpeg with that file. This is the simplest setup, but do not assume that changing the text file while FFmpeg is running reloads the playlist. The documentation describes reading a list; it does not promise live refresh.
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minute#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
Supervisor-controlled changes
For rotation changes, have Python deliberately stop and restart the media process with an updated list, or implement another explicit rotation strategy. Test whether the restart creates a visible gap, how YouTube handles reconnects, and whether the broadcast remains usable on your actual Ubuntu, FFmpeg, and channel setup. The reviewed documentation does not guarantee uninterrupted transitions or 24/7 uptime.
File compatibility and storage
FFmpeg’s concat demuxer expects compatible inputs: the files should have the same streams, codecs, and time base. Duration inaccuracies can cause artifacts or gaps. If your files differ, normalize or transcode them ahead of time rather than assuming a stream-copy command will work. Media can be stored on the Ubuntu host or a network-mounted location; the sources establish no performance, cost, or reliability advantage for either option.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Prepare Ubuntu and your media list
- Install or select FFmpeg. Use an Ubuntu-supported package or a deliberately pinned build, then check the local
ffmpegmanual and version. Online FFmpeg documentation may describe newer revisions than the package installed on your system, so verify that the options you use exist locally. The older Ubuntu Bionic manpage is not evidence of the version on a current Ubuntu installation: Ubuntu’s Bionic FFmpeg manpage. - Prepare and test the media. Check each file’s streams and compatibility. If you plan to copy streams without re-encoding, use inputs with matching stream layouts, codecs, and time bases; otherwise normalize them in advance. Use FFmpeg’s local documentation and test a short sequence before scheduling a long event.
- Create a concat list. Make a text file whose entries point to the files in playback order, using the concat-demuxer syntax documented by FFmpeg. Keep filenames and paths valid for the account that will run the process, and verify the list by running FFmpeg manually before adding Python supervision.
- Decide how playlist updates work. Keep the list fixed for a simple rotation, or make the supervisor regenerate the list and restart FFmpeg at a deliberate boundary. Document and test the behavior rather than relying on edits being picked up automatically.
Do not choose a universal resolution, bitrate, keyframe interval, protocol, or ingest address from this guide: those depend on the files, encoder configuration, and the channel’s current YouTube ingest settings. Use the current channel configuration and YouTube’s live guidance at YouTube Help: encoder settings, bitrates, and resolutions.
Authenticate Python and create or select the stream
- Set up Google API access and OAuth. Use a Python client authenticated to the channel with an appropriate write scope. Google’s broadcast insertion reference lists YouTube and YouTube force-SSL scopes for write operations; consult the liveBroadcasts.insert reference for current requirements.
- Protect credentials. Keep API credentials, OAuth refresh credentials, and the live stream key out of source control, command logs, and error messages. Restrict access to the account or service that needs them.
- Select or create a live stream. Use an existing stream or create one with the API. In the common single-encoder setup, stream settings can be configured once and reused for separately scheduled events. The API’s stream object is not the media playlist.
- Check channel eligibility. Confirm live streaming is enabled on the actual channel. The reviewed API material does not establish a special India-only workflow or an India-specific eligibility rule, and it does not support a claim that every channel in India is eligible.
Create and bind a scheduled broadcast
For a scheduled event, the usual API sequence is to create or select the stream, insert a broadcast, bind the broadcast to the stream, verify stream status, and then transition the broadcast as appropriate. Google documents the sequence and the testing and live states in its Live Streaming API implementation guide.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
- Insert the broadcast. Supply the required title, scheduled start time, and privacy status. Use a UTC ISO 8601 timestamp for the schedule and ensure it is in the future. The API reference lists authorization requirements and errors for missing fields or disabled live streaming: liveBroadcasts.insert.
- Bind it to the stream. Call the broadcast bind operation with the broadcast and stream IDs. Keep track of which event is bound to the feed so that you do not start the wrong scheduled event.
- Start FFmpeg against the current ingest configuration. Have Python launch FFmpeg with the concat list and the channel’s current ingest endpoint and stream key. Do not hard-code the key in source code or publish it in logs.
- Verify before transitioning. Inspect FFmpeg’s output and the stream’s status and health. Google’s Python client reference says to confirm that the bound stream is active before transitioning to testing. Then transition to testing or live as your event workflow requires. See the transition reference and the YouTube Data API Python client reference.
Use the generated Python API client’s list, insert, bind, and transition methods as appropriate. Pin the client version in a real deployment and check its installed interface rather than assuming an unpinned example will remain unchanged.
Build Python supervision and recovery
Keep the controller simple and explicit. Python should authenticate, make API calls, launch FFmpeg as a child process, capture its exit status, and decide whether a restart is safe. Log timestamps, the non-secret command configuration, process status, and relevant API state. Never print the stream key or OAuth secrets while diagnosing failures.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
- Set bounded retry limits and alert when the process repeatedly exits; blind restarts can hide a bad playlist or invalid stream configuration.
- On a planned playlist change, stop and restart FFmpeg according to the method you tested. Do not promise gap-free handoffs unless you have verified them on the actual setup.
- On an unexpected interruption, inspect the YouTube stream and broadcast state before deciding whether to restart FFmpeg, rebind, or transition. Reconnection and long-running stability depend on the channel and installed software; they are not guaranteed by the API or concat documentation.
- Test with the exact FFmpeg version, files, ingest settings, and channel you intend to use. The documentation does not establish a universal uptime figure or dynamic playlist-refresh behavior.
Troubleshooting
| Symptom | Likely checks and fixes |
|---|---|
| Broadcast insert fails | Check OAuth authorization and write scope, channel live-streaming enablement, required title, scheduled start time and privacy status, and the API error details. Ensure the scheduled time is valid and in the future. |
| Stream is not active when you transition | Confirm FFmpeg started with the correct current ingest endpoint and stream key, then inspect stream status and health. Transition only after the bound stream is active. |
| Gaps or artifacts between files | Compare stream layouts, codecs, time bases, and durations. Normalize incompatible inputs and test the sequence again; duration inaccuracies can produce artifacts or gaps. |
| Editing the list does not change playback | Do not rely on live reload. Use a tested supervisor-controlled stop/restart or another deliberate rotation method, and check for a gap during the change. |
| FFmpeg exits or the event unexpectedly stops | Review timestamps, exit status, FFmpeg output, and API state without exposing secrets. Add bounded retries and alerting, then test recovery with the exact channel and media setup. |
Or let it run in the cloud
If your goal is simply to keep uploaded videos playing on YouTube, StreamNeo is an alternative to maintaining an Ubuntu host, Python supervisor, and FFmpeg process. Upload a recording or build a playlist, add your YouTube stream key once, and go live; StreamNeo loops the uploaded videos from the cloud. Nothing has to stay on at home, it supports any uploaded quality up to 4K 60fps at one price per slot, and it automatically recovers if YouTube drops the stream. The first day is free with no card. Monthly: $9.99 per month. It streams to YouTube and plays uploaded videos, not a live camera feed. See StreamNeo or start the free day.
Quick Recap
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
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.




