Giter Club home page Giter Club logo

camset's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

camset's Issues

context-aware encoding

Hi, thanks for the release. I'm currently working on context-aware video encoding which aims at setting different QPs for different area within frame to be encoded according to grayscale saliency map where white areas indicate ROI areas. Now I'm struggling at how to implement context-aware encoding in V4L2. Any advices would be very appritiated.

Exposure (Absolute) slide bar: just display 0-20% range

Love the GUI, just a tweak/enhancement request: could we have the exposure (Absolute) slide bar be confined to values between 0 and 20%? I just need to tweak it throughout the day between 3 and 8%, but can't get fine grained control with the current 0 to 100% scale. Maybe there could be an additional option if folks really need more than 20% exposure. Thanks!

Camera feed problem - no fourcc code

The issue

I'm using a Logitech C920. After running camset, or when trying to view the video feed, I get this error:

Traceback (most recent call last):
  File "/home/me/build/camset/env/lib/python3.6/site-packages/camset/camset.py", line 231, in on_output_combo_changed
    list = get_video_resolution()
  File "/home/me/build/camset/env/lib/python3.6/site-packages/camset/camset.py", line 70, in get_video_resolution
    fourcode = cv2.VideoWriter_fourcc('{}'.format(pixelformat))
TypeError: Required argument 'c2' (pos 2) not found

The cause

When camset tries to get the resolution (the first step in displaying the feed), it doesn't get a fourcc code.

camset/camset/camset.py

Lines 62 to 71 in ac8140a

def get_video_resolution():
index = win.res_combobox.get_active()
model = win.res_combobox.get_model()
text = model[index]
res = text[0].split(" ")[-1]
pixelformat = text[0].split(" - ", 1)[0]
vfeedwidth = res.split("x", 1)[0]
vfeedheight = res.split("x", 1)[1]
fourcode = cv2.VideoWriter_fourcc(*'{}'.format(pixelformat))
return [pixelformat, vfeedwidth, vfeedheight, fourcode]

After getting the model:
pixelformat = ''
(an empty string) because:
text[0].split(" - ", 1) = ['', '1920x1080']

The "fix"

Manually set the fourcode to:
fourcode = cv2.VideoWriter_fourcc('M','J','P','G')

Handle video access error cleanly

Use-case

  • Have an application that's using the video open (e.g. Zoom)
  • Open camset
  • Not have the logs be full of:
VIDIOC_S_FMT: failed: Device or resource busy
Traceback (most recent call last):
  File "/home/me/build/camset/env/lib/python3.6/site-packages/camset/camset.py", line 232, in on_output_combo_changed
    start_camera_feed(list[0], list[1], list[2], list[3])
  File "/home/me/build/camset/env/lib/python3.6/site-packages/camset/camset.py", line 30, in start_camera_feed
    subprocess.run(['v4l2-ctl', '-d', card, '-v', 'height={0},width={1},pixelformat={2}'.format(vfeedheight, vfeedwidth, pixelformat)], check=True, universal_newlines=True)
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['v4l2-ctl', '-d', '/dev/video0', '-v', 'height=1080,width=1920,pixelformat=']' returned non-zero exit status 255.

Fix

Simply adding a try/except around:

subprocess.run(['v4l2-ctl', '-d', card, '-v', 'height={0},width={1},pixelformat={2}'.format(vfeedheight, vfeedwidth, pixelformat)], check=True, text=True)

For example:

try:
    subprocess.run(['v4l2-ctl', '-d', card, '-v', 'height={0},width={1},pixelformat={2}'.format(vfeedheight, vfeedwidth, pixelformat)], check=True, universal_newlines=True)
except subprocess.CalledProcessError:
    print("It's okay!")

results in:

VIDIOC_S_FMT: failed: Device or resource busy
It's okay!

Going forward

Maybe it could check to see if an error occurs, and if it does, not open the video feed.
Also, might be worth considering not opening up the video feed by default on open?

Windows doesnt crop

Hey there, the camset Windows doesnt fit on a vertical screen, or better said doesnt crop at all...

camset or Camtest?

What's the name of this application? 😜

camset-name

Guessing Camtest was a placeholder name when you started developing this?

camset/camset/camset.py

Lines 218 to 222 in 022cc73

win.set_title(title="Camtest - {}".format(cardname))
camwin.set_title(title="Camera feed - {}".format(cardname))
else:
win.set_title(title="Camtest")
camwin.set_title(title="Camera feed")

