Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. iOS saves Video mp4 as zero KB
Forum Updated to NodeBB v4.3 + New Features

iOS saves Video mp4 as zero KB

Scheduled Pinned Locked Moved Solved Mobile and Embedded
5 Posts 2 Posters 372 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JamieSchultz
    wrote on last edited by
    #1

    Hello,

    I have a qml that has a videoRecorder .. Application saves mp4 fine in Android.
    The mp4 does saves in iOS .. BUT file size is zero KB

    Camera {
        id: camera
        viewfinder.resolution: "1080x1920"
        // "640x480"
        viewfinder.minimumFrameRate: 30
        viewfinder.maximumFrameRate: 30
        position: Camera.FrontFace
        imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceAuto
        focus.focusPointMode: CameraFocus.FocusPointFaceDetection
        focus.focusMode: CameraFocus.FocusContinuous
        exposure {
            exposureMode: Camera.ExposureAuto
        }
        imageProcessing {
            denoisingLevel: 1.0
            }
    
        videoRecorder {
            resolution: "640x480"
            frameRate: 30
            videoBitRate: 15000000
            audioChannels: 1
            audioBitRate: 8000
            mediaContainer: "mp4"
        }
    }
    

    I bind the location as follows

      QString theDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
      QUrl q = QUrl::fromLocalFile(theDir);
      result->m_videoPath = q.toString();
    

    The in QML

                var path = filter.videoPath + "/" + filter.PID + ".MP4";
                videoRecorderPathName.pathName = path;
                var outResult = camera.videoRecorder.setOutputLocation(path);
                if (outResult)
                {
                    console.debug("setOutputLocation success");
                    console.debug("OutputLocation " + path);
                }
                else {
                     console.debug("setOutputLocation fail");
                     console.debug("OutputLocation " + path);
                }
    

    The setOutputLocation returns false

    However; Upon stop .. the file is created in the anticipated directory on the iPhone .. But the file size is zero KB

    1 Reply Last reply
    0
    • J Offline
      J Offline
      JamieSchultz
      wrote on last edited by
      #5

      I resolved the issue..

      I will share in the event someone else experiences the same pain as I have today..

      The problem was the videoBitRate & audioBitRate .. after removing these ... the mp4 files saved in iOS correctly .. and by the way I found the correct codec

          videoRecorder {
                  resolution: "640x480"
                  frameRate: 30
                  //videoBitRate: 15000000
                  audioChannels: 1
                  //audioBitRate: 8000
                  mediaContainer: "mp4"
                  videoCodec: "avc1"
              }
      

      As a post note ... I want to thank you for providing excellent examples.. I was able to look at your camera-Widget & camera-QML examples and they were valuable.

      The camera-Widget was great because it has a setup dialog that runs all the 'supported' methods so I was able to see the supported Codec and Container option that exist on my iPhone.

      Thanks

      1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi and welcome to devnet

        Just an intuition but I would try with mov as media container.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JamieSchultz
          wrote on last edited by
          #3

          Thank you for the rapid reply.. Unfortunately that did resolve the issue.
          Any other ideas?

          1 Reply Last reply
          0
          • J Offline
            J Offline
            JamieSchultz
            wrote on last edited by JamieSchultz
            #4

            More info ..

            I am getting Unsupported codec messages as well..

            I have tried 'h264' 'mpeg4' 'mp4'

            Would anyone have an idea as to which codec you would use on iOS for mp4 or mov files?

            Are there any libraries or framework LIBS I need to include in the pro file?

            Thank you

            UPDATE: .. current LIBS in pro file
            LIBS += -framework Foundation
            LIBS += -framework AVFoundation
            LIBS += -framework CoreFoundation
            LIBS += -framework MessageUI
            LIBS += -framework Photos

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JamieSchultz
              wrote on last edited by
              #5

              I resolved the issue..

              I will share in the event someone else experiences the same pain as I have today..

              The problem was the videoBitRate & audioBitRate .. after removing these ... the mp4 files saved in iOS correctly .. and by the way I found the correct codec

                  videoRecorder {
                          resolution: "640x480"
                          frameRate: 30
                          //videoBitRate: 15000000
                          audioChannels: 1
                          //audioBitRate: 8000
                          mediaContainer: "mp4"
                          videoCodec: "avc1"
                      }
              

              As a post note ... I want to thank you for providing excellent examples.. I was able to look at your camera-Widget & camera-QML examples and they were valuable.

              The camera-Widget was great because it has a setup dialog that runs all the 'supported' methods so I was able to see the supported Codec and Container option that exist on my iPhone.

              Thanks

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved