Reputation: 143
Is there a way to trim off N samples from audio file using SoX / FFmpeg or the likes of?
Upvotes: 5
Views: 3561
Reputation: 143
Using SoX trim :
sox in.wav out.wav trim 0s 1000s
Trims first 1000 samples with 0 samples offset.
's' here means 'sample', not 'second'. To trim by 'seconds' you should remove 's'
To trim specified range of sample(s):
sox in.wav out.wav trim 5000s 100s
Trims 100 samples, from 5000 to 5100 (5000s - samples offset, 100s - number of samples to trim after offset)
sox in.wav out.wav trim 123456788s 1s
Trims 123456789-nd sample (123456788s - samples offset, 1s - number of samples to trim after offset)
Upvotes: 9
Reputation: 134313
Use the atrim filter:
ffmpeg -i input -af atrim=start_sample=65614:end_sample=102400 output
start_sample
- The number of the first sample that should be output.
end_sample
- The number of the first sample that should be dropped.
Upvotes: 3