Stuck at installing build dependencies

Hello!

So, after many researching I came up to camset that will solve my problems for sure. But as the title says, it is getting stuck at "Installing building dependencies"

I have to tell you also that I am try to install on a Raspberry Pi 3b+. Maybe that is the reason?

Is there any other way? I think the problem is with opencv, but I already have a version installed. Can I ignore on the installation?

Sorry if I asked something stupid, I'm unexperienced on this.

wrong camset.desktop

Starting camset via program's menu in linux fails.
This is due to: camset is installed in /home/[[myuser]]/.local/bin/camset. But the program starting file "camset.desktop" has in line 4 something like
Exec=/usr/bin/camset

Changing that line 4 to
Exec=.local/bin/camset
helps.

Add flag to start camset with camera feed off by default

I use camset to change values of my camera during running video conferences, like changing white balance to manual, etc.

However, when I open camset (and change to my camera) I get an error because the device is already in use since a video stream is running:
Screenshot from 2020-11-24 16-00-06
If I confirm the dialog, I am able to change the values as needed, adjusting my currently running feed.

It would be great to have a way to start camset with the video streams off by default, like --no-camera-feed-by-default or something, so that I don't have to confirm the dialog all the time.
Or, even better, it would be nice if camset would just show a passive warning, without me needing to confirm that.

Installation error

Thanks a lot for camset - I could successfully install it on a debian and really like it.
When trying to install it on a ubuntu machine, I got this:

~$ pip3 install camset
Traceback (most recent call last):
File "/usr/bin/pip3", line 11, in
sys.exit(main())
File "/home/sina/.local/lib/python3.5/site-packages/pip/init.py", line 12, in main
from pip._internal.utils.entrypoints import _wrapper
File "/home/sina/.local/lib/python3.5/site-packages/pip/_internal/utils/entrypoints.py", line 4, in
from pip._internal.cli.main import main
File "/home/sina/.local/lib/python3.5/site-packages/pip/_internal/cli/main.py", line 58
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
~$

(I did "pip3 install --upgrade setuptools pip" before, as I needed to do so for my installation on debian)

Settings not stored permanently

Configuration is not stored permanently so whenever I have to use the camera I need to open camset and change options.

Could you change Camset so settings are stored forever? Maybe adding a "Store permanently" button.

Steps to reproduce:

  1. Open Camset
  2. Change settings
  3. Close Camset
  4. Unplug camera (or power off in case of built-in webcam)
  5. Plug camera (or power on)
  6. Open Camset

Settings went to default :'(


Thanks for the app!

camset is not responding and unable to interact with the GUI

I'm using Ubuntu 23.04, and I have a laptop webacm, Droidcam, and a USB webcam (which is the one I want to configure). When I run camset I'm unable to use the GUI. This is the output of the command:

Unable to detect what device /dev/media1 is, exiting.
Unable to detect what device /dev/media0 is, exiting.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.
[ WARN:[email protected]] global cap_v4l.cpp:1119 tryIoctl VIDEOIO(V4L2:/dev/video0): select() timeout.

Feature Requests: (a) human-readable device names in "Device" dropdown and (b) remove metadata "devices"

This sure would make it easier to choose the right camera. v4l2 gives this info, and it's shown in camset's title bar after one selects the camera. Yes it will take up more UI space but it would be quite worth it in the time saved -- right now I typically just go through all the devices in the drop-down, hunting for the one I'm using. It would also be super useful if you could filter out, or at least label, the metadata virtual devices, which are not meaningful to use in camset. Thanks for making a free and useful thing!

Install fails on pycairo dependancy

Attempted install fails with either pip or pipx to install on Ubuntu 20.04. I'm using pyenv to manage my user python.

Note: I understand this is an issue with pycairo and not camset however it would benefit users of camset to figure this out and add a workaround or fix to the readme. I've spent a small amount of time attempting to debug the issue (installing dependencies and other ideas I found via Googling). Ended up just using v4l2-ctl to solve my immedate need but I'd much rather use Camset in the future.

Expected:

pip(x) install camset to successfully install application.

Experienced:

  • pipx
