Skip to content
streamneo.
Troubleshooting10 min read

How to Fix an FFmpeg YouTube Stream Going Out of Sync Over Time

Compare local and YouTube playback, measure whether sync drift grows, and check FFmpeg timestamps and ingest health before changing settings.

sn.
StreamNeoPublished 5 October 2026
Worth sharing?

Compare a local recording from your FFmpeg setup with the same section of the YouTube playback before changing the command. If the local recording also drifts, investigate timing in the inputs and output; if only YouTube playback does, check the encoder-to-YouTube path as well.

Next, establish whether the offset grows or remains roughly constant. A fixed delay and a gradually widening gap are different problems, and without your FFmpeg command, input devices and local recording, there is no responsible way to name a definitive cause or prescribe a final command.

Compare the local recording with YouTube playback

Choose a recognisable event in the stream: a spoken word, a drum hit, a clap, or a visible mouth movement. Compare that moment near the beginning and later on in both a local recording and the YouTube playback. Use the same material and, as far as possible, the same playback point; otherwise a different edit or buffering delay can look like a sync fault.

The comparison answers a useful first question: where does the problem first appear? If the local file is already out of sync, YouTube did not create the original mismatch. Look at the capture, timestamps, filter chain and output being recorded. If the local file stays in sync but the YouTube version does not, inspect the encoder output and YouTube ingest and playback path before altering the audio timing.

This is a diagnostic inference, not a remote diagnosis. YouTube’s troubleshooting guidance recommends checking the encoder output and local archive, reviewing encoder errors and CPU load, and testing the outbound connection. Its live-stream troubleshooting guidance is a useful checklist when the local archive and platform playback disagree.

Keep the comparison fair. A local recording made from a different output point may not contain the same timing behaviour as the stream being sent. Write down where the recording was captured, whether it includes the same filters, and which part of the YouTube stream you compared. If the issue appears only after ingest, capture the encoder’s own output as well if your setup allows it.

For a wider view of the computer and connection trade-offs in an always-on setup, see the discussion of a home PC versus a VPS in India. That comparison does not identify a sync fault, but it can help you distinguish local workload and connectivity questions from media-timing questions.

Find out whether the offset grows

A simple written log can prevent a fixed correction being applied to a changing error. At a few points in the same test, note whether speech leads or trails the picture and roughly how the mismatch changes. Do not invent a precision threshold: the useful distinction here is whether the gap remains similar or becomes more noticeable as playback continues.

What you observe What it suggests What to investigate next
Similar offset near the start and later A fixed start-time difference is plausible Confirm the input start points and timestamps before considering an offset
Gap becomes progressively larger Ongoing timing disagreement is plausible Compare the local recording, input clocks and timestamps; inspect audio resampling only with evidence
Local recording remains aligned, YouTube playback changes The problem may appear after the local output Check encoder output, ingest health, archive and outbound connection
Results differ between tests The test conditions may not be comparable Repeat with the same source, command, capture point and observation points

These patterns narrow the search; none proves a cause by itself. A gradual change can involve timing relationships that need inspecting, while a constant offset points to a different class of issue. If you insert a fixed delay to conceal a progressive drift, the stream may look better at one moment and worse later.

Keep notes alongside the test: command used, input names, start time, local recording location, YouTube health messages, and the points you compared. Redact your stream key before sharing a command or log. A key grants access to your broadcast and does not help diagnose timing.

If your stream is built around a playlist, also check whether transitions or loop boundaries coincide with the moment the mismatch changes. The article on scheduling playlists in an FFmpeg YouTube stream covers playlist behaviour; here, the important point is to compare the same source passage rather than a transition on one playback and a steady section on another.

Inspect sync with ffplay statistics

FFmpeg’s ffplay can show playback statistics, including audio/video synchronisation drift. Use a local capture of the relevant setup, not a different sample file, so the observation relates to the problem you are testing. A basic inspection is:

ffplay -stats path/to/local-recording

Watch the statistics while the recording plays, and compare what you see near the start with what you see later. The display is evidence, not a diagnosis: it can help show whether the local playback’s synchronisation changes, but it does not tell you which input clock, timestamp, filter or delivery stage is responsible. See the FFmpeg ffplay documentation for the options supported by your build.

For a useful test, note the file and the approximate points in playback when you checked the figures, then compare those points with the audio and picture themselves. Do not treat one displayed value as proof that a live YouTube audience receives the same result. Local playback, the encoder’s output and YouTube playback are distinct observations; the earlier comparison tells you which one deserves attention.

If you cannot produce a local recording, do not infer that the stream is fine just because the YouTube preview looks acceptable at one point. Make a representative test capture or collect encoder output and health information before changing settings. A longer observation is useful because the question is whether the offset changes, not simply whether any initial delay exists.

Check timestamps and input clocks

Audio and video inputs can carry timestamps that describe when their media should be presented. If sources use clocks that do not advance in step, the relationship can change over time. First establish what your inputs are: files, capture devices, separate audio hardware, or a mixture. Record how each is opened and whether timestamp options or filters are already present.

