October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
Mountain View desk6 min

How to Keep Audio in Sync When Looping Videos to YouTube Live with FFmpeg

Learn how to diagnose and troubleshoot audio sync in FFmpeg loops to YouTube Live, from timestamp offsets and frame-rate handling to end-to-end testing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Audio sync depends on the timestamps and timing of the source, not simply on whether FFmpeg repeats it. First identify whether the sound is consistently early or late, drifts progressively out of sync, jumps at each loop boundary, or becomes choppy. Then correct the specific cause and verify the actual YouTube Live preview. A fixed timestamp offset can address a measured, constant lead or lag; it will not fix cumulative drift or a discontinuity that returns at every loop.

Diagnose the kind of sync problem first

Before changing options, watch and listen to a representative section of the outgoing stream. Note whether the timing error is already present at the start, grows during one play, changes abruptly when the video repeats, or occurs alongside dropped or choppy media. These patterns point to different parts of the pipeline, but none proves a cause on its own.

As an Amazon Associate I earn from qualifying purchases.

What you observe What to investigate What not to assume
Audio is consistently early or late by roughly the same amount Measure the offset and inspect the source stream start times and timestamps. Do not guess an offset value or assume a fixed shift will fix drift.
The mismatch grows during a single play Compare audio and video durations, timestamps and rates over time; inspect the encoding and output timeline. Do not treat input pacing or a constant offset as a sync correction.
Sync changes suddenly when the clip repeats Check whether audio and video have matching intended timelines and whether their loop points create a discontinuity. Do not assume that repeating the input guarantees a seamless boundary.
Playback is choppy or frames appear to be dropped Inspect FFmpeg logs, output frame-rate handling, system capacity and YouTube stream health. Do not confuse a cadence or delivery problem with a constant audio offset.

Collect the information needed to troubleshoot

Record the FFmpeg version, the full command with the stream key removed, stream details for the input, and the relevant FFmpeg logs. Check the installed build with ffmpeg -version; for option details, consult ffmpeg -h full or the relevant option help. The online FFmpeg documentation is the primary reference, but a command’s behavior and available options can depend on the build.

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

Inspect the input with ffprobe and compare the audio and video stream start times, durations, frame rates and audio sample rate. Confirm the streams represent the same intended timeline. A mismatch in what the streams contain, or a discontinuity in their timestamps, cannot be diagnosed from the loop option alone.

#1 Best Overall
Focusrite Scarlett Solo 3rd Gen USB-C Audio Interface
  • Pro performance with great pre-amps - Achieve a brighter recording thanks to the high performing mic pre-amps of the Scarlett 3rd Gen. A switchable Air mode will add extra clarity to your acoustic instruments when recording with your Solo 3rd Gen
  • Get the perfect guitar and vocal take with - With two high-headroom instrument inputs to plug in your guitar or bass so that they shine through. Capture your voice and instruments without any unwanted clipping or distortion thanks to our Gain Halos
  • Studio quality recording for your music & podcasts - Achieve pro sounding recordings with Scarlett 3rd Gen’s high-performance converters enabling you to record and mix at up to 24-bit/192kHz. Your recordings will retain all of their sonic qualities
  • Low-noise for crystal clear listening - 2 low-noise balanced outputs provide clean audio playback with 3rd Gen. Hear all the nuances of your tracks or music from Spotify, Apple & Amazon Music. Plug-in headphones for private listening in high-fidelity
  • Everything in the box: Includes Pro Tools Intro+, Ableton Live Lite, Cubase LE, and Hitmaker Expansion: a suite of essential effects, powerful software instruments, and easy-to-use mastering tools

Keep the stream key secret. YouTube describes it as functioning like a stream password and address in its live stream settings guidance. Remove it from commands, logs and screenshots before sharing diagnostics.

Loop and pace prerecorded input deliberately

FFmpeg documents -stream_loop as an input option: -1 means loop indefinitely. For a prerecorded file being sent as a live stream, -re can read input at its native frame rate for real-time output. These options control repetition and read speed; neither measures nor repairs audio/video synchronization. Put input options before the input they affect and verify the syntax with your installed build. See the FFmpeg documentation for input looping and real-time input pacing.

