Skip to content

How do I cut a dialogue stem by sample count for a frame-indexed picture edit?

Choose audio boundaries in the sample domain when a handoff requires a reproducible stem length. Convert any picture-frame boundary using the actual rational frame rate and sample rate, record the rounding policy, and then count the output samples. Frame numbers and audio sample numbers are different coordinates. A sample-accurate cut does not by itself establish that the original voice and visible action were synchronized.

AUDIO FINISHING: MEASURABLE TRACKS AND ENDPOINTSAISwapLab team · Editorial methodPublished 3 min read
See the recorded exampleExplore 67 Image SkillsIndependent finishing · Check the actual file
Editorial worksheet excerpt: Input rate; Retained interval; Expected PCM duration; Timeline placement. See the complete table and sources below.
Editorial worksheet excerpt: Input rate; Retained interval; Expected PCM duration; Timeline placement. See the complete table and sources below.

Sample-interval record

This task differs from merely explaining that 48 kHz audio and 30 fps video use different units. It creates an exact interval contract and a repeatable audio extraction. Timestamp-based boundaries can be affected by nonzero starts or imperfect timing fields; sample-count options instead count samples passing through the filter. Keep the intended source interval and its relationship to the picture documented, especially when the video uses a fractional frame rate or variable presentation timing.

Build the evidence

  1. 01

    Write the interval and conversion policy

    Record the selected audio stream's sample rate and the approved picture boundary convention. For a known constant 30 fps timeline at 48,000 samples per second, one video-frame duration spans 1,600 samples. That convenient integer does not generalize to all rates. At a fractional or variable rate, use the actual timeline times and state how a non-integer sample boundary is rounded; never substitute the rounded display label 29.97 into a calculation without documenting it.

  2. 02

    Trim a half-open sample interval

    The example retains samples beginning at 48,000 and ending before 240,000, a 192,000-sample interval at the assumed 48 kHz input. It then rebases presentation timestamps without changing the chosen membership. The output is a PCM WAV to avoid treating an encoded audio packet count as the sample count. Do not insert a resampling filter before the sample selection unless the interval has been recalculated for that new sample domain.

  3. 03

    Verify the stem and its placement

    Check output sample rate, decoded length and the first and final intended sounds. Place the saved stem against the approved picture using the documented common reference. Inspect early and late synchronization events, since perfectly counted samples can still have been taken from the wrong offset. If the recipient needs another encoding, keep the PCM interval contract with the handoff so encoding delay is not confused with the source cut.

A bounded example

Local executed evidence: the stated trim produced a four-second PCM output from a six-second, 48 kHz synthetic stereo fixture under FFmpeg 7.1. This matches the 192,000-sample interval contract. It does not validate dialogue synchronization, the correctness of a fractional-rate rounding policy or any generated lip movement. A production handoff needs the actual source rate, selected boundaries and picture-placement record. Archive that conversion worksheet with the stem.

Local diagnostic commands

The FFmpeg sample trim was executed on a local 48 kHz synthetic fixture under FFmpeg 7.1. The ffprobe verification query is a documentation example and was not run locally. No paid generation was performed.

shell
# Assumes verified 48 kHz input: retain samples [48000, 240000).
ffmpeg -n -i approved.wav -af "atrim=start_sample=48000:end_sample=240000,asetpts=PTS-STARTPTS" -c:a pcm_s24le sample-cut.wav
ffprobe -v error -show_entries stream=sample_rate,time_base,duration_ts,duration -of json sample-cut.wav

Sample-interval record

FieldExampleInterpretation
Input rate48000 samples/secondVerified, not inferred from filename
Retained interval[48000,240000)192000 samples
Expected PCM duration4 secondsSeparate from picture sync
Timeline placementApproved shared originMust still be verified

Acceptance evidence

  • The sample-rate assumption is verified on the selected input stream.
  • Start inclusion and end exclusion are written explicitly.
  • Rate conversion does not silently occur before a sample-indexed cut.
  • Sample-count correctness and picture synchronization are checked independently.

Stop condition

Stop if the boundary coordinates refer to a different source version, a resampled stem or an unrecorded time origin. Resolve that mapping before extracting again. If the source has genuine drift, changing a sample interval cannot make all events align; diagnose the drift and approve any retiming as a separate operation.

Sources

Review the result in context.

Compare the recorded example and its documented limitations.

See the recorded example