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.
Asked
Active
Viewed 586 times
0
-
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. For the silence start value, if it's not zero, then the first speech segment is 0 to that value. Else, you can discard it. – Gyan Sep 07 '17 at 11:13
-
@Mulvya It worked, thanks: `ffmpeg -i out_.mp3 -af silencedetect=noise=-18dB:d=0.15 -f null - 2> vol.txt`the generated labels are different from those of audacity! the first label has a negative value! – TROUZINE Abderrezaq Sep 07 '17 at 11:33
-
That's likely the MP3 decoder priming frame. Treat it as zero. – Gyan Sep 07 '17 at 12:14
-
@Mulvya the first value isn't needed. Is there a way to write only the _[silencedetect @_ lines to _vol.txt_ ? – TROUZINE Abderrezaq Sep 07 '17 at 13:09
-
`silencedetect,ametadata=mode=print:file=vol.txt` – Gyan Sep 07 '17 at 13:45
-
@Mulvya can you please post the full code. I got an error `Invalid argument` – TROUZINE Abderrezaq Sep 07 '17 at 13:53
2 Answers
2
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 -

Gyan
- 85,394
- 9
- 169
- 201
1
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;

TROUZINE Abderrezaq
- 468
- 5
- 9