Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › 24/7 stream

Fix FFmpeg Audio Drifting Out of Sync in a 24/7 Animated Story Stream

By Freedom251 Team · · 6 min read

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

First find out whether the audio is out of sync by a steady amount or whether the gap grows over time. A steady offset points toward stream start times or an intentional timestamp offset; gradual drift calls for checking clocks, sample cadence and timestamps; a sudden jump near a story or loop boundary calls for inspecting that transition. Those patterns narrow the investigation, but the title alone cannot identify a single cause or guarantee a fix.

1. Measure the drift before changing FFmpeg options

Write down the FFmpeg version and complete command, along with the input formats, output protocol, codecs, mapping, filters and relevant options such as -copyts, -itsoffset, -stream_loop and -re. Record when the audio and video first separate, whether the gap grows smoothly or jumps, and whether it coincides with a file or segment change. Without those details, a command copied from another setup may alter timing without addressing the cause.

As an Amazon Associate I earn from qualifying purchases.

Check the input streams and timestamps

Use ffprobe to inspect audio and video stream start times, durations and reported frame-rate fields. For example, this prints the start time and duration of each stream:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
ffprobe -v error -show_entries stream=index,codec_type,start_time,duration,avg_frame_rate,r_frame_rate -of table input.mp4

Replace input.mp4 with the actual input file. Compare the audio and video start times, and check whether frame-rate fields suggest variable or inconsistent timing. These fields help identify things to investigate; they do not, on their own, prove a fault. For several files in a playlist or loop, inspect each input rather than assuming they share the same timestamp origin.

#1 Best Overall
Focusrite Scarlett Solo 3rd Gen USB-C Audio Interface | 1 XLR Mic Preamp, 1 Hi-Z Instrument Input, 24-Bit/192kHz, 56dB Gain Range, Air Mode, macOS/Windows/iPadOS Compatible
  • 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

Observe synchronization during playback

Play a representative input or a local capture of the FFmpeg output with ffplay’s statistics display:

ffplay -stats input.mp4

The FFmpeg Project’s ffplay documentation says this display includes the current position and audio/video synchronization drift. Note the displayed drift near the start, after a meaningful stretch of playback, and after a content transition. FFmpeg’s documentation also explains that the master clock controls audio-video synchronization; audio is the default master clock in most players, while changing clocks is a debugging consideration rather than a universal repair.

Rank #2
Focusrite Scarlett Solo 4th Gen USB-C Audio Interface | 1 XLR Mic Preamp, 1 Hi-Z Instrument Input, 24-Bit/192kHz, 120dB Dynamic Range, Air Modes, PC/Mac/iPad Compatible
  • 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

Separate FFmpeg output from receiver behavior

If possible, compare a local recording or playback of FFmpeg’s output with the downstream player or platform. If the local result stays synchronized but the receiver does not, investigate the receiver or delivery path as well as the FFmpeg command. A platform-side display problem cannot be diagnosed from the command line alone.

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

2. Match the correction to the observed pattern

What you observe What to investigate What not to assume
The gap is present near the start and remains roughly steady. Audio/video start times and whether an input timestamp offset is intentional or needed. A fixed offset is not a remedy for drift that accumulates over time.
The gap grows gradually during playback. Audio clock or sample cadence versus stream timestamps; whether audio resampling and timestamp correction are appropriate. A single timestamp shift will not necessarily correct a changing mismatch.
The gap changes suddenly around a file, segment or loop boundary. Packet timestamps and timestamp origins on both sides of the boundary; whether the incoming media resets or jumps its clock. Looping is not established as the cause just because the stream runs continuously.
Only the downstream player appears out of sync. A local capture or playback compared with the receiving player, plus receiver and delivery behavior. The FFmpeg output is not proven faulty by one player’s display.

For a fixed offset, inspect start times first

Determine whether audio and video begin at different timestamps and whether the offset was deliberately introduced. An input offset such as -itsoffset shifts timing; it is not a general way to repair a gap that keeps increasing. Avoid adding or changing an offset until you know which input it affects and have checked the resulting output.

Rank #3
SABRENT USB External Stereo Sound Card Adapter, Plug & Play (AU-MMSA) | USB audio adapter; no drivers needed; for Windows & Mac; 3.5mm headphone & mic jacks; usb to 3.5mm jack audio adapter
  • 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.

For gradual drift, evaluate audio resampling carefully