Rank #2
Focusrite Scarlett Solo 4th Gen USB-C Audio Interface
  • The new generation of the songwriter's interface: Plug in your mic and guitar and let Scarlett Solo 4th Gen bring big studio sound to wherever you make music
  • Studio-quality sound: With a huge 120dB dynamic range, the newest generation of Scarlett uses the same converters as Focusrite’s flagship interfaces, found in the world's biggest studios
  • Find your signature sound: Scarlett 4th Gen's improved Air mode lifts vocals and guitars to the front of the mix, adding musical presence and rich harmonic drive to your recordings
  • All you need to record, mix and master your music: Includes industry-leading recording software and a full collection of record-making plugins
  • Everything in the box: Includes Pro Tools Intro+, Ableton Live Lite, Cubase LE, and Hitmaker Expansion: a suite of essential effects, powerful software instruments, and easy-to-use mastering tools

A schematic command can show the placement, but it is not a universal copy-and-paste recipe: select codecs, mappings, output settings and a keyframe-compatible configuration for your source and YouTube’s current requirements.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffmpeg -re -stream_loop -1 -i "input.mp4" [stream mapping and encoding options] -f flv "rtmps://[YouTube ingest URL]/[STREAM_KEY]"

Replace the bracketed portions with values from your setup; do not publish the real key. The example illustrates option placement only. Confirm the installed FFmpeg build accepts the options as shown, and configure output codecs and quality for the source and ingest requirements.

Rank #3
SABRENT USB External Stereo Sound Card Adapter, Plug & Play (AU-MMSA)
  • PLUG IN AND HEAR SOUND IN SECONDS - USB Type-A connector with a 3.5mm stereo headphone output and a separate 3.5mm mono microphone input. No drivers, no software, no external power - the adapter is USB bus-powered and is recognized as a standard USB audio device.
  • WORKS ON WINDOWS, MAC AND LINUX - Driverless on Windows 98SE/ME/2000/XP/Server 2003/Vista/7/8, Linux and Mac OSX, and compliant with the USB Audio Device Class 1.0 specification, so any system that supports class-compliant USB audio will see it. Select it as the sound output and input device after plugging it in.
  • TWO JACKS, TWO JOBS - The green jack is stereo OUT for headphones or powered speakers; the pink jack is mono microphone IN for a 3.5mm mic. It does NOT support 4-pole headsets on a single combo plug, it does NOT power passive speakers, and it does NOT add surround sound - it is a stereo 2-channel adapter.
  • FOR LAPTOPS AND DESKTOPS THAT NEED AN AUDIO PORT BACK - Adds a headphone and mic port to a laptop, desktop, or mini PC whose onboard jack has failed or was never there. Managed and work-issued computers can block new USB audio devices by policy - check with your IT department before ordering for a company machine.
  • SABRENT SUPPORT AND WARRANTY - What is in the box: one USB audio sound adapter. Backed by a 1-year limited warranty, extended to 2 years when you register within 90 days on the manufacturer's website.

Choose a correction that matches the measured cause

For a measured, constant lead or lag

FFmpeg’s -itsoffset adds an offset to input timestamps. Use it only after measuring which input stream needs shifting and by how much. Its sign and placement matter: it applies to the input that follows it, so position it before that input. Retest a representative section to confirm the result. A fixed shift changes the timestamp origin; it does not fix an error that accumulates through the clip or returns at the loop boundary. See the FFmpeg timestamp option documentation.

For progressive drift or a loop-boundary jump

Recheck the source timeline and timestamps, including whether audio and video have the same intended start and duration and whether the loop point is continuous. The right remedy depends on what those checks show. There is no evidence-based universal -itsoffset or audio-sync value for an unspecified file. Do not apply a fixed offset to a changing error, and do not assume -stream_loop -1 will align streams at every repeat.

Rank #4
M-AUDIO M-Track Duo USB Audio Interface
  • Podcast, Record, Live Stream, This Portable Audio Interface Covers it All - USB sound card for Mac or PC delivers 48kHz audio resolution for pristine recording every time
  • Be ready for anything with this versatile M-AUDIO interface - Record guitar, vocals or line input signals with two combo XLR / Line / Instrument Inputs with phantom power
  • Everything you Demand from an Audio Interface for Fuss-Free Monitoring - 1/4" headphone output and stereo 1/4" outputs for total monitoring flexibility; USB/Direct switch for zero latency monitoring
  • Get the best out of your Microphones - M-Track Duo’s transparent Crystal Preamps guarantee optimal sound from all your microphones including condenser mics
  • The MPC Production Experience - Includes MPC Beats Software complete with the essential production tools from Akai Professional

