soyersoyer / fmp4streamer

Fmp4streamer streams your V4L2 camera directly to any browser and media player as MP4 (H264).
Apache License 2.0
80 stars 7 forks source link

Error #5

Closed Vinsub closed 2 years ago

Vinsub commented 2 years ago

I am so sorry, i have an error running the fmp4streamer.py.

Waiting for the first h264 frame...Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/home/pi/Desktop/touchUI/fmp4streamer/v4l2camera.py", line 274, in run self.start_capturing() File "/home/pi/Desktop/touchUI/fmp4streamer/v4l2camera.py", line 243, in start_capturing ioctl(self.fd, v4l2.VIDIOC_STREAMON, struct.pack('I', v4l2.V4L2_BUF_TYPE_VIDEO_CAPTURE)) OSError: [Errno 22] Invalid argument

soyersoyer commented 2 years ago

What type of camera do you have? What is your config? OS? If it's an usb camera, try to unplug/replug. For the VIDIOC_STREAMON, the documentation says: EINVAL The buffer type is not supported, or no buffers have been allocated (memory mapping) or enqueued (output) yet. Try it with capture_memory = MMAP configuration value.

soyersoyer commented 2 years ago

I added some checks to spot some kind of buffer configuration errors.

Vinsub commented 2 years ago

Sorry for delay, i have e raspberry 4, camera 2.1, Raspbian. Traceback (most recent call last): File "fmp4streamer.py", line 264, in camera = V4L2Camera(device, h264parser, config) File "/home/pi/Desktop/touchUI/fmp4streamer/fmp4streamer-3.4.1/v4l2camera.py", line 40, in init self.init_device(width, height, capture_format_real) File "/home/pi/Desktop/touchUI/fmp4streamer/fmp4streamer-3.4.1/v4l2camera.py", line 123, in init_device ioctl(self.fd, v4l2.VIDIOC_S_FMT, fmt) OSError: [Errno 16] Device or resource busy Now i have this error. Thanks a lot

soyersoyer commented 2 years ago

Something is using your camera.

Vinsub commented 2 years ago

I dont now, but if i try with another software the camera works

soyersoyer commented 2 years ago

Please close the other camera software, only one process can use it.

Vinsub commented 2 years ago

i close all software and i reboot system, how can i check if there is a service that uses camera?

soyersoyer commented 2 years ago

$ lsof /dev/video0 $ systemctl --user status $ systemctl status

Vinsub commented 2 years ago

Ok, i undestand, i'm a idiot. I made the service of fmp4stream... Now, 2 questions:

  1. How can remove this service from start?
  2. I stop the service, now the error is: ERROR:root:/dev/video0: the capture memory should be MMAP on the last element in the chain Thanks!!!
Vinsub commented 2 years ago

Ok, it works, thank you so match!!! How can remove this service from start?

soyersoyer commented 2 years ago

$ systemctl --user disable fmp4streamer

Vinsub commented 2 years ago

Thanks!!!

soyersoyer commented 2 years ago

You're welcome!