A practical community cookbook suggests trying an asynchronous audio-resampling filter for gradual drift, with an example of -af "aresample=async=1:first_pts=0". Treat that as a diagnostic starting point, not a proven fix for this stream. Confirm the option meanings against the installed build and the current FFmpeg Filters Documentation, and test on a representative capture before using it for a continuous broadcast. Applying an audio filter means audio is processed and re-encoded; it is not a stream-copy-only change. Check the output codec and bitrate settings that your destination requires.

Do not add legacy -async as a generic cure without verifying the FFmpeg version and which behavior that option refers to. Prefer checking the current aresample filter documentation for the installed build, then verify synchronization across an interval long enough to reveal whether drift returns.

Rank #4
M-AUDIO M-Track Duo USB Audio Interface | Dual XLR, Line and DI Inputs, Professional Software Suite for Recording, Streaming, and Podcasting
  • 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 jumps, check format-specific timestamp behavior

FFmpeg’s documentation on timestamp handling describes automatic correction of timestamp discontinuities for formats that accept them, including MPEG-TS and HLS. It also states that this correction is automatically disabled when -copyts is used, except for timestamp wrapping detection. The input format and presence of -copyts therefore matter before changing timestamp flags. Inspect timestamps near a transition and test changes on a short capture rather than applying a flag on the assumption that all inputs handle discontinuities alike.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

Similarly, shifting timestamps together to make them start at zero does not necessarily repair relative audio/video sync: FFmpeg documents that a common shift preserves the relative differences between audio, video and subtitle timestamps. Changing the origin and correcting the relationship between streams are different operations.

Best Value
Focusrite Scarlett 2i2 4th Gen USB-C Audio Interface | 2 Mic Preamps, 2 Hi-Z Instrument Inputs, 24-Bit/192kHz, 120dB Dynamic Range, Auto Gain, Clip Safe, Air Modes
  • 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
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

3. Verify the change through a full content cycle

  1. Save the original command and configuration. Change one relevant setting at a time so the effect of each adjustment is identifiable.
  2. Capture a representative run. Include ordinary playback and, where applicable, a file or segment transition. Record the start, intermediate and later drift observations.
  3. Inspect the changed output. Check both synchronization and whether the output stream still has the intended audio/video codecs, resolution and delivery settings. A filter may change whether audio can be copied unchanged.
  4. Test at the boundary that previously failed. If the symptom appeared on a loop or segment change, verify timestamps and synchronization on both sides of that point.
  5. Keep the repair only if the measured behavior improves. If it does not, restore the prior configuration and investigate the input timestamps, clock relationship or receiving player rather than stacking speculative flags.

4. Troubleshoot common failure modes

  • The suggested filter option is rejected. Check the installed FFmpeg build and its filter options against the official filter reference. Builds and versions can differ; do not substitute a similarly named legacy option without checking its behavior.
  • The sync is correct at the start but worsens later. A start-time shift is unlikely to address an accumulating mismatch by itself. Recheck longer-interval measurements, audio cadence and timestamps, then test a documented resampling approach.
  • The stream jumps out of sync at a transition. Compare timestamps immediately before and after the boundary, including the next file’s timestamp origin. Confirm the input format and whether -copyts changes the discontinuity-correction behavior.
  • Local playback and the platform disagree. Preserve a local capture and compare it with the receiving player. The discrepancy may be outside the encoded output, and the available information does not establish which side is responsible.
  • The command becomes more complicated without improving sync. Undo speculative offsets and timestamp flags, return to the recorded baseline, and change one variable at a time. More timestamp options do not automatically mean better synchronization.

5. Keep the 24/7 operating setup separate from the sync fix

A continuous schedule makes both gradual drift over runtime and sudden changes at content boundaries worth checking. It does not establish a special 24/7 FFmpeg defect. FFmpeg documents RTMP as a multimedia streaming protocol over TCP/IP and includes an example of publishing with FFmpeg in its protocol reference. A VPS or other always-on host can keep a publishing process running, but changing hosting does not correct incorrect media timestamps or audio/video timing.

Or let it run in the cloud

If your animated story is made from uploaded videos and the destination is YouTube, StreamNeo is a cloud alternative to keeping an FFmpeg machine on at home: upload the recording or playlist, add your YouTube stream key, and go live. Nothing has to stay on at home; it plays uploaded videos, not a live camera feed. Each slot streams the uploaded quality up to 4K 60fps at one flat price per slot, includes automatic recovery if YouTube drops the stream, and the first day is free with no card. It does not repair synchronization problems already present in a video, so check the source playback before uploading. Monthly service is $9.99 per month. Start your free day on 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.

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

24/7 streamaudio syncFFmpeglive streamingYouTube streaming

Leave a Reply

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

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

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

Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
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.