For frame-rate handling

Frame synchronization is a separate decision from audio offset. FFmpeg’s -fps_mode options behave differently: passthrough passes frames with demuxer timestamps; cfr duplicates or drops frames to reach a requested constant frame rate; vfr passes frames with timestamps or drops duplicates; and auto selects based on muxer capability. FFmpeg notes that muxer processing can still change timestamps. Use a mode based on the source and output needs rather than treating cfr as a universal sync switch. See the FFmpeg frame-rate mode documentation.

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

Avoid relying on legacy -vsync advice without checking the version in use. Do not add -shortest reflexively to an indefinite stream: FFmpeg documents it as ending encoding when the shortest output stream ends, which can conflict with continuous output.

Best Value
Focusrite Scarlett 2i2 4th Gen USB-C Audio Interface
  • The new generation of the artist's interface: Connect your mic to Scarlett's 4th Gen mic pres. Plug in your guitar. Fire up the included software. Start making your first big hit
  • Studio-quality sound: With a huge 120dB dynamic range, the newest generation of Scarlett uses the same converters as Focusrite’s flagship interfaces, found in the world's biggest studios
  • Never lose a great take: Scarlett 4th Gen's Auto Gain sets the perfect level for your mic or guitar, and Clip Safe prevents clipping, so you can focus on the music
  • Find your signature sound: Air mode lifts vocals and guitars to the front of the mix, adding musical presence and rich harmonic drive to your recordings
  • With Scarlett 4th Gen, you have all you need to record, mix and master your music: Includes industry-leading recording software and a full collection of record-making plugins

Do not mistake pacing or ingest settings for sync fixes

-re paces file reading for real-time output; it is not a timestamp correction. FFmpeg’s documentation says it reads input at native frame rate, equivalent to setting -readrate 1. The documentation cautions against slowing actual capture or live inputs with a low read rate because packet loss can result. See the FFmpeg read-rate documentation.

YouTube’s ingest recommendations help compatibility and delivery quality, but matching them does not repair a bad source timeline. The current YouTube encoder settings 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. It lists 44.1 kHz audio for stereo and 48 kHz for 5.1 surround, with 128 kbps stereo and 384 kbps 5.1 audio. Its video bitrate recommendations vary by codec, resolution and frame rate, so consult the live guide for the configuration you use rather than treating one bitrate as a sync remedy.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test synchronization on YouTube Live

  1. Use the Live Control Room preview to check a section with visible movement and audible events whose timing is easy to judge.
  2. Compare the outgoing preview near the beginning, later in the play, and across a loop boundary. This distinguishes a fixed offset from growing drift or a recurring jump.
  3. Monitor YouTube’s stream health messages while live and review any warnings. A connected ingest indicator or a command that keeps running does not establish that audio and video are synchronized.
  4. Change one relevant setting at a time, then repeat the same checks so you can tell whether that change helped.

YouTube Help recommends testing with audio and movement similar to the planned stream, then monitoring stream health. See its encoder guidance. If you use RTMPS, YouTube describes it as an encrypted extension of RTMP; the ingest URL and key come from Live Control Room. See YouTube’s RTMPS guidance.

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

Common troubleshooting mistakes

  • Assuming a loop flag guarantees sync: -stream_loop -1 repeats input; it does not prove stream timestamps align at each boundary.
  • Guessing an offset: Measure which stream leads or lags before using -itsoffset; a guessed shift can worsen the result.
  • Using -re as a sync fix: It paces prerecorded input for real-time output, not corrects timestamp drift.
  • Forcing constant frame rate automatically: cfr can duplicate or drop video frames and is not an audio-sync switch.
  • Changing YouTube bitrate or keyframes to fix drift: Those settings address ingest compatibility and delivery, not source timestamp alignment.
  • Sharing a full command without redaction: Remove the stream key before posting commands, logs or screenshots.

Or let it run in the cloud

If your goal is an always-on YouTube loop rather than managing an FFmpeg process yourself, StreamNeo runs uploaded videos or playlists from the cloud: upload the video, add your YouTube stream key, and go live. It does not stream from a camera. Nothing has to stay on at home; uploaded video streams at its original quality up to 4K 60fps at one flat price per slot, with automatic recovery if YouTube drops the stream. That can remove the need to keep a computer and home connection running, but it is not a timestamp correction for a source file that is already out of sync. The first day is free with no card. Monthly is $9.99 per month. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.