how can i find the file saved by Qmediarecorder



  • all codes are following,I want to know how to find the video 1.mp4, hope your answers,because the qt example can't press the vidio menu,it is disabled!

    viewFinder = new QCameraViewfinder();
        camera = new QCamera;
        recorder = new QMediaRecorder(camera);
        camera->setCaptureMode(QCamera::CaptureVideo);
        camera->setViewfinder(viewFinder);
        camera->start();
        viewFinder->show();
        QAudioEncoderSettings audioSettings;
        audioSettings.setCodec("audio/amr");
        audioSettings.setQuality(QMultimedia::HighQuality);
        recorder->setAudioSettings(audioSettings);
        QVideoEncoderSettings videoSettings;
        videoSettings.setCodec("video/mpeg2");
        videoSettings.setResolution(640, 480);
        recorder->setVideoSettings(videoSettings);
        recorder->setOutputLocation(QUrl::fromLocalFile("1.mp4"));
        recorder->record();
    

    the example picture:0_1557496457716_批注 2019-05-10 215405.png


  • Lifetime Qt Champion

    @Flame said in how can i find the file saved by Qmediarecorder:

    setOutputLocation

    Try to look in your build folder.



  • i can't find the video file in the file include exe file,do i need use the other function to execute the save command ?
    this is the file tree:
    0_1557498070590_批注 2019-05-10 222027.png


  • Lifetime Qt Champion

    Hi
    That seems like a deplyment folder and not so much a build folder.
    However, i assume you mean when you just run it then.
    Maybe the tab is grey as it cant save the video.
    You should check the sample code under what condition, it won't allow the tab.
    You could also try with path in setOutputLocation



  • @mrjj sorry sir, I think I may let you misunderstand,i do this don't use qt example,all codes show as following;

    viewFinder = new QCameraViewfinder();
        camera = new QCamera;
        recorder = new QMediaRecorder(camera);
        camera->setCaptureMode(QCamera::CaptureVideo);
        camera->setViewfinder(viewFinder);
        camera->start();
        viewFinder->show();
        QAudioEncoderSettings audioSettings;
        audioSettings.setCodec("audio/amr");
        audioSettings.setQuality(QMultimedia::HighQuality);
        recorder->setAudioSettings(audioSettings);
        QVideoEncoderSettings videoSettings;
        videoSettings.setCodec("video/mpeg2");
        videoSettings.setResolution(640, 480);
        recorder->setVideoSettings(videoSettings);
        recorder->setOutputLocation(QUrl::fromLocalFile("1.mp4"));
        recorder->record();
    

    i want these codes will have the function which can save the video from camera,i mean “Are there any missing steps”


  • Lifetime Qt Champion

    Hi
    It looks ok, but you should hook up the error handling signals to catch any errors.
    void QMediaRecorder::error(QMediaRecorder::Error error)



  • @mrjj thank you very much for your advise, but sorry , i think i will bother you again,today i try to obtain the signal error,i find there is not error signal emited,but i find the state and status is : QMediaRecorder::StoppedState and QMediaRecorder::UnavailableStatus ,after i using the "record" function,i don't konw how to handle this problem,hope your advise


  • Lifetime Qt Champion

    Hi
    Can you try to qDebug() << camera->isCaptureModeSupported(QCamera::CaptureVideo);.

    I got this feeling recording is not supported.
    https://doc.qt.io/qt-5/qtmultimedia-windows.html
    "Video recording is currently not supported. "



  • @mrjj sorry sir,i can't reply you immediately,because i am a new member
    , i find isCaptureModeSupported(QCamera::CaptureVideo) is false, you are right,I do use Windows platforms, thank you ,It seems that I can only use other methods.


  • Lifetime Qt Champion

    Hi
    Yes it seems on windows, recording is not really supported. still.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.