WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: webcam extension  (Read 6791 times)

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: webcam extension
« Reply #15 on: August 05, 2020, 01:44:28 PM »
It's been a couple of months, but as I recall:
Code: [Select]
$ tce-load -i Xorg flwm aterm wbar gtk3 libv4l2
$ startx
$ ffmpeg -f v4l2 -video_size 640x480 -framerate 5 -i /dev/video0

Offline ashfame

  • Full Member
  • ***
  • Posts: 112
Re: webcam extension
« Reply #16 on: August 05, 2020, 02:56:47 PM »
Really interested to know more on gtk3 window, how does that work? I am trying to see if how you are doing it, can replace my need of the browser? I essentially need to run a kiosk (full screen launched automatically) for personal use of whoever is using my project to build their air-gapped crypto vault.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: webcam extension
« Reply #17 on: August 06, 2020, 02:13:11 AM »
I'm not sure what you are asking - does it work for you (and if not, what error messages do you get)?

Offline ashfame

  • Full Member
  • ***
  • Posts: 112
Re: webcam extension
« Reply #18 on: August 06, 2020, 05:47:24 AM »
Well, I am interested to know how you show the video stream in that gtk3 window.

ffmpeg lets you source the video stream from /dev/video0 but where does it stream to or make it available? How does gtk3 window, I am assuming <video> shows that stream?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: webcam extension
« Reply #19 on: August 06, 2020, 06:22:38 AM »
I don't recall having to do anything other than issuing the ffmpeg command given earlier, which opened a window to display the video locally.

Offline ashfame

  • Full Member
  • ***
  • Posts: 112
Re: webcam extension
« Reply #20 on: August 06, 2020, 08:16:53 AM »
Gotcha! I couldn't imagine ffmpeg will invoke gtk3 window on its own to show the preview. I will give that a try. BTW, do you have any resources on using gtk3 window directly to render html files outside of a browser? I am trying to run the UI like a kiosk in my use-case & wondering if I can use a lightweight alternative than a full browser.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14799
Re: webcam extension
« Reply #21 on: August 06, 2020, 08:28:35 AM »
I made a mistake with the command before, it should have been
Code: [Select]
$ ffplay -f v4l2 -video_size 640x480 -framerate 5 -i /dev/video0
There was a long thread where a user was trying to stream with ffmpeg, but I recall they gave up and used rpi-vc in the end.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11044
Re: webcam extension
« Reply #22 on: August 06, 2020, 12:36:45 PM »
Using webkit or blink (chrome) directly, instead of via a browser, will not help you much. Same deps, almost the same RAM usage, etc etc. The difference is you don't have menus, bookmarks, and other browser things outside the page.

You can probably build a native app instead of a web page, but it all depends on what you're doing. You've only mentioned you want to show webcam video. A native program is hugely more efficient than a web page in a browser (/engine), no matter what tech you use.
The only barriers that can stop you are the ones you create yourself.

Offline ashfame

  • Full Member
  • ***
  • Posts: 112
Re: webcam extension
« Reply #23 on: August 06, 2020, 02:51:02 PM »
Yeah! I understand native will be much better but web based UI gives me a lot of control over the UX & enables me to do more.

Regarding camera feed, eating up all my memory, its caused by the JS library I use (surprisingly doesn't happen on my desktop), but from my testing I found that if left alone for some time, all that memory is freed by GC so for now, I did a band-aid solution of only showing the webcam for 10secs before it turns the feed off.

I might switch the detection of QR in webcam feed to backend and free that from browser if more problems happen, but I really wanna ship the first iteration of the project (9 days left in 2 months of work)  ::)

I keep on exploring other options as firefox has not been playing nice to me in launching as kiosk mode, in hopes that a particular solution might kill two birds with one stone but that's probably best for a new topic.