'ffmpeg being inprecise when trimming mp3 files

I want to use ffmpeg to trim some mp3s without re-encoding. The command I used was
ffmpeg -i "inputfile.mp3" -t 00:00:12.414 -c copy out.mp3
However, out.mp3 has a length of 12.460s, and when I load the file in Audacity I can see that it was cut at the wrong spot, and not at 12.414s.

Why is this? I googled a bit and tried some other commands like ffmpeg -i "inputfile.mp3" -ss 0 -to 00:00:12.414 -c copy out.mp3 (which interestingly results in a different length of 12.434s) but could never get the milliseconds to be cut right.

enter image description here

enter image description here

PS. I wasn't sure whether SO was the right place to ask since it isn't technically programming related, however most of the stuff I found on ffmpeg for trimming audio files were stackoverflow questions, e. g. ffmpeg trimming videos with millisecond precision



Solution 1:[1]

On Linux you can use mp3splt:

mp3splt -f mp3file.mp3 from to -o output file format

Example:

mp3splt -f "/home/audio folder/test.mp3" 0.11.89 3.25.48 -o @f_trimmed this will create a "/home/audio folder/test_trimmed.mp3"

For more info to the parameters, check the mp3splt man page here


On Windows you can use mp3DirectCut

mp3DirectCut has a GUI, but it also have command line support

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Max