filnet

  • *****
  • 113
Re: New video gadget
« Reply #15 on: October 29, 2017, 01:44:26 pm »
Seems like you understood how to edit the pipeline ;)

But the screenshot of the console shows that the gadget uses the old pipeline (without the videoconvert).
Did you forget to press Ok or something ?

filnet

  • *****
  • 113
Re: New video gadget
« Reply #16 on: October 30, 2017, 07:33:51 pm »
And if you have more than one video source (built-in web cam for instance) you can change the device-id property in the pipeline. If device-id zero is not what you want, then try 1, 2, etc...

karla

  • *****
  • 629
Re: New video gadget
« Reply #17 on: October 31, 2017, 12:04:26 pm »
Thank you filnet.

I was actually trying that before you mentioned it as a wild guess :)

ksvideosrc device-index= 0 ! videoconvert ! autovideosink
ksvideosrc device-index= 1 ! videoconvert ! autovideosink
even tried
device-index= 2
device-index= -1

But, with only the onboard webcam active, then ID = 0  gives the video feed to the video gadget.
When both the onboard webcam and the usb camera is connected then the ID = 0 gives Pipeline error msg, but ID = 1 gives the video feed again.

See the error picture here.



Does it matter that I do not have any FC board connected?

Anyway we should be able to rule out that my USB camera has problem since the PC onboard app Camera can display the stream?

Thanks

filnet

  • *****
  • 113
Re: New video gadget
« Reply #18 on: October 31, 2017, 02:52:13 pm »
Things to try:

1/ Add a decodebin in the pipeline:
     ksvideosrc device-index= 0 ! decodebin ! videoconvert ! autovideosink

2/ Use the PC application to view the video from the usb cam and see if any information about the video can be obtained (format, etc...)

karla

  • *****
  • 629
Re: New video gadget
« Reply #19 on: October 31, 2017, 02:55:07 pm »
Yes, will do.
I will also try to find another webcam to try.
Thanks

karla

  • *****
  • 629
Re: New video gadget
« Reply #20 on: October 31, 2017, 03:20:35 pm »
I tried your first command, and it worked. Got video :)

ksvideosrc device-index= 0 ! decodebin ! videoconvert ! autovideosink



Any idea what the command should look like to get the video feed in to the PFD video screen?

Its getting more exciting...

Re: New video gadget
« Reply #21 on: October 31, 2017, 04:39:29 pm »
My next here PFD widget type has a "PFD (Video)" option.  ?

filnet

  • *****
  • 113
Re: New video gadget
« Reply #22 on: October 31, 2017, 05:48:07 pm »
@Karl, for PFD Video, you need to edit the PFD Video configuration and add the same decodebin element in front of the videoconvert element (PFD already has a videoconvert element). Make sure to not run the gadget and PFD at the same time.

Pipeline should look like this:
  ksvideosrc device-index=0 ! decodebin ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true

Could you do a quick test for me: in the gadget configuration (not PFD) remove the videoconvert element. I would like to know if decodebin alone is enough.

Next thing we can do is to measure latency of the video :)

karla

  • *****
  • 629
Re: New video gadget
« Reply #23 on: November 01, 2017, 01:52:17 am »
Sorry, it got a bit late last night.

Yes!
Got video in the PFD | PFD(Video) gadget using your setting:
ksvideosrc device-index=0 ! decodebin ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true



This is big filnet!
Since I started with this flying, back in the Openpilot times, I always wanted the PFD as my OSD - Now its here!
I will use and explore this further in my Heli FPV/Photo project. I already have a fully functional MinOPOSD system installed on it, but it can turn on/off handy.

Yes,
without the videoconvert part it still work with video feed in the Video | USB Camera - play gadget. Like this:
ksvideosrc device-index= 0 ! decodebin ! autovideosink


So any other tests you like me to run?  :P

filnet

  • *****
  • 113
Re: New video gadget
« Reply #24 on: November 01, 2017, 10:56:48 am »
Great news ! Thansks for testing Karl !

Next step, if you are ok, will be to measure latency. I'll get back to you on how to do that.

f5soh

  • *****
  • 4572
    • LibrePilot
Re: New video gadget
« Reply #25 on: November 01, 2017, 11:25:41 am »
PFD is really sexy :D

karla

  • *****
  • 629
Re: New video gadget
« Reply #26 on: November 01, 2017, 01:32:18 pm »

filnet

  • *****
  • 113
Re: New video gadget
« Reply #27 on: November 02, 2017, 11:24:59 am »
One simple way to measure end to end latency is to:
- run GCS and display the video in PFD
- display on your PC screen a digital clock with milliseconds (for example: https://codepen.io/jasonleewilson/pen/gPrxwX)
- make sure that both the PFD and the clock are visible on your screen
- point your camera to film your PC screen to obtain a kaleidoscopic effect in the PFD and take a screen shot.
- the time difference between two consecutive frames of the kaleidoscope is your latency.

This will give you the end to end latency (but won't tell where this latency comes from).

An alternative way to measure latency is shown at the end of this video :
It is similar but requires a second camera.

Something else that can be done with the video gadget is to view the video stream *and* record it on disc.
Note that it is not (yet) possible to record the PFD overlay but only the raw video.
« Last Edit: November 02, 2017, 03:22:52 pm by filnet »

Re: New video gadget
« Reply #28 on: November 02, 2017, 11:56:03 am »
A very simple way to measure delay that nonetheless gives a good "feel" for the delay is to wave your hand up and down in front of the camera while you watch the video.  Change the frequency of your hand motion till you get it exactly out of phase ... hand going up while video shows hand going down ...

If you want a number, you can count the number of hand wave cycles (e.g. each time your hand goes down, don't count the ups) in a second, multiply by 2 to get the number of half cycles, and take the reciprocal "1 / halfcycles" to get your delay.

Full analog video hardware is so fast that this test seems instantaneous.
« Last Edit: November 02, 2017, 07:32:31 pm by TheOtherCliff »

karla

  • *****
  • 629
Re: New video gadget
« Reply #29 on: November 03, 2017, 12:39:56 pm »
Here is a picture and a short video of the latency.



Is it 0.2 or 0.13 seconds something?



Maybe a 'hand test' next time...
« Last Edit: November 03, 2017, 12:58:31 pm by karla »