karla

  • *****
  • 629
Re: New video gadget
« Reply #45 on: November 12, 2017, 02:55:05 am »
Ah, I just had to start the GCS, run as administrator, then it did write the file :)
Movie captured just fine.
So, ready for the PFD Video gadget capture to file?


filnet

  • *****
  • 113
Re: New video gadget
« Reply #46 on: November 12, 2017, 01:24:16 pm »
Yes it exists. I also first tried with just capture.mpg, its a bit embarrassing but I am not sure where the Librepilot directory is located, so I searched both c and d drive for the file, but no match. Done this several times after restarting etc etc.
Can there be any other cause, like my win 10 machine is missing the sw that creates the .mpg file?

Are you building LP yourself (I assumed you did because of the D:\msys64 in your recording location) ?

If you start LP using a shortcut then you can right click on it to go to the location of the executable.

Strange that you need to be admin though...

Anyways on to recording + PFD.

filnet

  • *****
  • 113
Re: New video gadget
« Reply #47 on: November 12, 2017, 01:38:34 pm »
To record video and display it on the PFD we will add a third branch to the previous pipeline.

Code: [Select]
ksvideosrc device-index=0 ! decodebin ! tee name=t
    t. ! queue ! intervideosink
    t. ! queue ! autovideosink
    t. ! queue ! x264enc tune=zerolatency bitrate=498 ! mpegpsmux ! filesink location=capture.mpg

The new branch uses an intervideosink element that makes it possible to connect multiple pipelines together (but only within the same process).

And we will adapt the PFD pipeline to consume from the intervideosink.

Code: [Select]
intervideosrc ! timeoverlay halignment=left valignment=bottom shaded-background=true font-desc="Sans, 36" ! videoconvert ! video/x-raw,format=RGB ! appsink name=sink emit-signals=true

Note that I added the timeoverlay element so you can measure latency again to check if the new pipelines don't have an adverse effect on latency.

PS : I am aware that all this is a bit crude and not user friendly :)
Ideally all this should be hidden behind a user friendly interface where you just have to select a file to save to...
But having the raw power of GStreamer in your hands lets you do a lot of stuff...
« Last Edit: November 12, 2017, 01:54:46 pm by filnet »

karla

  • *****
  • 629
Re: New video gadget
« Reply #48 on: November 13, 2017, 01:42:55 pm »
Yes, I proudly build my own LibrePilot executable :)
Found the location of the runtime installed LP here: C:\Program Files\LibrePilot

Many things are strange filnet, like the hat of the pope :) I accept the looks of the hat and the fact I need to run LP GCS as Admin, no problems as long as it works.

So these are the settings in the Gadget video pipeline I put in:



This is the great result!!!! It works.



And this is the video capture.mpg

https://forum.librepilot.org/index.php?action=dlattach;topic=3649.0;attach=6872

I am not sure about the latency,
maybe you have an idea?
« Last Edit: November 13, 2017, 01:52:30 pm by karla »

filnet

  • *****
  • 113
Re: New video gadget
« Reply #49 on: November 13, 2017, 02:19:16 pm »
You got it a bit wrong. Or I did not explain it well enough. Or both ;)

Some vocabulary, so we speak the same language:
- Video gadget is the the "standalone" video gadget (not PFD).
- PFD or PFD gadget is, well, the PFD...
- There is no "PFD Video gadget"  (but PFD has a configuration where it can display video).

From my last post, you need to put the 1st pipeline (with 3 branches) in a Video gadget and the second one in the PFD gadget.

With that setup:
- the Video gadget pipeline will display, record and push video to the intervideosink.
- the PFD pipeline will consume from the intervideosrc and display the video.

The intervideosink / intervideosrc will talk to each other behind the scene.

From the screenshot the latency looks worse : 907 - 674 = 233ms.

Can you try again with the alternative setup described here ?
« Last Edit: November 13, 2017, 02:23:50 pm by filnet »

karla

  • *****
  • 629
