执行ffmpeg裁剪Qt中的音频 [英] Execute ffmpeg to Crop Audio in Qt

查看:198
本文介绍了执行ffmpeg裁剪Qt中的音频的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个可用于使用Qt裁剪音频文件的应用程序. 我已经使用以下命令通过命令行成功运行了ffmpeg:

I want to create an application which can be used to crop audio files using Qt. I've successfully run ffmpeg via command line to do this using the following command:

ffmpeg -t 30 -i C:\\test.mp3 -acodec copy C:\\test2.mp3

然后我尝试使用Qt进行此操作,下面的代码似乎可以正常工作,但是找不到输出文件(test2.mp3).

Then I tried to do this using Qt and my code below seems to work, but I can't find the output file (test2.mp3).

QProcess* process=new QProcess(this);
process->start("FFmpeg-N-49957-g8c95d17\\ffmpeg.exe",QStringList()<<"-t 30 -i C:\\test.mp3 -acodec copy C:\\test2.mp3");

上面的代码有什么问题吗?

Is there anything wrong with my code above?

推荐答案

我认为,您忘记添加'waitForFinished()'行,只是没有时间完成任务

I think, you forgot to add 'waitForFinished()' line and it just doesn't have time to complete your task

QProcess process;
process.start("ffmpeg -t 30 -i C:\\test.mp3 -acodec copy C:\\test2.mp3");
process.waitForFinished();
process.close();

这篇关于执行ffmpeg裁剪Qt中的音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