×

INDI Library v1.9.7 Released (29 Jul 2022)

Bi-monthly INDI Library released with new drivers and bug fixes.

STK1160 USB capture as guiding cam | SOLVED

  • Posts: 314
  • Thank you received: 34
Hi there

Ive just tried to use my Watec camera as a guiding cam. Its a analog camera connected via composite cable to a stk1160 usb capture device (ID 05e1:0408). Both works so I can use vlc to see the video stream (vlc v4l2:///dev/video2 :v4l2-standard=PAL). But ekos doesnt seem to aquire correct images. What I did:
Start kstars
Select guider: V4L2 CCD
start indi
v4l2 options: set port to dev/video2
connect
log:
2014-07-23T05:42:15: Found intial Input "Composite0", Format "16 bpp YUY2, 4:2:2, packed", Size 720x480, Frame interval 1001/30000s 
2014-07-23T05:42:15: V4L2 CCD Device is online. Initializing properties.
then I select stream on and video stream window shows up with black. I also tried to change the inputs through composite0-4;svideo but nothing works
INDI 0.9.8
Kstars 2.2.0
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 8 years 2 months ago by pauledd.
8 years 2 months ago #1549

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
Hi ,

I think that 16bpp format YUY2 is not supported in V4L2, this is the reason why the image is black.
Could you try to change the capture pixel format if the driver allows it ?
We could use some library to decode all sort of pixel formats, I already had a look to some of them. But that would add other dependencies to Indi.
Regards,
Jean-Luc.
8 years 2 months ago #1551

Please Log in or Create an account to join the conversation.


What library are you proposing? We already added dependency for libjpeg, so if we can replace that with one that decodes all we can consider including it as a dependency. But in principle, the dependecies should remain as minimal as possible :-)
Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
8 years 2 months ago #1555

Please Log in or Create an account to join the conversation.

  • Posts: 314
  • Thank you received: 34
tried to get pixel format by
v4l2-ctl -d 2 --list-formats
ioctl: VIDIOC_ENUM_FMT
	Index       : 0
	Type        : Video Capture
	Pixel Format: 'UYVY'
	Name        : 16 bpp YUY2, 4:2:2, packed
and
v4l2-ctl -d 2 -V
Format Video Capture:
	Width/Height  : 720/480
	Pixel Format  : 'UYVY'
	Field         : Interlaced
	Bytes per Line: 1440
	Size Image    : 691200
	Colorspace    : Broadcast NTSC/PAL (SMPTE170M/ITU601)

tried to set pixel format to YUY2,YVYU,VYUV... with no success by
v4l2-ctl -d 2 -v pixelformat=YUY2 ... .... ... 

In EKOS under capture options/capture format I also cant select any other pixel format than 16bpp YUY2,4:2:2, packed, so it seems I cant change it :( damn
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 2 months ago #1560

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
I had a look to libyuv from google which has a quite complete set of decode stuff to I420 and argb format (look at convert_to_i420.c ). There is also libffmpeg but I did not look precisely, or some code from other projects as fswebcam .
We could also consider to use dynamic loading (with libdl) to test if a decoding library is present at run time, this could avoid to add direct dependencies to Indi.
The following user(s) said Thank You: Jasem Mutlaq
8 years 2 months ago #1561

Please Log in or Create an account to join the conversation.

  • Posts: 314
  • Thank you received: 34
Ok, so for now I wait for the possibility of implementation but if you dont plan to implement on what pixelformat I have to look for if I buy a new capture stick or to be precise what formats are definitely supported by ekos/indi? Because I just dont want to throw away my watec camera :)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 2 months ago #1566

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
Hi,
I had a look to gstreamer, it can be used to perform format conversion on the fly. And we could use some of its libraries to do so in indi_v4l2_ccd, but that's another point. For now I will use it to perform test implementation of decoding schemes (as I do not have a UYVY device for instance).
A solution for performing this format conversion is to create a V4L2 virtual device using v4l2loopback. I don't know which distribution you use, but on my Fedora 19, I have compiled the v4l2loopback module by hand.
1. install v4l2loopback device driver
mkdir -p /opt/v4l2loopback; cd /opt/v4l2loopback
git clone https://github.com/umlaeute/v4l2loopback.git
cd v4l2loopback/
make
# as root
make install
modprobe v4l2loopback video_nr=8 card_label="Indi Loopback"
# this will create /dev/video8, to do after each reboot 
I suppose you have installed gstreamer using your distribution package manager, I use here gstreamer-1.0 (not gstreamer-0.10). I suppose your camera/usb stick is in /dev/video0.
2. use gstreamer to perform pixel format conversion
# from mjpeg to UYVY for testing
gst-launch-1.0  -v v4l2src device=/dev/video0 ! jpegdec ! videoconvert ! video/x-raw,format=\(string\)UYVY ! v4l2sink device=/dev/video8
# in your case I would suggest
gst-launch-1.0  -v v4l2src device=/dev/video0 !  videoconvert ! video/x-raw,format=\(string\)I420 ! v4l2sink device=/dev/video8
Now you can run indi/kstars and select /dev/video8 as your device in indi_v4l2_ccd. You can also use another indi known formats in the conversion (for V4L2_PIX_FMT_RGB24, use video/x-raw,format=\(string\)RGB ).
Hope this could help you in waiting a future implementation.
The current supported format are V4L2_PIX_FMT_GREY, V4L2_PIX_FMT_YUV420, V4L2_PIX_FMT_YUYV, V4L2_PIX_FMT_RGB24, V4L2_PIX_FMT_SBGGR8, V4L2_PIX_FMT_SRGGB8, V4L2_PIX_FMT_JPEG, V4L2_PIX_FMT_MJPEG.
8 years 2 months ago #1569

