<!DOCTYPE html>
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-forward-container">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <p>Hello Laurent,</p>
      <p>Sorry for the double reply, but I was already able to solve the
        problem I sent you in the previous email.</p>
      <p>Here's the solution, (I might create another issue on GitHub
        and close it with the solution to help others):<br>
      </p>
      <p>I am still quite not sure, but basically gstreamer does not
        support the same <b>frame sizes</b> has the ones from the <b>sensor
          format</b><font size="4">. <br>
        </font></p>
      <p>When I do the command: <b>rpicam-vid --list-cameras: </b>I
        get the following sensor format: 1640x1232 - 41 FPS<br>
        <font color="#3a3a3a" size="1">Available cameras<br>
          -----------------<br>
          0 : imx219 [3280x2464 10-bit RGGB]
          (/base/soc/i2c0mux/i2c@1/imx219@10)<br>
              Modes: 'SRGGB10_CSI2P' : 640x480 [103.33 fps - (1000,
          752)/1280x960 crop]<br>
                                       <b>1640x1232</b> [41.85 fps -
          (0, 0)/3280x2464 crop]<br>
                                       1920x1080 [47.57 fps - (680,
          692)/1920x1080 crop]<br>
                                       3280x2464 [21.19 fps - (0,
          0)/3280x2464 crop]<br>
                     'SRGGB8' : 640x480 [103.33 fps - (1000,
          752)/1280x960 crop]<br>
                                <b>1640x1232</b> [41.85 fps - (0,
          0)/3280x2464 crop]<br>
                                1920x1080 [47.57 fps - (680,
          692)/1920x1080 crop]<br>
                                3280x2464 [21.19 fps - (0, 0)/3280x2464
          crop]</font><br>
      </p>
      <p>In the gstreamer pipeline I was using this format size, and
        although I was getting 41 fps, my frames had this <b>striping </b>effect.<br>
      </p>
      <ul>
        <li><font size="1">libcamerasrc
            camera-name=/base/soc/i2c0mux/i2c@1/imx219@10 ! video/x-raw,<b>width=1640,height=1232</b>,format=RGBx,framerate=41/1
            ! videoconvert ! appsink</font></li>
      </ul>
      <p>After looking up, I installed gstreamer1.0-plugins-base-apps
        and use the command <b>gst-device-monitor-1.0 Video </b>to
        check which gstreamer video streaming formats were available for
        my camera. And I checked that there was no 1640x1232 option, but
        a similar one 1600x1200 (same ratio as 640x480). I then tried
        with this frame size format and it is now working at 41fps with
        no striping effect:</p>
      <ul>
        <li><font size="1">libcamerasrc
            camera-name=/base/soc/i2c0mux/i2c@1/imx219@10 ! video/x-raw,<b>width=1600,height=1200</b>,format=RGBx,framerate=41/1
            ! videoconvert ! appsink</font></li>
      </ul>
      <p><br>
      </p>
      <p><br>
      </p>
      <p>I just have another short question. Now that gstreamer works
        properly and I can release the capture without that
        warning/error. I want to know if I can use libcamerasrc without
        having to activate this environment under /libcamera/build/ with
        <b>meson devenv -C build. </b>If I don't do this, I cannot use
        gstreamer with libcamerasrc, the libcamerasrc is not recognize
        for some reason.<font size="4"><br>
        </font></p>
      <p>Isn't it possible to just install libcamera where <b>libcamerasrc
        </b>is available without this virtual environment?</p>
      <p><br>
      </p>
      <p>Best Regards,</p>
      <p>Gaspar<br>
      </p>
      <p><br>
      </p>
      <p><br>
      </p>
      <div class="moz-cite-prefix">On 13/11/2024 19:00, Gaspar Ramôa
        wrote:<br>
      </div>
      <blockquote type="cite"
        cite="mid:62511fe7-3c8c-4116-b9c1-6b7be6bab56e@gmail.com">
        <meta http-equiv="Content-Type"
          content="text/html; charset=UTF-8">
        <p>Hello Laurent Pinchart,</p>
        <p><br>
        </p>
        <p>Thank you for the quick reply! </p>
        <p>As I created the issue 3 months ago and got no reply from you
          I thought that you were no longer active or working in this
          project, and that is why I said it was difficult to get you!
          But I am glad I was able to reach you! :-)<br>
        </p>
        <p>I spent the entire afternoon following your suggestion.</p>
        <p>So I was successfully able to install the latest version of
          libcamera and the latest version of the rpicam-apps:</p>
        <p><i>rpicam-apps build: v1.5.3 50958df98d3c 13-11-2024
            (16:55:55)<br>
            rpicam-apps capabilites: egl:1 qt:1 drm:1 libav:1<br>
            libcamera build: v0.3.2+98-75fe515a</i><br>
        </p>
        <p>However when trying to run <b>gst-inspect-1.0 libcamerasrc </b>the
          system could not find the libcamerasrc. I had to activate some
          environment under /libcamera/build/ with <b>meson devenv -C
            build</b></p>
        <p>After this I was able to start the capture and release it <b>without
            any errors or warnings</b>. This is really a great positive
          step for me!</p>
        <p>The frame saved is still weird but I think you probably know
          what is missing here. I know that I still have to use some
          tunnig-files but the horizontal strips I have no idea what
          they are. I am using <b>format </b>= BGR and x-raw video on
          the gstreamer pipeline. Do you have any idea on how to convert
          these to the normal RGB. Like using the <b>rpicam-still </b>-o
          test.png gives me this:</p>
        <p><img src="cid:part1.EltpU1GE.Xixbg97M@gmail.com" alt=""
            class=""></p>
        <p>And I able getting something like this from the gstreamer
          pipeline: <br>
        </p>
        <p><img src="cid:part2.oIqrvcdh.tJazI276@gmail.com" alt=""
            class=""></p>
        <p>Any ideas? Where can I find the documentation of <b>libcamerasrc
          </b>so I can have an idea on what I can change/do.</p>
        <p><br>
        </p>
        <p>My end goal is to just be able to use the benefits of
          libcamera (changing analog gain, exposure, etc) in JAVA. <br>
        </p>
        <p><br>
        </p>
        <p>Best Regards,</p>
        <p>Gaspar Ramôa<br>
        </p>
        <p><br>
        </p>
        <div class="moz-cite-prefix">On 13/11/2024 14:35, Laurent
          Pinchart wrote:<br>
        </div>
        <blockquote type="cite"
          cite="mid:20241113133544.GA21521@pendragon.ideasonboard.com">
          <pre wrap="" class="moz-quote-pre">Hello Gaspar,

