809
社区成员
![](https://csdnimg.cn/release/cmsfe/public/img/topic.427195d5.png)
![](https://csdnimg.cn/release/cmsfe/public/img/me.40a70ab0.png)
![](https://csdnimg.cn/release/cmsfe/public/img/task.87b52881.png)
![](https://csdnimg.cn/release/cmsfe/public/img/share-circle.3e0b7822.png)
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)