Skip to content
streamneo.
Troubleshooting13 min read

FFmpeg YouTube Live Loop Audio Out of Sync: How to Fix It

Diagnose whether FFmpeg loop audio sync is offset or drifting, then inspect tracks, timestamps, loop boundaries and the YouTube stream.

sn.
StreamNeoPublished 4 October 2026
Worth sharing?

An FFmpeg YouTube Live loop that sounds out of sync needs diagnosis before it needs a delay setting. First establish whether the mismatch is already present at the start, grows steadily during playback, or jumps when the video repeats; those patterns point to different parts of the timing chain.

Then compare the audio and video timelines, inspect the loop boundary and FFmpeg’s timestamp behaviour, and check what reaches YouTube. There is no universal offset or command that fixes every loop: the right adjustment depends on which stream is early and whether the difference stays constant.

Classify the sync problem before changing anything

Watch and listen from a known point near the start of the file, then check again after the stream has been running for a while and immediately after a repeat. A voice that is consistently ahead of a visible mouth movement by about the same amount suggests a stable offset. If the match becomes progressively worse, suspect a timing or rate relationship rather than a one-time start difference. If sync is acceptable until the video repeats, then suddenly shifts, investigate the loop seam and how timestamps continue across it.

Use repeatable cues. A spoken word, a drum hit, a bell strike or a hand clap makes it easier to compare the audio event with its visible cause than general background music does. Note whether the audio leads or lags, where you noticed the mismatch, and whether the same relationship returns after the next loop. Do not rely on memory between observations: write down the cue and the playback position.

A fixed difference and cumulative drift are not interchangeable. A measured start offset may be correctable by changing the relative start time, but a delay cannot correct a mismatch that keeps growing. Conversely, changing frame-rate handling or resampling in response to one stable offset may add unnecessary complexity. Make one observation at a time and keep the original command and media unchanged while you establish the pattern.

Also separate lip-sync from audio that is merely unpleasant. A music loop may sound rough because a cut lands mid-note, or because a beat is interrupted, even when audio and video remain aligned. A local news clip may have genuine speech sync trouble. Identify the kind of event that appears wrong before treating every audible discontinuity as a timestamp fault.

Compare audio and video starts and durations

Inspect the source file before editing the command. A metadata tool such as ffprobe can report the audio and video streams, including their codecs, start times, durations, sample rates, frame-rate information and time bases. Record the output rather than relying on a media player’s summary. Stream-level metadata can reveal that one track starts later or ends earlier, even when the file has a single overall duration.

Compare the audio start time with the video start time. If one track begins later, playback can begin with a stable mismatch. Compare durations as well: if the audio ends before the picture or extends beyond it, the loop may expose that difference at the end or repeat point. YouTube’s upload troubleshooting guidance on audio and video sync notes that unequal track durations can lead to sync problems and advises editing the tracks so their durations match. That is a useful source-file check, not proof that every live-loop problem has this cause.

Check whether the reported durations make sense for the content. Container duration and individual stream durations are not always identical, and rounded display values can hide small differences. Look at the stream start and end information alongside the file duration, and compare it with what you actually hear and see. A metadata discrepancy is a clue to investigate, not by itself a reason to apply a correction blindly.

For audio, note the sample rate and channel layout as well as duration. For video, note frame rate and time-base information. These details help you reason about how each track represents time, but they do not tell you on their own which setting is wrong. If you need a more detailed check of source audio properties, the guide to verifying audio channels and sample rate offers a relevant checklist.

Inspect the loop boundary

A loop repeats an existing sequence; it does not make an awkward edit seamless. Listen and watch at the end of the file and the beginning of the next pass. If a sound is cut off, repeated, or separated by a pause, check the media edit and the relationship between the end and start of both tracks. A clean audio cut and clean video cut may still fail to line up with each other if their boundaries do not represent the same moment.

Look for the timing pattern around the seam. If audio and video are aligned before the repeat but the picture or sound jumps at the boundary, the issue may be tied to track lengths, edit points or timestamp continuity during looping. If the difference continues to increase smoothly without a sudden jump, the boundary is less likely to be the only cause. These are diagnostic distinctions, not guarantees about what FFmpeg or YouTube will do with a particular file.

Listen to several transitions, not just one. A loop can sound acceptable once and still reveal a small mismatch that becomes noticeable after repetition. For spoken material, compare a recognisable word near the end and another near the start. For devotional or lofi content, choose a percussion hit, sustained note or visual cue that recurs in a predictable place. Keep the source and playback path the same between checks.