On Wed, Nov 13, 2024 at 12:51:11PM +0100, Gaspar Ramôa wrote:
</pre>
          <blockquote type="cite">
            <pre wrap="" class="moz-quote-pre">Dear libcamera community,

Thank you for developing such a helpful library.
</pre>
          </blockquote>
          <pre wrap="" class="moz-quote-pre">I'm glad you find it helpful.

</pre>
          <blockquote type="cite">
            <pre wrap="" class="moz-quote-pre">I am trying to get frames using opencv. I am actually able to get frames via
cv2.VideoCapture through GStreamer.

However, when I try to release the capture (for ending the program or maybe
adjusting raw image size): cap.release()
I get the following error:

[1:39:52.854669803] [1885] ERROR DeviceEnumerator device_enumerator.cpp:172
Removing media device /dev/media4 while still in use
[1:39:52.854709759] [1885] ERROR DeviceEnumerator device_enumerator.cpp:172
Removing media device /dev/media3 while still in use

I've already published an issue on the raspberry Pi libcamera GitHub repo where
you can get more detail on my problem: <a class="moz-txt-link-freetext"
            href="https://github.com/raspberrypi/libcamera"
            moz-do-not-send="true">https://github.com/raspberrypi/libcamera</a>
/issues/163

I found the following commit which apparently did to solve the problem I am
having now: <a class="moz-txt-link-freetext"
            href="https://github.com/raspberrypi/libcamera/commit/"
            moz-do-not-send="true">https://github.com/raspberrypi/libcamera/commit/</a>
fa63d428aef62bacf0a6ad1622a7965b3ff2ba2f 
</pre>
          </blockquote>
          <pre wrap="" class="moz-quote-pre">That commit has been merged a long time ago, before v0.0.1, so I expect
it is included in the libcamera version you are using. Your problem may
have the same symptoms but a different root cause.

You mentioned in your bug report that you tried both libcamera v0.0.5
and v0.3.0+65-6ddd79b5. v0.0.5 is fairly old. v0.3.0 is better, but I
would still recommend trying the latest master branch to see if the
issue has been fixed already.

If the issue is still present, can you try running the same GStreamer
pipeline (likely replacing appsink with some sort of display sink, or
even fakesink) from gst-launch, and see if the problem exists there too
?

</pre>
          <blockquote type="cite">
            <pre wrap="" class="moz-quote-pre">This commit was done by the user <a
            class="moz-txt-link-freetext"
            href="https://github.com/pinchartl" moz-do-not-send="true">https://github.com/pinchartl</a>. But I have no
way of contacting him to help me fix the problem.
</pre>
          </blockquote>
          <pre wrap="" class="moz-quote-pre">I'm slightly puzzled by why you had trouble contacting me, given that my
e-mail address is listed in the commit you mentioned above. Regardless,
it looks like you found a way :-) 

</pre>
          <blockquote type="cite">
            <pre wrap="" class="moz-quote-pre">Any suggestions? Thanks in advance!
</pre>
          </blockquote>
        </blockquote>
      </blockquote>
    </div>
  </body>
</html>