代码目录:
~/refer_code/speech-demo/rest-api-asr/python/audio/
~/my_code/video2txt
grep_and_wget.sh
#!/bin/bash
# source activate py35
for url in $(cat ./data/videourl.txt | grep -o "http.*mp4")
do
wget -P ./data/video/ -nc $url
python test.py $url
# https://blog.csdn.net/watfe/article/details/80284242
file="./data/audio/yo.txt"
if [ -f "$file" ]; then
echo -e "\n\n"$url | cat - "$file" >> result.txt
fi
rm ./data/audio/*
#break
done
main.py
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 17 09:12:27 2019
@author: cindyyao
"""
from pydub import AudioSegment
import sys
import os
from pydub.silence import split_on_silence
from aip import AipSpeech
#百度验证部分
APP_ID = '19276173'
API_KEY = 'Se9UYG8D9LBauEQ3QwvX4zmG'
SECRET_KEY = '3uZGWr2sISeOnsGKKHsccWAb6VzIuRCt'
client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)
video_name = sys.argv[1