Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trim off N samples from audio file using SoX / FFmpeg etc

Tags:

ffmpeg

sox

Is there a way to trim off N samples from audio file using SoX / FFmpeg or the likes of?

like image 485
Vasyl Shumskyi Avatar asked Jan 06 '23 06:01

Vasyl Shumskyi


1 Answers

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)

like image 147
Vasyl Shumskyi Avatar answered Jan 15 '23 00:01

Vasyl Shumskyi