Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

gstramer error when second video recording attemp at qml camera



  • Hello, I thought the camera, video recording and photo taking application that I made was working without any problems, but when I try to record video through the application for the second time, I get an error like the following. Can someone help me out with this error?

    I can view the videos and photos I took on the application without any problem.

    Hardware features

    • Rasberry Pi 3 B+
    • Buildroot 2020.02.9 version
    • Qt 5.15.2
    • Qt Creator 4.14.0

    hata2.PNG

    **The code below is my test code **

    import QtQuick 2.12
    import QtQuick.Window 2.12
    import QtMultimedia 5.12
    import QtQuick.Controls 2.12
    import QtQuick.Controls.Styles 1.4
    import Qt.labs.folderlistmodel 2.12
    
    //import "qrc:/TestGrid.qml"
    
    Window {
        id: root
        width: 800
        height: 480
        visible: true
        title: qsTr("v1.0")
    
        property int i: 0
    
        //MainPage
        Item{
    
            id:pageMain
            width: root.width
            height: root.height
            visible: true
    
            x:0
            y:0
            z:0
    
            Camera{
                id: camera
                captureMode: Camera.CaptureVideo
                flash.mode: Camera.FlashOff
    
                videoRecorder{
    
                    outputLocation: "/root"
                    mediaContainer: "video/mpeg, mpegversion=(int)4"
                    videoCodec: "video/mpeg, mpegversion=(int)4"
                    //outputLocation: "file:///root/rec"+i+".mp4"
                    resolution: "640x480"
                    frameRate: 30
    
    
                    muted: true
    
                    onErrorStringChanged: {
                        console.log(("Error: "+camera.videoRecorder.errorString))
                    }
    
                    onRecorderStatusChanged: {
    
                        console.log("Status: "+camera.videoRecorder.recorderStatus)
                    }
    
                    onRecorderStateChanged: {
    
                        console.log("State: "+camera.videoRecorder.recorderState)
                    }
    
                    onMediaContainerChanged: {
                        console.log(camera.videoRecorder.mediaContainer)
                                        }
    
                    onActualLocationChanged:{
                        console.log(camera.videoRecorder.actualLocation)
                                        }
                }
            }
    
            VideoOutput{
                id: videoOutput
                source: camera
                anchors.fill: parent
                focus: visible
                fillMode: VideoOutput.Stretch
            }
    
            //CaptureButton
            Button{
                x:50
                y:390
    
                palette {
                    button: "#00000000"
                }
    
                icon: {
                   icon.source="qrc:/images/camera_icon.png"
                   icon.width=100
                   icon.height=100
                }
    
                onPressed: {
                    camera.captureMode= Camera.CaptureStillImage
                    icon.source = "qrc:/images/pause_icon.png"
                    console.log("btnCaptureOn Click");
                }
    
                onReleased: {
                    if( camera.cameraState !== Camera.ActiveState){
                        camera.start()
                    }
    
                    camera.imageCapture.capture()
    
                    icon.source = "qrc:/images/camera_icon.png"
                    console.log("btnCaptureOff Click");
                }
            }
    
            //RecordButton
            Button{
    
                property bool stateToggle: false
                x:670
                y:390
    
                palette {
                    button: "#00000000"
                }
    
                icon: {
                   icon.source="qrc:/images/record_icon.png"
                   icon.width=100
                   icon.height=100
                }
    
                onClicked: {
                    if(!stateToggle){
    
                        /*if( camera.captureMode != Camera.CaptureVideo ){
                            camera.captureMode= Camera.CaptureVideo
                        }
    
                        if( camera.cameraState != Camera.ActiveState){
                            camera.start()
                            console.log("girdi toogle Start")
                        }*/
    
    
                        camera.start()
                        camera.captureMode= Camera.CaptureVideo
    
                        camera.videoRecorder.setMetadata("Date", new Date())
                        camera.videoRecorder.setMetadata("Title", "hb"+i++)
    
                        mTimer.start()
    
                        icon.source = "qrc:/images/pause_icon.png"
                        ceylanFile.ceylanLog("Record Start");
    
                        stateToggle = true;
                    }else{
    
                        camera.videoRecorder.setRecorderState(CameraRecorder.StoppedState)
                        camera.stop()
                        //i++;
                        //camera.videoRecorder.outputLocation= "file:///root/rec"+i+".mpeg"
    
                        icon.source = "qrc:/images/record_icon.png"
                        ceylanFile.ceylanLog("Record Stop");
    
                        stateToggle = false;
                    }
                }
            }
    
            Button{
                x:10
                y:10
    
                palette {
                    button: "#00000000"
                }
    
                icon: {
                   icon.source="qrc:/images/file_icon.png"
                   icon.width=68
                   icon.height=53
                }
    
                onClicked: {
                    pageSettings.visible=true
                    pageMain.visible=false
                    console.log("btnPageOpen Click");
                }
            }
    
            Timer{
                id:mTimer
                running: false
                interval: 1000
    
                onTriggered: {
    
                    camera.videoRecorder.record()
    
                    console.log("geldi")
                    mTimer.stop()
                }
            }
        }
    

    Below are the debug outputs of the program while it is running.

    hata1.PNG


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    I haven't used that component yet but why don't you use the its stop method ?



  • "camera.videoRecorder.stop()" I tried this too but again the result is the same
    I've been trying different methods to fix the problem so I removed "videoRecord.stop".


  • Lifetime Qt Champion

    Did you try the Declarative Camera example to see if it shows the same behaviour ?



  • Camera Example
    This application fails while taking video.
    How can I do a more detailed error analysis?
    I will be glad if you tell me where to look.

    In addition I got an error like this.

    hata3.PNG


  • Lifetime Qt Champion

    That looks like a kernel issue.

    Do you have a different camera to test ?


Log in to reply