If the transition itself is the problem, consider whether the source needs a better edit or a deliberate transition before changing timestamp options. A crossfade can make audio cuts less abrupt, but it does not repair a continuing audio-video rate mismatch. Likewise, trimming a track may bring endpoints closer while changing the content. Keep a copy of the original and verify that any edit preserves the intended programme.

For playlist-based channels, a transition problem can also involve how the next item is introduced rather than a single-file loop. The playlist transition troubleshooting guide covers a related class of boundary failures, although its cause may differ from a repeated FFmpeg input.

Review timestamps, mapping and the FFmpeg command

Preserve the current command and note the installed FFmpeg version before changing it. Options can be version-sensitive, and the position of an option in the command can determine whether it applies to an input or output. In particular, FFmpeg documents -stream_loop as an input option. Confirm that it appears in the right place for the intended media input, rather than assuming that seeing the option somewhere in a long command means it applies to the file you mean.

Review stream mapping next. Check that the audio and video streams you expect are both included in the output, and that no unintended stream is being selected. FFmpeg’s command-line documentation describes how stream mapping and timestamps interact. Mapping can affect which stream provides timing for synchronisation, so a command that selects the wrong audio track or omits an expected stream can produce a misleading result.

Inspect the output frame-sync option rather than adding one because it looks familiar. FFmpeg documents -fps_mode modes including passthrough, CFR, VFR and automatic selection. Passthrough retains demuxer timestamps; CFR duplicates or drops frames to reach a requested constant frame rate; VFR passes timestamps or drops frames to avoid duplicate timestamps; automatic selection depends on muxer capability. The muxer may also modify timestamps. These choices concern video timing and output behaviour; none is a general-purpose audio-delay fix.

The appropriate mode depends on the source and delivery requirements. A source with irregular timestamps, a requested constant frame rate, and a muxer’s capabilities are different considerations. Check the documentation for the FFmpeg build you are actually running, especially if an old command uses the legacy -vsync option: current FFmpeg documentation marks it deprecated and describes per-stream -fps_mode instead. Do not change several timing options together, because you will not know which change mattered.

Also inspect timestamp-related options and filters already present. A pre-existing offset, trim, resampling or frame-rate conversion may explain the behaviour, but only if it matches the observed pattern. Avoid pasting in a guessed -itsoffset, audio delay or resampling correction. First identify which track is early, measure whether the difference changes, and establish whether the command is altering timestamps before the output is sent.

Compare local playback with the YouTube stream

Test the file and command locally where practical, then compare that result with YouTube’s live preview or another view of the actual stream. FFplay can help you observe playback, and its documentation describes -stats output that includes audio/video synchronisation drift. Use the statistic to see whether playback behaviour changes over time, not as proof that YouTube ingest will have precisely the same timing. FFplay’s master-clock selection is mainly a debugging tool, not an automatic correction.

Keep the comparison controlled. Use the same source file, a recognisable event, and comparable playback points. If local output is already out of sync, focus first on the file, FFmpeg options and local playback. If local output appears aligned but YouTube’s preview does not, inspect the output and ingest path as well as the viewing device. A delay observed on one viewer’s connection is not enough to establish that the encoded live stream itself is misaligned.

Look at YouTube’s stream health alongside the preview. Health warnings can help identify delivery or encoding trouble, but they do not necessarily explain a sync mismatch. YouTube’s encoder guidance recommends testing with representative audio and video and monitoring stream health. Its general RTMP/RTMPS guidance includes CBR, AAC or MP3 audio, a recommended two-second keyframe interval (not over four seconds), and 44.1 kHz stereo audio. These are encoder recommendations, not a diagnosis of drift in your source.

Check the stream settings against the protocol you actually use. YouTube recommends RTMPS, but changing transport is not a sync fix unless connection diagnostics point to a transport issue. Confirm the correct server URL and keep the stream key private. A useful operational check is whether the stream is consistently receiving the intended feed, not whether a different URL or protocol happens to coincide with a timing change.

Choose an adjustment that matches the evidence

Use the observed failure pattern to narrow the next change. The table is a diagnostic guide, not a set of guaranteed fixes. Exact adjustments depend on the command, FFmpeg version, source metadata and direction of the mismatch.

