[FFmpeg-user] ogg encoder always adds 128-255 extra samples

Basin Ilya basinilya at gmail.com
Thu Mar 2 17:49:41 EET 2017

I'm trying to create a set of chainable ogg files out of a long wav file. However, the produced ogg files are always 128-255 samples longer than the source PCM data and the
extra data looks like anti-click or fade-out.

See the attached image. test0 was made directly. test1 was made via an intermediate ogg file.

I tried to choose a duration whose sample count is divisible by 64 or 128, but that didn't help.

    # produce 10 seconds of noise
    ffmpeg -y -t 10 -f lavfi -i aevalsrc="random(0)*2-1" -c:a pcm_s16le test.wav
    </dev/null ffmpeg -y -ss 0 -t 0.995567 -i test.wav -af "ashowinfo" test0.wav
    </dev/null ffmpeg -y -ss 0 -t 0.995567 -i test.wav -af "ashowinfo" test1.ogg
    # pts:43008 nb_samples:897
    </dev/null ffmpeg -y -i "test1.ogg" -af "ashowinfo" test1.wav
    # pts:44032 nb_samples:128

The only workaround I see is to make a slightly longer ogg, then use "-acodec copy" and "-t" to discard 1 or 2 unneeded ogg frames.

More information about the ffmpeg-user mailing list