To keep a prerecorded video’s audio and picture in sync on a looping YouTube Live stream, first identify whether the problem is a fixed offset, drift that grows over time, a jump at each loop, or choppy playback. Those symptoms point to different parts of the timeline; -stream_loop -1 alone does not guarantee synchronization. Pace file input for real-time output, inspect timestamps, change only the setting tied to a measured problem, and verify the result in YouTube’s preview.
Diagnose the sync problem before changing FFmpeg options
A sync issue can be constant or time-dependent. A fixed offset means the audio is early or late by roughly the same amount throughout playback. Cumulative drift grows as the video plays. A loop-boundary jump appears or changes each time the clip restarts. Choppy or dropped media is a separate symptom that may involve frame timing, output pacing, or ingest health. These patterns help focus the investigation, but none proves a particular cause by itself.
- Record the environment: run
ffmpeg -version; save the full command with the stream key removed; collect input stream details fromffprobeand relevant FFmpeg logs. - Compare points in time: check sync near the beginning, later in one pass, and immediately after a loop. Use a source with clear movement and a corresponding sound cue.
- Inspect the timeline: examine audio and video start times, durations, frame rate, sample rate, and timestamps. Confirm the tracks represent the same intended events and check whether the file itself has a discontinuity near its end or beginning.
Never post a real YouTube stream key in a command, screenshot, or log. YouTube says a stream key functions like a password and address; obtain it in Live Control Room and keep it private (YouTube Help: Manage live stream settings).
Loop and pace a prerecorded file deliberately
FFmpeg documents -stream_loop as an input option; a value of -1 requests infinite looping. For a prerecorded file being sent as a live output, -re reads at native frame rate, equivalent to -readrate 1. These options serve different purposes: looping repeats the input, while pacing prevents FFmpeg from reading the file as fast as possible. Neither is an audio-sync correction. Check the installed version and its help because option support and behavior can vary (FFmpeg documentation).
Recommended Free Tools
#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.
Use this as a schematic, not a universal copy-and-paste command. Replace the input and output placeholders, select codecs and settings appropriate to the source and YouTube ingest, and never put a real key into a publicly shared command:
ffmpeg -re -stream_loop -1 -i "input.mp4"
-map 0:v:0 -map 0:a:0
-c:v libx264 -c:a aac
-f flv "rtmps://YOUR_YOUTUBE_INGEST_URL/YOUR_PRIVATE_STREAM_KEY"
Here, -re and -stream_loop -1 appear before -i because they affect the input. The -map options select the first video and audio streams; remove or adjust them if the file has different stream layout. The example selects H.264 video and AAC audio and uses FLV output for the RTMP-family ingest. It does not set a universal bitrate, frame rate, or timestamp fix: choose those from the source properties and YouTube’s current encoder guidance. Check the installed build with ffmpeg -h full or the relevant option help.
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.
Apply the remedy that matches the symptom
| Observed pattern | What to investigate | What the setting does—and does not do |
|---|---|---|
| Audio is early or late by a steady amount | Measure the offset and establish which stream leads. Check input start timestamps and how the tracks align. | -itsoffset adds an offset to input timestamps. Use it only for a measured fixed error, place it before the input it affects, and verify the sign experimentally. It does not correct accumulating drift. |
| Audio and video gradually separate during a pass | Compare timestamps and durations across the file; check whether the source tracks have matching timelines and whether their rates are as expected. | Do not guess an offset. A static timestamp shift cannot repair an error that increases over time. The appropriate correction depends on the observed source and timestamp behavior. |
| Sync changes suddenly at a loop boundary | Inspect the end and beginning of the source, including timestamps and whether the audio and video durations align. | Looping repeats the input; it does not prove the timeline joins cleanly. A boundary discontinuity needs source- or timestamp-specific investigation. |
| Playback is choppy or frames appear dropped | Separate read pacing and output/ingest health from audio timestamp alignment. Review FFmpeg logs and YouTube stream health. | -re paces prerecorded file reading; it is not a sync fix. Do not use a low read rate to slow actual capture or live inputs, where packet loss can result. |
Use timestamp offsets only for measured fixed errors
FFmpeg defines -itsoffset as an addition to input timestamps. Put it before the input it applies to, and do not assume a positive or negative value without confirming which track leads and how the option affects the resulting timeline. Test a representative section before relying on it for a continuous stream. An offset changes timestamp origin; it does not change the underlying rate or heal an error that grows with time.
Choose frame synchronization separately
Video frame-rate synchronization is not a general audio-sync switch. FFmpeg’s -fps_mode options have distinct effects: passthrough passes frames with demuxer timestamps; cfr duplicates or drops frames to reach the requested constant frame rate; vfr passes frames with timestamps or drops duplicates; and auto chooses based on muxer capability. Muxer processing can still change timestamps. Select a mode based on the source and output needs rather than reflexively adding -fps_mode cfr (FFmpeg documentation).
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
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.
Avoid legacy -vsync advice unless you have checked the behavior for your installed version. Do not add -shortest to an indefinite loop as a generic fix: FFmpeg documents it as ending encoding when the shortest output stream ends, which may defeat continuous streaming.
Match YouTube ingest settings, then test the actual stream
YouTube’s current encoder guide lists RTMP/RTMPS ingest; H.264, H.265/HEVC, and AV1 video; frame rates up to 60 fps; AAC or MP3 audio; and constant bitrate (CBR). It recommends a 2-second keyframe interval and says not to exceed 4 seconds. The guide lists 44.1 kHz audio for stereo and 48 kHz for 5.1 surround, with audio bitrates of 128 kbps stereo and 384 kbps 5.1 surround. Resolution- and codec-specific video bitrate recommendations vary, so use the current table rather than treating one bitrate as a universal sync fix (YouTube Help: Choose live encoder settings, bitrates, and resolutions).
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
Compatible ingest settings do not repair incorrect source timestamps. Before relying on a continuous broadcast, start a test and check the Live Control Room preview with movement and sound similar to the planned stream. YouTube Help recommends testing with both audio and movement, then monitoring stream health and reviewing its messages. A successful FFmpeg process or a connected ingest indicator alone does not establish that playback is synchronized.
If you want an encrypted connection, YouTube recommends RTMPS, its encrypted RTMP extension. Get the ingest URL and key from Live Control Room; keep the key private (YouTube Help: Encrypt your stream using RTMPS).
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesBest 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.
Troubleshoot common causes
The stream is synced at first but drifts later
- Compare audio and video timestamps and durations near the start and later in the same pass.
- Check the source tracks’ rates and intended alignment; do not treat a growing difference as a fixed offset.
- Review FFmpeg’s timestamp and frame-sync behavior for the installed build, then test a targeted change against the same source segment.
It goes out of sync only after the clip repeats
- Check the source’s final and initial segments for mismatched track durations or a timestamp discontinuity.
- Confirm the observed jump is at the loop boundary rather than a gradual error that happens to become noticeable there.
- Do not assume infinite looping itself guarantees a seamless timeline.
The preview is choppy or YouTube reports stream-health problems
- Inspect FFmpeg logs and YouTube’s stream-health messages; distinguish dropped/choppy playback from a steady audio offset.
- For a prerecorded file, confirm real-time pacing is enabled where appropriate. Do not apply file pacing blindly to an actual live capture source.
- Check encoder compatibility and the current YouTube recommendations for codec, frame rate, keyframes, and bitrate.
You cannot reproduce the problem from the command alone
Capture ffmpeg -version, the full command with the key redacted, input stream details, and relevant logs. Also note where in the pass the mismatch begins and whether it resets at the loop. FFmpeg’s online manual may describe a newer build than the one installed, so verify each option locally.
Or let it run in the cloud
If your goal is to keep uploaded videos playing on YouTube Live without maintaining an FFmpeg process at home, StreamNeo is a cloud service for looping uploaded videos and playlists. Upload the recording, add your YouTube stream key, and go live. Your computer and home connection do not have to stay on. StreamNeo can automatically recover if YouTube drops the stream, and the first day is free with no card. Each slot streams the uploaded file as made, up to 4K 60fps, for one flat price per slot; that changes the hosting workflow, not the need to ensure your source audio and video are already in sync. Monthly: $9.99 per month.
Quick Recap
Start your free day with StreamNeo.
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.




