2013-05-08 243 views
0

我在Qt GUI應用程序中使用ffmpeg命令(用於將mp3文件合併到一個文件中)。當我運行我的應用程序合併文件顯示在cmd窗口的結果。如何隱藏用戶無法看到的cmd窗口。在qt項目中不顯示cmd窗口

QString mergeMp3FilesStr = "ffmpeg -y -i \"concat:"; 
/*....some part of code*/ 
mergeMp3FilesStr+=" \" -c copy D:\\Mp3Files\\mergedMp3.mp3" 
system((const char *)mergeMp3FilesStr.toStdString().c_str()); 


And so command is looking like this (I'm viewing result with QDebug): 
ffmpeg -y -i "concat:D:\Mp3Files\a.mp3|D:\Mp3Files\a.mp3|D:\Mp3Files\a.mp3 " -c copy D:\Mp3Files\mergedMp3.mp3 
+0

你可以展示更多關於如何啓動ffmpeg命令的代碼? – 2013-05-09 02:02:02

+0

感謝您的回覆。 我已經編輯了我的問題並添加了部分代碼。 – Heghine 2013-05-09 18:40:19

回答

1

QProcess是外部程序是推薦的方式,這樣就可以有一個更好的和更精細的控制,更便於攜帶。您還可以查詢this questionthis瞭解更多信息。

+0

謝謝,我會試試看。 – Heghine 2013-05-12 15:48:38

+0

謝謝@YamnHon.CHAN,它幫助。 我用QProcess :: execute函數解決了這個問題。 – Heghine 2013-06-11 20:14:37