Browse Source

simple convert in en script

master
Tykayn 1 year ago committed by tykayn
parent
commit
ed4d03342d
  1. 5
      conversion_simple_en.py
  2. 2
      conversion_simple_fr.py
  3. BIN
      input/ydl/uniqueid.mp3
  4. 12
      input/ydl/uniqueid/0_output_.json
  5. 4
      input/ydl/uniqueid/1_converted_.txt
  6. 4
      input/ydl/uniqueid/2_without_nulls_.txt
  7. 4
      input/ydl/uniqueid/3_without_nulls_.txt
  8. 4
      input/ydl/uniqueid/4_phrases_.txt
  9. BIN
      input/ydl/uniqueid/uniqueid.wav
  10. BIN
      input/ydl/uniqueid_facho.mp3
  11. 44
      input/ydl/uniqueid_facho/0_output_.json
  12. 1
      input/ydl/uniqueid_facho/1_converted_.txt
  13. 1
      input/ydl/uniqueid_facho/2_without_nulls_.txt
  14. 1
      input/ydl/uniqueid_facho/3_without_nulls_.txt
  15. 1
      input/ydl/uniqueid_facho/4_phrases_.txt
  16. BIN
      input/ydl/uniqueid_facho/uniqueid_facho.wav
  17. 11
      transcript.sh

5
conversion_simple_en.py

@ -6,9 +6,8 @@ import os
import wave
SetLogLevel(0)
# print(" ------- conversion simple de", sys.argv[1])
if not os.path.exists("models/fr"):
if not os.path.exists("models/en"):
print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.")
exit (1)
@ -18,7 +17,7 @@ if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE
print ("Audio file must be WAV format mono PCM.")
exit (1)
model = Model("models/fr")
model = Model("models/en")
rec = KaldiRecognizer(model, wf.getframerate())
while True:

2
conversion_simple_fr.py

@ -6,8 +6,6 @@ import os
import wave
SetLogLevel(0)
print(" ------- conversion simple de", sys.argv[1])
if not os.path.exists("models/fr"):
print ("Please download the model from https://alphacephei.com/vosk/models and unpack as 'models' in the current folder.")
exit (1)

BIN
input/ydl/uniqueid.mp3

Binary file not shown.

12
input/ydl/uniqueid/0_output_.json

@ -1,12 +0,0 @@
{
"text" : ""
}
{
"text" : ""
}
{
"text" : ""
}
{
"text" : ""
}

4
input/ydl/uniqueid/1_converted_.txt

@ -1,4 +0,0 @@
""
""
""
""

4
input/ydl/uniqueid/2_without_nulls_.txt

@ -1,4 +0,0 @@
""
""
""
""

4
input/ydl/uniqueid/3_without_nulls_.txt

@ -1,4 +0,0 @@
""
""
""
""

4
input/ydl/uniqueid/4_phrases_.txt

@ -1,4 +0,0 @@

BIN
input/ydl/uniqueid/uniqueid.wav

Binary file not shown.

BIN
input/ydl/uniqueid_facho.mp3

Binary file not shown.

44
input/ydl/uniqueid_facho/0_output_.json

@ -1,44 +0,0 @@
{
"result" : [{
"conf" : 0.545601,
"end" : 0.120000,
"start" : 0.000000,
"word" : "les"
}, {
"conf" : 0.658098,
"end" : 0.600019,
"start" : 0.180000,
"word" : "fascistes"
}, {
"conf" : 0.911231,
"end" : 0.719916,
"start" : 0.660000,
"word" : "de"
}, {
"conf" : 0.885049,
"end" : 1.109087,
"start" : 0.719916,
"word" : "merde"
}, {
"conf" : 0.512951,
"end" : 1.530000,
"start" : 1.380000,
"word" : "un"
}, {
"conf" : 0.840160,
"end" : 2.430000,
"start" : 1.547196,
"word" : "fasciste"
}, {
"conf" : 0.992080,
"end" : 2.609995,
"start" : 2.490000,
"word" : "de"
}, {
"conf" : 0.994251,
"end" : 3.210000,
"start" : 2.609995,
"word" : "merde"
}],
"text" : "les fascistes de merde un fasciste de merde"
}

1
input/ydl/uniqueid_facho/1_converted_.txt

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

1
input/ydl/uniqueid_facho/2_without_nulls_.txt

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

1
input/ydl/uniqueid_facho/3_without_nulls_.txt

@ -1 +0,0 @@
"les fascistes de merde un fasciste de merde"

1
input/ydl/uniqueid_facho/4_phrases_.txt

@ -1 +0,0 @@
les fascistes de merde un fasciste de merde

BIN
input/ydl/uniqueid_facho/uniqueid_facho.wav

Binary file not shown.

11
transcript.sh

@ -6,6 +6,14 @@ if [ $1 ]; then
file=$1
fi
FILE_NAME=$(basename $file .wav)
output_dir="output"
if [ $2 ]; then
output_dir=$2
fi
OUT_DIR=$( echo "$output_dir/$FILE_NAME")
echo "########### $(date) : conversion de fichier audio .WAV mono piste uniquement,
avec Vosk installé par pip3, et un modèle de textes en français."
echo " "
@ -40,8 +48,7 @@ else
exit 1
fi
echo " "
FILE_NAME=$(basename $file .wav)
OUT_DIR=$( echo "output/$FILE_NAME")
mkdir output/$FILE_NAME
echo " convertir en sous titre ? $ENABLE_SRT"
if ($ENABLE_SRT) ; then

Loading…
Cancel
Save