Hello,
I am trying to make a video/music player which let the user extract small sequences into a new file. First I am trying to understand how qt mutimedia works and how I could extract small sequences into a new file.
For instance I have a video inVideo.mp3 that last 200 secondes.
I want to extract the following intervals [4,10], [12,32] and [150,171] into a new video outVideo.mp2.
Anyeone know how I could do that?
Right now I tried that:
Here is my MainWindow.cpp.
I considere the other files not important but you can find them there:Code:#include "MainWindow.h" #include "ui_MainWindow.h" #include <iostream> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { this->ui->setupUi(this); QUrl urlInFile = QUrl::fromLocalFile("/home/cedric/VEG849.wmv"); this->playlist.addMedia(urlInFile); this->player.setPlaylist(&playlist); this->recorder = new QMediaRecorder(&player); QVideoEncoderSettings videoEncoderSettings; QAudioEncoderSettings audioEncoderSettings; videoEncoderSettings.setCodec("video/mpeg2"); videoEncoderSettings.setResolution(640, 480); audioEncoderSettings.setCodec("audio/vorbis"); audioEncoderSettings.setQuality(QtMultimediaKit::HighQuality); this->recorder->setEncodingSettings(audioEncoderSettings, videoEncoderSettings); QUrl urlOutFile = QUrl::fromLocalFile("/home/cedric/cuttedVideo.mp2"); this->recorder->setOutputLocation(urlOutFile); this->connect(this->ui->startButton, SIGNAL(clicked()), this, SLOT(start())); this->connect(this->ui->stopButton, SIGNAL(clicked()), this, SLOT(stop())); //*/ } MainWindow::~MainWindow() { delete ui; delete this->recorder; } void MainWindow::start() { recorder->record(); player.play(); std::cout << "start" << std::endl; //player.setPosition(2000); } void MainWindow::stop() { player.stop(); recorder->stop(); std::cout << "stop" << std::endl; }
http://code.google.com/p/testqtmobil...k%2F04cutAudio
The problem with that code is that the movie is playing and I can heard the sound. Also no new file is created.
Thanks in advance,
Cédric

Reply With Quote