Please Log in or Create an account to join the conversation.

  • Posts: 314
  • Thank you received: 34
I cant see geehalel's last post in the forum but received it via mail. I had v4l2loopback & gstreamer in my mind too but I had no clue how to configure it for format conversion. Thank you for you nice little procedure. I will go through it later today :)

EDIT now I can see your post...
--= human, without Windows™ =--
pls excuse my bad english! :)
Last edit: 8 years 2 months ago by pauledd.
8 years 2 months ago #1571

Please Log in or Create an account to join the conversation.

  • Posts: 314
  • Thank you received: 34
ok, I can pronounce success! But it was necessary to expand your gstreamer command to this one:

(my video-grabber source is at "/dev/video3")
gst-launch-1.0 v4l2src device=/dev/video3 ! video/x-raw,format=UYVY,framerate=25/1, width=720, height=576 ! deinterlace ! videoconvert ! video/x-raw,format=\(string\)I420 ! v4l2sink device=/dev/video8

without defining framerate and deinterlace gstreamer will not stream. I just want to add that just watching the established stream in ekos drives my processor up to 40% usage (i7-3537U) so this would not be very usefull on battery if you are outside. But I think that can be optimized somehow by reducing image size or video format. Thanx again geehalel for this guide. Now I can dig deeper into Ekos B)
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 2 months ago #1573

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
I've added support for UYVY to indi_v4l2_ccd so now you could use it directly. Only tested through gstreamer conversion.
Processor usage is quite high but this is video stuff going through v4l2 indi driver->indi server->kstars client. I've made some profiling last year and saw that the conversion into a BLOB (i.e. xml data using base64 encoding/decoding) was very time consuming. You're right that the best way to reduce it is to crop the image.
8 years 2 months ago #1574

Please Log in or Create an account to join the conversation.

  • Posts: 314
  • Thank you received: 34
Thats great and I will test that. Do I have to rebuild only indilib or also kstars? I am on gentoo and used its internal packet manager which doesnt offer latest development snapshot of indilib. Where can I get your latest code? SVN?GIT?
--= human, without Windows™ =--
pls excuse my bad english! :)
8 years 2 months ago #1575

Please Log in or Create an account to join the conversation.

  • Posts: 226
  • Thank you received: 88
It's on svn, look in the "Develop" tab up there, in "code repository", you just have to copy/paste the svn checkout command . Be sure to suppress the libindi version installed by the gentoo packet-manager. I also hand-compiled kstars from their git repo, there is a good tutorial on how to install it in a private directory . I don't know if this is mandatory to rebuild kstars, this may depend on changes made in libindi.
8 years 2 months ago #1576

Please Log in or Create an account to join the conversation.

Time to create page: 0.695 seconds