作者:风中冰雨 | 来源:互联网 | 2024-09-26 17:35
手机49kbps转换比特率256Kpbs{‘corpus_no’:‘7045177033217452815’,‘err_msg’:‘success.’,‘err_no’:0,‘re
手机49kbps 转换比特率256Kpbs
{‘corpus_no’: ‘7045177033217452815’, ‘err_msg’: ‘success.’, ‘err_no’: 0, ‘result’: [‘今天下午去开会今天下午去开会’], ‘sn’: ‘858605479691640333103’}
{‘corpus_no’: ‘7045177041635399899’, ‘err_msg’: ‘success.’, ‘err_no’: 0, ‘result’: [‘今天下午去开会今天下午去开会’], ‘sn’: ‘683207632331640333105’}
from aip import AipSpeech
from moviepy.editor import AudioFileClip
```java
def avi_hebing():from moviepy.editor import *videoclip_1 = VideoFileClip("one.mp4")clipSpeed = videoclip_1.speedx(2)clip = clipSpeed.subclip(0, 50)clip.crop(0, 278, 540, 580).write_videofile(r"F:\video\WinBasedWorkHard_crop.mp4")clipSpeed.write_videofile(r"F:\video\fansNote_speed2.mp4") audio_1 = videoclip_1.audio video_audio_clip = videoclip_1.audio.volumex(0.8) audio_clip = AudioFileClip(r'F:\test\video\aaa\moviepy\mp3\test.mp3').volumex(0.5)audio = afx.audio_loop(audio_clip, duration=videoclip_1.duration)audio_clip_add = CompositeAudioClip([video_audio_clip,audio])videoclip_2 = VideoFileClip("two.mp4") final_video = videoclip_2.set_audio(audio_clip_add) final_video.write_videofile("video_result.mp4") def avi_to_txt():fielname_mp4="kaihui.mp4" my_audio_clip = AudioFileClip(fielname_mp4)fielname_wav='kaihui.wav'my_audio_clip.write_audiofile(fielname_wav, fps=8000, nbytes=2, buffersize=20000,codec=None, bitrate=None, ffmpeg_params=None,write_logfile=False, verbose=True, logger='bar')import numpy as npdef wav2pcm(wavfile, pcmfile, data_type=np.int16):f = open(wavfile, "rb")f.seek(0)f.read(44)data = np.fromfile(f, dtype= data_type)data.tofile(pcmfile)pcmfile_pcm='kaihui.pcm'wav2pcm(fielname_wav, pcmfile_pcm, data_type=np.int16)APP_ID = ''API_KEY ='GYKqlTqfnxFHokkfEujXbuDW'SECRET_KEY ='23zkptXIwi0YnWbfpll2s5jhFkKxZuSR'client = AipSpeech(APP_ID, API_KEY, SECRET_KEY)def get_file_content(file_path):with open(file_path, 'rb') as fp:return fp.read()fielname_wav='kaihui.wav' result = client.asr(get_file_content(fielname_wav), 'wav', 16000, {'dev_pid': 1536})print(result)test1 = client.asr(get_file_content(pcmfile_pcm), 'pcm', 16000, {'dev_pid': 1536, })print(test1)