809
社区成员
发帖
与我相关
我的任务
分享
Private Declare Function GetShortPathName Lib "kernel32.dll" Alias "GetShortPathNameA" (ByVal lpszLongPath As String, ByVal lpszShortPath As String, ByVal cchBuffer As Long) As Long
'设置输出文件
Dim S As String
Dim Inputfile As String '输入文件
Dim Outputfile As String '输出文件
Outputfile = "D:\OutPutFile.wav"
If Dir(Outputfile) = "" Then '文件不存在则创建
FileNumber = FreeFile
Open cjlT1 For Binary As #FileNumber
Put #FileNumber, , Chr(0)
Close #FileNumber
End If
S = String(LenB(Outputfile), Chr(0))
GetShortPathName Outputfile, S, Len(S)
Outputfile = left(S, InStr(S, Chr(0)) - 1)
'设置环境变量以支持FFmpeg输入文件路径
FileNumber = SetEnvironmentVariable("Path", FFmpegPath) '设置FFmpeg文件所在路径
S = "ffmpeg -i """ & Inputfile & """ -f wav -acodec pcm_s16le -ac 1 -y " & Outputfile
Call Shell(S, vbHide)