QT ffmpeg视频剪辑

ffmpeg cmd指令:source.avi 视频从8秒开始时长为971秒剪辑  25帧率,保存到D:/demo.mp4。

//ffmpeg.exe -i D:/source.avi -vcodec copy -y -r 25 -ss 8 -t 971 D:/demo.mp4  >> D:\clip_info.txt 2>&1

QString program=QCoreApplication::applicationDirPath()+"/ffmpeg/bin/ffmpeg.exe";

//QString program = "D:\\maxview_video_demo\\ffmpeg\\ffmpeg-git-985e768-win64-static\\bin\\ffmpeg.exe";

QString inputPath = ui->videopathLineEdit->text();

QFile sourceFile(inputPath);

 if(!sourceFile.exists()){

            QMessageBox::information(this,QString::fromUtf8("提示"),QString::fromUtf8("找不到源文件"));

            return;

        }

        QString outputPath = QFileInfo(sourceFile).absolutePath() +"/clip.mp4";

        QFile destFile(outputPath);

        if(destFile.exists()){

            destFile.remove();

        }

        QString startTime = ui->timeEdit1->time().toString("hh:mm:ss");//timeEdit编辑为0:00:00

        QString len= ui->timeEdit2->time().toString("hh:mm:ss");

        QStringList arguments;

        arguments << "-i" << inputPath << "-r" << "25"<<"-ss";

        arguments <

        QProcess *clipProcess = new QProcess(this);

        connect(clipProcess,SIGNAL(finished(int)),this,SLOT(clipVideoFinished(int)));

        clipProcess->start(program,arguments); //program     ffmpeg.exe地址       arguments  ffmpeg参数

你可能感兴趣的:(QT)