Re: New video gadget
« Reply #50 on: November 14, 2017, 01:53:34 am »
Lets see if I got it right this time
It feels a bit counter intuitive but seems to work.

This is the Video setting:



This is the PFD setting:



This is the resulting Video screen:



This is the resulting PFD screen:



and lastly this is the capture clip:

https://forum.librepilot.org/index.php?action=dlattach;topic=3649.0;attach=6881

This is better since you can control when to save to disk and when to stop saving with the control buttons in the Video gadget.
« Last Edit: November 14, 2017, 02:02:35 am by karla »

Re: New video gadget
« Reply #51 on: November 14, 2017, 03:45:37 am »
To play without using sudo / admin you probably just need to belong to the correct group.

After plugging your video device in, do (lower case L):
  ls -lrt /dev
and look in the last few lines.

Or if you know the device name just do:
   ls -l /dev/yourdevicename

and see what group it belongs to.  From my system...
$ ls -l /dev/video0
crw-rw----+  1 root video    81,   0 Nov 13 21:35 video0

'root video' see here that root is the owner and video is the group.

If I just become a member of the video group I might not need to sudo / admin.  Is it 'video' group for you too?

It's also possible that an executable (player / pipeline) you are using changes it's effective user or group (SUID / SGID) as it runs...

filnet

  • *****
  • 113
Re: New video gadget
« Reply #52 on: November 14, 2017, 09:25:46 am »
It feels a bit counter intuitive but seems to work.

My inner geek likes it.

This is better since you can control when to save to disk and when to stop saving with the control buttons in the Video gadget.

Yes, and it also shows one way to overcome the limitation that only one source can access the web cam.
There is still only one active ksvideosrc but the pipeline that has it can dispatch the video further to other pipelines.

The latency is still bad : 602 - 369 = 233 ms

karla

  • *****
  • 629
Re: New video gadget
« Reply #53 on: November 14, 2017, 11:35:54 am »
should just say its fantastic to have this working :)
... so saving to disk will increase latency.
How about capturing or relaying sound to GCS?

filnet

  • *****
  • 113
Re: New video gadget
« Reply #54 on: November 14, 2017, 12:05:58 pm »
... so saving to disk will increase latency.

I don't know where the latency comes from. There are probably multiple causes.
Will need to look into it.

How about capturing or relaying sound to GCS?

Can your video capture hw relay sound ? Do you get sound using the application that came with it ?

karla

  • *****
  • 629
Re: New video gadget
« Reply #55 on: November 14, 2017, 12:53:09 pm »
Haha I just assumed it could record sound but it can not - so its a bit much to ask that the gcs should get any sound :)
Anyway, if another camera can send sound, in that case, would the Gadget be able to pick it up?
Best
K

karla

  • *****
  • 629
Re: New video gadget
« Reply #56 on: November 14, 2017, 12:54:37 pm »
@cliff
Thanks!
Will look in to it tomorrow
K

Re: New video gadget
« Reply #57 on: November 14, 2017, 07:12:53 pm »
Usually CCD cameras don't have microphones.  Some RunCam brand cameras (e.g. Owl 2 adds night vision) have microphones, but they are USD $44 shipped.
https://www.ebay.com/itm/RunCam-OWL2-Camera-Orange-Power-5-36V-FOV-150/362112037161

Some less expensive CMOS cameras have microphones because CMOS is a simple circuit and there is room on the circuit board?