FFmpeg’s aresample filter can fill, trim, stretch or squeeze audio to follow audio timestamps. Its compensation is disabled by default. That makes it a possible test when the timestamps offer a meaningful reference, not a universal cure for unrelated or unreliable clocks. Consult the FFmpeg resampler documentation and check the documentation for your installed version before using an option.

A trial such as aresample=async=1:first_pts=0 should not be copied into a production command without checking what it assumes. first_pts=0 assumes that the first audio presentation timestamp belongs at zero; depending on the source, that can add silence at the beginning or trim samples with negative timestamps. Listen at the start and later in a local recording, and watch for new artefacts. If the result makes the start worse, remove it rather than accepting a different fault.

A constant input start-time mismatch is different. FFmpeg’s -itsoffset shifts an input’s timestamps by a fixed amount. -isync can adjust one input against another’s start time, but the documented behaviour expects timestamp sources based on the same clock for the expected result. Neither option should be treated as a generic fix for a gap that keeps growing. The FFmpeg documentation for input timestamp options describes their intended use; confirm that your build supports the relevant options.

Before testing a timing change, inspect what timestamps are present and where they originate. If you are unsure, preserve the original command and a copy of the test output. A change that appears to improve one section may alter the start, introduce silence, or shift sync in the other direction. The purpose of the first test is to learn something about the timing relationship, not to declare the stream fixed.

Review the FFmpeg command and inputs

There is no useful one-line replacement command without the current command and the inputs it operates on. Share or review the full command with stream keys and other credentials removed. Include the relevant input options, filters, mapping, output settings and whether audio and video come from the same file or separate sources. A fragment that omits input ordering or timestamps can conceal the part that matters.

Check that you are comparing the same audio and video through the chain. A local recording taken before a filter is not an exact substitute for inspecting output after that filter. Likewise, a file-based test may not reproduce timing from a live capture device. Write down where each input enters and where the local recording is made, then interpret its sync evidence accordingly.

Do not change codec, bitrate or latency settings merely because the stream is out of sync. First look at the actual command and Live Control Room messages. YouTube identifies incorrect audio/video settings as possible ingestion errors, and its encoder settings guidance describes its current ingest recommendations. Settings can change, so use the official page and the messages shown for your stream rather than relying on an old example.

YouTube also recommends tests with audio and movement similar to the real stream, then monitoring stream health. Its guidance on encoder settings and stream health is relevant when you need to verify the platform side. Check the current Live Control Room preview and health indicator, and note any warning at the time you hear or see the mismatch.

When a problem appears on a continuous channel, a restart can obscure whether the timing error was accumulating or simply reappear after the next start. Keep a recording or notes from before and after any restart. For adjacent operational issues, see recovering an Indian music stream after a YouTube disconnect; a reconnect and a sync drift are not the same fault, even if they happen during the same overnight run.

If managing a local machine through a long test is itself a recurring burden, StreamNeo can remove the need to leave your computer running for a file-based 24/7 broadcast, but it does not diagnose or correct an FFmpeg command or a source-clock problem. Resolve and verify the media timing before choosing how to keep a channel running.

Retest after one change at a time

Keep the original command and test material unchanged as a baseline. Make one purposeful adjustment, run the same representative content, and compare the local recording and YouTube playback at the same observation points. If you change a filter, an input option and an encoder setting together, an improved result will not tell you which change helped, and a worse result will be harder to undo.

Include speech or music and visible movement if those are part of the real channel. YouTube recommends realistic tests and ongoing monitoring of audio and video. Let the test continue long enough to see whether the gap changes, then inspect both the local recording and platform playback. Record any Live Control Room messages and encoder errors rather than relying on memory.

A repair is not established by one good moment. Check the start and later playback, listen for introduced silence or artefacts, and repeat under the same input conditions. If the local recording is aligned but YouTube is not, return to ingest and delivery checks instead of stacking more timestamp offsets. If the local file still drifts, keep investigating its timing evidence and inputs.

When asking for help, provide the redacted FFmpeg command, input-device details, a local recording or reproducible excerpt, what ffplay -stats shows over time, and the corresponding YouTube health messages. That evidence lets someone reason about your setup. Without it, a supposedly definitive filter or offset is guesswork.

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

Can I fix growing drift by adding -itsoffset?

Not reliably: -itsoffset applies a fixed timestamp shift to an input, while a growing gap changes over time. First compare a local recording with YouTube playback and inspect whether the offset changes. Use a fixed shift only when evidence points to a measured start-time mismatch.

Should I add aresample=async=1:first_pts=0?

Treat it as a test, not a default repair. Audio compensation follows timestamps, so it is only meaningful when those timestamps provide a usable reference; the zero start assumption may also change the beginning of the audio. Check the local recording at the start and later, and consult the documentation for your installed FFmpeg version.

What if the local file is in sync but YouTube is not?

Check the encoder’s output, archive, errors and workload, then inspect Live Control Room health messages and the outbound connection. That pattern points you to the ingest and delivery path before you change the local audio timing, though it does not prove a specific platform-side cause.

What information is needed to recommend a command?

Provide the complete command with credentials removed, the input devices or files, where the local recording is captured, and what changes between the beginning and later playback. Include ffplay -stats observations and relevant YouTube health messages. Without those details, no specific command can be responsibly called the fix.

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 ↗