Is there a command line tool or ffmpeg /sox command to generate speech labels? similar to audacity sound finder

639 views Asked by At

Is there a command line tool or ffmpeg / sox command to generate speech labels? similar to audacity sound finder. Only timeStart and timeEnd are needed in the output. Preferably, to generate from a given timeStart to a given timeEnd.

2

There are 2 answers

1
Gyan On

The silencedetect filter will print out a readout of silences. You can pair each silence end with the next silence start to identify speech segments. If the first silence start value is not zero, then the first speech segment is 0 to that value. Else, you can discard it.

To log the filter output to a file, pair it with the metadata filter.

ffmpeg -i out_.mp3 -af "silencedetect=noise=-18dB:d=0.15,ametadata=mode=print:file=vol.txt" -f null -
0
TROUZINE Abderrezaq On

1- Extract time:

ffmpeg -i input.mp3 -ss 00:00:00 -to 00:10:00 -acodec copy output.mp3

2- Execute silentdetect:

ffmpeg -i output.mp3 -af silencedetect=noise=-18dB:d=0.15 -f null - 2> vol.txt

3- Generate labels with javaScript:

var inp=document.getElementById("inp"), outp=document.getElementById("outp");
var c, st=[], et=[], a=inp.value.split('\n');
for(var i=1; i<a.length; i++){
  c=a[i].split(' | ');
  (c.length==1?et.push(c[0].split(' ')[4]):st.push(c[0].split(' ')[4]) )
};
var t='';
for (var i=0;i<et.length; i++){
  t+=st[i]+'\t'+et[i]+'\t'+(i+1)+'\n'
};
outp.value=t;