Most video transmitters have a microphone input and if your camera is deaf mute, you just buy a cheap (USD $1.09 shipped) surveillance microphone like this (I have some of this model, but can't promise I have used this exact one):
https://www.ebay.com/itm/1Pcs-Mic-Microphone-Sound-Monitor-Voice-Audio-Cable-Tiny-For-Security-Camera-DVR/332137471873

Some video transmitters even have built in microphones (USD $14 shipped).
https://www.banggood.com/Eachine-TX801-5_8G-72CH-0_01MW5MW25MW50MW100MW200MW400MW600MW-Switched-AV-VTX-FPV-Transmitter-p-1147691.html

karla

  • *****
  • 629
Re: New video gadget
« Reply #58 on: November 15, 2017, 03:55:37 am »
Thanks Cliff.
Well my camera and tx do transmit both video and sound, hover the USB video receiver on the ground station is not capable to receive sound. As far as I understand.
This one: https://www.banggood.com/Eachine-ROTG01-UVC-OTG-5_8G-150CH-Full-Channel-FPV-Receiver-For-Android-Mobile-Phone-Smartphone-p-1147692.html?rmmds=search

For example if I use the Camera app that ships with MS 10, to display the video, then it is silent, however when choosing the built in camera on the PC it has sound (used for skype etc).

karla

  • *****
  • 629
Re: New video gadget
« Reply #59 on: November 16, 2017, 12:07:35 am »
If I just become a member of the video group I might not need to sudo / admin.  Is it 'video' group for you too?

No, not sure. cant find any name indicated its the video.
But no problem really, I just put it in the LibrePilot shortcut to run as admin.

ABC@DESKTOP-CDUNNSL MSYS ~
$ ls -lrt /dev
total 4
crw-rw-rw- 1 ABC None  13, 254 Dec  1  2006 clipboard
drwxr-xr-x 1 ABC None        0 Oct 28 06:12 shm
drwxr-xr-x 1 ABC None        0 Oct 28 06:12 mqueue
lrwxrwxrwx 1 ABC None       15 Oct 28 06:12 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 ABC None       15 Oct 28 06:12 stdout -> /proc/self/fd/1
lrwxrwxrwx 1 ABC None       15 Oct 28 06:12 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 ABC None       13 Oct 28 06:12 fd -> /proc/self/fd
crw-rw-rw- 1 ABC None   1,   5 Nov 15 23:03 zero
crw-rw-rw- 1 ABC None  13, 255 Nov 15 23:03 windows
crw-rw-rw- 1 ABC None   1,   9 Nov 15 23:03 urandom
crw-rw-rw- 1 ABC None 117,   5 Nov 15 23:03 ttyS5
crw-rw-rw- 1 ABC None 117,  12 Nov 15 23:03 ttyS12
crw-rw-rw- 1 ABC None 117,  11 Nov 15 23:03 ttyS11
crw-rw-rw- 1 ABC None   5,   0 Nov 15 23:03 tty
crw-rw-rw- 1 ABC None   1,   8 Nov 15 23:03 random
crw--w---- 1 ABC None 136,   0 Nov 15 23:03 pty0
crw-rw-rw- 1 ABC None   5,   2 Nov 15 23:03 ptmx
crw-rw-rw- 1 ABC None   1,   3 Nov 15 23:03 null
crw-rw-rw- 1 ABC None   1,   7 Nov 15 23:03 full
crw-rw-rw- 1 ABC None  14,   3 Nov 15 23:03 dsp
crw-rw-rw- 1 ABC None   5,   1 Nov 15 23:03 console
crw-rw-rw- 1 ABC None   5, 254 Nov 15 23:03 conout
crw-rw-rw- 1 ABC None   5, 255 Nov 15 23:03 conin
crw------- 1 ABC None   1,  11 Nov 15 23:03 kmsg
brw-rw-rw- 2 ABC None  11,   0 Nov 15 23:03 scd0
brw-rw-rw- 2 ABC None  11,   0 Nov 15 23:03 sr0
brw-rw-rw- 1 ABC None   8,   0 Nov 15 23:03 sda
brw-rw-rw- 1 ABC None   8,   1 Nov 15 23:03 sda1
brw-rw-rw- 1 ABC None   8,   2 Nov 15 23:03 sda2
brw-rw-rw- 1 ABC None   8,   3 Nov 15 23:03 sda3
brw-rw-rw- 1 ABC None   8,   4 Nov 15 23:03 sda4
brw-rw-rw- 1 ABC None   8,   5 Nov 15 23:03 sda5