I am using visual studio 2010 integrated with Qt5.0.1.
I want to record or clip a video from a video file.
I used QMediarecorder but cannot able to record the video. Below is the snippet I am using.
Any solution will be helpful.
QMediaPlayer mediaPlayer;
mediaPlayer.setmedia("c:\\sample.avi");
QVideoWidget videoWidget;
mediaPlayer.setVideoOutput(&videoWidget);
mediaPlayer.play();
QMediaRecorder *mediaRecorder = new QMediaRecorder(&mediaPlayer);
QVideoEncoderSettings *videosettings = new QVideoEncoderSettings;
videosettings->setResolution(1280,720);
videosettings->setQuality(QMultimedia::VeryHighQuality);
videosettings->setFrameRate(25.0);
videosettings->setCodec("H.264Video");
mediaRecorder->setVideoSettings(settings);
QString file = "C:\\record.avi";
QFile file1(file);
file1.open(QIODevice::WriteOnly);
mediaRecorder->setContainerFormat("avi");
mediaRecorder->setOutputLocation(QUrl::fromLocalFile(file));
mediaRecorder->record();
after some seconds in another function i will call mediaRecorder->stop();
When you use mediaRecorder->setVideoSettings
, set it to videosettings
. You don't have a variable settings
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.