# Trimming after MP3: two references

An exact trim of a decoded copy does not establish identity with original PCM. One signal, two comparisons and a shifted control.

L00P.AI · 1.0 · 2026-11-22

https://www.l00p.ai/en/resources/series/ciecie-po-mp3-dwa-punkty-odniesienia/

## 01 / Length does not establish identity

A trimmed excerpt has the expected length and starts at the expected position. Has it retained the original samples? In our trial the answer depends on what we call the reference. The excerpt exactly matched the selected range after MP3 decoding, but differed from the same range in the original PCM.

This extends [A good render is not yet accepted material](/en/resources/series/dobry-render-to-jeszcze-nie-odebrany-material/). That article checked a synthetic WAV trim. Here we add a separate MP3 encoding stage and distinguish trim acceptance from comparison with the original. For a library owner, the practical decision is simple: the acceptance record must identify the reference file.

## 02 / Retain every stage

On 21 November 2026 we prepared an original three-second mathematical signal: mono PCM16, 48000 Hz, 144000 samples. It combines two integer triangle patterns with deterministically generated, interpolated pseudorandom values. It contains no recording, voice or third-party music. We retained the original, the encoded MP3 and the fully decoded copy.

We used the installed FFmpeg reporting version 2025-11-12-git-6cdd2cbe32, with libmp3lame at a constant 128000 bit/s and default Xing writing. Full decoding produced a PCM16 WAV. We did not rebuild the program or independently establish binary correspondence with source code. Current documentation describes options; the preserved version and logs describe this trial's execution.

The trimmed copy comes from that full decode. We did not trim the compressed stream using stream copy or re-encode MP3 after trimming. The result should not be transferred to those operations.

## 03 / Range and conditions recorded before execution

We retained samples from 24001 inclusive to 96007 exclusive, counting from zero. That is 72006 samples, or 1.500125 s. The filter atrim=start_sample=24001:end_sample=96007 selects samples, while asetpts=PTS-STARTPTS resets the timestamp origin. Resetting timestamps alone cannot restore values changed during encoding and decoding.

The protocol required exact length and zero difference against the specified slice of decoded PCM. A separate control trimmed the identical range directly from the original WAV. We would measure differences after the MP3 round trip without setting a listening-quality threshold. Ten control conditions passed in one trial; these are not ten independent repetitions.

## 04 / One output, two comparisons

![Changed samples out of 72006: output/decoded 0; output/original 71884; WAV/original 0; shifted +1/decoded 71937. One trial.](https://www.l00p.ai/wydawnictwo/ciecie-po-mp3-dwa-punkty-odniesienia/mp3-en-v1.svg)

Each comparison below covers 72006 samples. “Changed” counts positions with unequal integer PCM16 values. “Max” is the largest absolute difference in integer PCM16 units.

```text
comparison                          changed  max
output / decoded range                    0    0
output / original range               71884  605
WAV control / original range              0    0
shift +1 / required decoded range     71937  554
```

The sum of squared differences between output and original was 2702968642. Against the correct decoded range it was zero. The value 605 is a measurement of this file, not a predeclared quality threshold or an audibility judgement.

The negative control shifts the decoded range by one sample: [24002,96008). Length remains 72006, but comparison with the required range detects 71937 differences. Length-only acceptance would let this error through.

We also checked residual lag against the original: at 512 positions spread inside the excerpt, we compared squared-error sums for shifts from −2048 to +2048 samples. Zero samples was the sole minimum; the protocol allowed an absolute best shift of at most 1. This is a bounded alignment check after full decoding, not a measurement of raw encoder delay, proof of gapless playback or UTC synchronization.

## 05 / Two fields in the acceptance record

Record separately: “does the trim match the range of the selected file?” and “does the selected file retain the required properties of the original?”. For the first question, give the reference hash, sample indices, format, length and allowed error. The second needs its own conditions, determined by the copy's purpose.

Our result establishes the accuracy of this trim against this decoded copy. It does not establish a lossless path from the original PCM. A real conversation still needs listening checks of boundaries, names and meaning. To organize this acceptance process, let us start with one preserved source and one target copy.

## 06 / Sources, rights and correction

We read current descriptions of [atrim and setpts/asetpts in the FFmpeg documentation](https://ffmpeg.org/ffmpeg-filters.html#atrim) and [libmp3lame options](https://ffmpeg.org/ffmpeg-codecs.html#libmp3lame), alongside the installed version's help. The documentation distinguishes sample counting from timestamp-based conditions; atrim does not reset timestamps itself. This was not a review of the complete manuals. Acceptance checked saved files and arithmetic without repeating encoding or the original trial.

This covers one synthetic signal, codec, bitrate and version. We performed no listening, speech, music, converter or multi-player test. The signal, text, SVG and text equivalent are original. Codex acted as an AI agent in editorial, management and author-check roles and prepared PL/EN and the diagram; there was no independent second-model review. Changes to source, codec, parameters, boundaries or copy requirements trigger renewed acceptance.