kwhatcher@kwhatcher-Precision-7710:~$ pipx install camset
  ERROR: Command errored out with exit status 1:
   command: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-_q6emlf5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (38 lines):
  Collecting setuptools
    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting pycairo
    Using cached pycairo-1.20.0.tar.gz (344 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (PEP 517): started
    Building wheel for pycairo (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpvwcx2zh3
         cwd: /tmp/pip-install-v_y642_k/pycairo
    Complete output (15 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/kwhatcher/.local/pipx/venvs/camset/bin/python /home/kwhatcher/.local/pipx/shared/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-_q6emlf5/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

Error installing camset.
  • pip
kwhatcher@kwhatcher-Precision-7710:~$ pip install camset
Collecting camset
  Using cached camset-0.0.11-py3-none-any.whl (66 kB)
Collecting opencv-python
  Using cached opencv_python-4.4.0.46-cp38-cp38-manylinux2014_x86_64.whl (49.5 MB)
Collecting PyGObject
  Using cached PyGObject-3.38.0.tar.gz (712 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p9_85o11/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
       cwd: None
  Complete output (38 lines):
  Collecting setuptools
    Using cached setuptools-50.3.2-py3-none-any.whl (785 kB)
  Collecting wheel
    Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
  Collecting pycairo
    Using cached pycairo-1.20.0.tar.gz (344 kB)
    Installing build dependencies: started
    Installing build dependencies: finished with status 'done'
    Getting requirements to build wheel: started
    Getting requirements to build wheel: finished with status 'done'
      Preparing wheel metadata: started
      Preparing wheel metadata: finished with status 'done'
  Building wheels for collected packages: pycairo
    Building wheel for pycairo (PEP 517): started
    Building wheel for pycairo (PEP 517): finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpz99nsbo4
         cwd: /tmp/pip-install-xgfrb23z/pycairo
    Complete output (15 lines):
    running bdist_wheel
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.8
    creating build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
    copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
    running build_ext
    Package cairo was not found in the pkg-config search path.
    Perhaps you should add the directory containing `cairo.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'cairo' found
    Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
    ----------------------------------------
    ERROR: Failed building wheel for pycairo
  Failed to build pycairo
  ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
  ----------------------------------------
ERROR: Command errored out with exit status 1: /home/kwhatcher/.pyenv/versions/3.8.3/bin/python3 /home/kwhatcher/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-p9_85o11/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.

H264 video output is corrupted

My camera (Insta360 Link) only supports up to 1080p with MJPG, but it supports 4K (3840x2160) with H264. If I select H264, regardless of resolution, the camera feed is corrupted. It shows noise / colorful dots at the top, and a frozen image from the camera underneath it:

image

Unexpected keyword argument in subprocess.run()

The issue

I just installed camset and received version 0.0.3, ̶n̶o̶t̶ ̶s̶u̶r̶e̶ ̶w̶h̶y̶ ̶I̶ ̶d̶i̶d̶n̶'̶t̶ ̶g̶e̶t̶ ̶0̶.̶0̶.̶5̶** but that's irrelevant as this would still effect the latest version. After running, I got this error:

Traceback (most recent call last):
  File "/home/me/.local/bin/camset", line 11, in <module>
    sys.exit(main())
  File "/home/me/.local/lib/python3.6/site-packages/camset/camset.py", line 228, in main
    check_devices()
  File "/home/me/.local/lib/python3.6/site-packages/camset/camset.py", line 197, in check_devices
    devices = subprocess.run(['v4l2-ctl', '--list-devices'], check=True, text=True, stdout=subprocess.PIPE)
  File "/usr/lib/python3.6/subprocess.py", line 423, in run
    with Popen(*popenargs, **kwargs) as process:
TypeError: __init__() got an unexpected keyword argument 'text'

The cause

The reason for the error was because I was running Python 3.6.9 (so close!) and according to the subprocess docs:

Changed in version 3.7: Added the text parameter, as a more understandable alias of universal_newlines. Added the capture_output parameter.

The fix

Either upgrading to Python 3.7+ or doing a find-and-replace on camset.py and changing text=True to universal_newlines=True

Going forward

It's stated in the package that it requires Python >=3.7 so I guess this isn't really a bug, but a small change* to using universal_newlines would allow a load of other people to use this software without running into this.

* I can't believe I'm suggesting this by the way! I'm usually the one shouting "out with the old, in with the new"

** Before 935e750 (version 0.0.4) any Python 3 version was "supported" so I was given the latest version that Pip reckoned I could use

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.