What you observe What to inspect first Sensible next step
Similar offset from the opening onward Audio and video start times; existing delay or trim options Measure which stream leads, then test a small, deliberate start-time adjustment if evidence supports it
Difference grows gradually Track timing, frame-rate conversion, sample-rate handling and timestamp behaviour Investigate the rate relationship; do not assume one fixed delay will solve it
Sync is acceptable, then jumps at each repeat Track durations, edit points and timestamps around the loop boundary Inspect or revise the source seam and confirm how the input is looped
Local playback aligns but YouTube preview differs Output mapping, encoder settings, stream health and playback comparison Run a representative test and isolate whether the difference appears before or after ingest
Only one device or viewer reports a mismatch Playback path and repeatability across observations Compare another viewing path before changing the source or command

For a stable offset, establish its direction and magnitude using repeatable audio and picture cues before applying a timing change. If you cannot tell which stream is early, do not choose a sign by guesswork. FFmpeg documentation describes an approach in which one stream can remain unchanged while the remaining stream or streams are synced to it. That does not say which stream should be the reference in your case; the reference must suit the content and the evidence.

For growing drift, focus on timing and rate behaviour: inspect timestamps, source frame-rate information, audio sample rate and any conversion or synchronisation options. A fixed delay may make the beginning appear better while leaving the end worse. If the mismatch resets at each repeat, compare the audio and video boundaries before trying to compensate with a global offset.

Make a single change and retest from the same cue. Keep a brief record of the command before and after, the point where you listened, and whether the mismatch stayed fixed, grew or jumped. If the result worsens, restore the previous version rather than layering a second correction on top of the first. This gives you a way back and makes later diagnosis more reliable.

Retest and monitor the loop

A short local test can expose a bad start time or an obvious edit problem, but a loop should be observed long enough to include a repeat and the point where drift was previously noticed. Use a representative section with speech or a clear musical cue. If the content changes between tests, you may mistake a different event for an improvement, so keep the source and observation points consistent.

After changing one variable, compare the same cues at the beginning, later in playback and around the repeat. Note whether the difference is constant, cumulative or boundary-specific. Then test the actual YouTube stream and review its preview and health indicators. A local file playing correctly does not prove that every later stage behaves identically, and a single preview observation does not establish a repeatable fault.

For a channel that must keep running, include sync in the routine checks alongside whether the broadcast is still live. A monitoring checklist for a 24/7 devotional stream can help you make the check practical: choose a recognisable cue, listen at planned intervals, and record what changed rather than relying on a vague impression. If the stream runs overnight, arrange a way to review the test at a time when you can still investigate the source and command.

Once the loop is stable, preserve the tested media and command together. Record the FFmpeg version, source file revision, relevant options, and the observation that confirmed the change. If a later edit or command update brings the fault back, that record helps separate a source change from a timing-option change. If you still cannot isolate it, gather the command with the stream key removed, FFmpeg version, media metadata, which stream leads, and whether the mismatch grows or recurs at the loop point.

If the recurring difficulty is keeping a local computer running and recovering a dropped broadcast, StreamNeo can take the uploaded video and keep the YouTube loop running without leaving that computer on; it does not remove the need to check that the source file itself is synchronised.

Before committing, compare the operating options on the pricing page. When the file and channel are ready, start free — 24-hour trial, no card.

FAQ

Should I add an audio delay to fix FFmpeg sync?

Only if you have established a stable offset, measured which stream is early, and confirmed that the difference does not grow or jump at the loop boundary. A guessed delay can make one moment look right while making another worse. Preserve the original command and test one change at a time.

Why does sync get worse the longer the stream runs?

A progressively growing mismatch suggests a timing or rate relationship worth investigating, rather than only a start-time difference. Compare track timing, frame-rate and sample-rate information, timestamps, and any output synchronisation or conversion options. The exact cause cannot be identified without the file metadata and command.

Why does the mismatch return when the video loops?

A repeat-specific jump makes the audio and video boundaries, track durations and timestamp continuity useful places to inspect. Listen and watch immediately before and after the seam, and check whether both streams represent the same moment at their boundaries. Looping does not guarantee that an edit is seamless or that the tracks have matching durations.

What details are needed for a precise diagnosis?

Share the FFmpeg version, the command with its stream key removed, stream metadata for audio and video, and a description of which stream leads. Include where the problem first appears and whether it stays constant, grows, or returns at each repeat. Those details are more useful than trying a generic offset command.

YOU’VE REACHED THE END

Keep the ideas coming.

More guides, useful tools and a little help for your next broadcast.

Back to the journal ↗
YOUR NEXT READ

A little more to explore.

More Troubleshooting guides ↗ · All topics ↗