Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gstreamer-video cannot access camera #39

Open
J4nsen opened this issue Feb 27, 2021 · 23 comments
Open

gstreamer-video cannot access camera #39

J4nsen opened this issue Feb 27, 2021 · 23 comments

Comments

@J4nsen
Copy link

J4nsen commented Feb 27, 2021

Hi,
first of all, thanks for this great project.
I'm following the docker installation guide and I have problems starting the gstreamer container. It seems to have problems accessing the camera:

gstreamer-video_1 | Setting pipeline to NULL ...
gstreamer-video_1 | Freeing pipeline ...
gstreamer-video_1 | Setting pipeline to PAUSED ...
gstreamer-video_1 | mmal: mmal_vc_shm_init: could not initialize vc shared memory service
gstreamer-video_1 | mmal: mmal_vc_component_create: failed to initialise shm for 'vc.ril.camera' (7:EIO)
gstreamer-video_1 | mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (7)
gstreamer-video_1 | ERROR: Pipeline doesn't want to pause.
gstreamer-video_1 | ERROR: from element /GstPipeline:pipeline0/GstRpiCamSrc:src: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
gstreamer-video_1 | Additional debug info:
gstreamer-video_1 | gstbasesrc.c(3452): gst_base_src_start (): /GstPipeline:pipeline0/GstRpiCamSrc:src:
gstreamer-video_1 | Failed to start

I've verified that the camera works on the host, i.e., I can take pictures with raspistill as the pi user.

Any ideas how to proceed? Could this be a problem of outdated gstreamer build in the container and the host system/kernel?
I'm on kernel 5.10.17-v7+.

Thanks, Jan

@HaraldRuppert
Copy link

Hi,
I'm facing the same here. Latest Debian Buster on an RPi3B. Camera works.
Does anyone have any idea?

Thanks

@J4nsen
Copy link
Author

J4nsen commented Mar 4, 2021

Hi, I sorta worked around this by running the gstreamer-video part on the host.

  • Installing and building the gstreamer plugin: https://ivadim.github.io/2017-08-21-fruitnanny/#4-audio-and-video-pipeline-setup
  • Running it: gst-launch-1.0 -v rpicamsrc name=src preview=0 exposure-mode=night fullscreen=0 bitrate=1000000 annotation-mode=time+date annotation-text-size=20 ! video/x-h264,width=960,height=540,framerate=12/1,profile=constrained-baseline ! queue max-size-bytes=0 max-size-buffers=0 ! h264parse ! rtph264pay config-interval=1 pt=96 ! queue ! udpsink host=127.0.0.1 port=5004 sync=false
  • Disabling gstreamer-video in the docker-compose.yaml: Commenting out L17-29

However, I faced the next major blocker. nginx reports lots of 502 Errors (Bad Gateway), which results in a broken webpage. With some luck it loads and works.

@c0llys
Copy link

c0llys commented Mar 5, 2021

Hi, just wanted to let you know that I am having the same issues. No video, no telemetry from the sensor and the web page is broken.

@bureus
Copy link

bureus commented Mar 6, 2021

Me 2

@ruaanmaraisklem
Copy link

ruaanmaraisklem commented Mar 23, 2021

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer

If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

@dtpetersen
Copy link

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer

If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

@ruaanmaraisklem
Copy link

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer
If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

I basically just rebuilt the Docker container by using the Dockerfile provided in /opt/fruitnanny/docker/gstreamer. I then pushed this container up to my own docker hub profile and now I use this newly created container to pull down in the Dockerfile in /opt/fruitnanny.

So in the Dockerfile in /opt/fruitnanny everywhere where the file references ivadim/fruitnanny-gstreamer I've replaced this with klemmie117/fruitnanny-gstreamer-fix, so if you'd like you are welcome to do the same and pull the image that I built to solve this issue

@ndallarmellinatxt
Copy link

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer
If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

I basically just rebuilt the Docker container by using the Dockerfile provided in /opt/fruitnanny/docker/gstreamer. I then pushed this container up to my own docker hub profile and now I use this newly created container to pull down in the Dockerfile in /opt/fruitnanny.

So in the Dockerfile in /opt/fruitnanny everywhere where the file references ivadim/fruitnanny-gstreamer I've replaced this with klemmie117/fruitnanny-gstreamer-fix, so if you'd like you are welcome to do the same and pull the image that I built to solve this issue

thanks, I just followed what you indicated and the webcam has started working again!

@J4nsen
Copy link
Author

J4nsen commented Mar 31, 2021

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer

If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

Nice!

However, I faced the next major blocker. nginx reports lots of 502 Errors (Bad Gateway), which results in a broken webpage. With some luck it loads and works.

I digged a little deeper. The Nginx container seems to have a little to none timeout for the response. I tried to fix this in its container, but was not successful. Ultimately I just installed nginx on the host and used the configs from the repo, which is working fine.

Additionally, the app-container is missing the gpio program to toggle the infra-red leds. I was able to fix this by installing the wiringpi in the app-container and committing the changes to the image.

@KoJaCx
Copy link

KoJaCx commented Apr 3, 2021

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer
If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

I basically just rebuilt the Docker container by using the Dockerfile provided in /opt/fruitnanny/docker/gstreamer. I then pushed this container up to my own docker hub profile and now I use this newly created container to pull down in the Dockerfile in /opt/fruitnanny.

So in the Dockerfile in /opt/fruitnanny everywhere where the file references ivadim/fruitnanny-gstreamer I've replaced this with klemmie117/fruitnanny-gstreamer-fix, so if you'd like you are welcome to do the same and pull the image that I built to solve this issue

Hi I have the same problem, i find the "Docker file" in /opt/fruitnanny/docker/gstreamer folder but after I'm totally lost what I'm supposed to do ? Could you explain step by step ? Thanks a lot.

@ruaanmaraisklem
Copy link

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer
If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

I basically just rebuilt the Docker container by using the Dockerfile provided in /opt/fruitnanny/docker/gstreamer. I then pushed this container up to my own docker hub profile and now I use this newly created container to pull down in the Dockerfile in /opt/fruitnanny.
So in the Dockerfile in /opt/fruitnanny everywhere where the file references ivadim/fruitnanny-gstreamer I've replaced this with klemmie117/fruitnanny-gstreamer-fix, so if you'd like you are welcome to do the same and pull the image that I built to solve this issue

Hi I have the same problem, i find the "Docker file" in /opt/fruitnanny/docker/gstreamer folder but after I'm totally lost what I'm supposed to do ? Could you explain step by step ? Thanks a lot.

@KoJaCx So what you're going to want to do is:

  1. In /opt/fruitnanny/docker/gstreamer type docker build Dockerfile
  2. Then run docker images to see what new image has been created
  3. Then in /opt/fruitnanny docker-compose.yml change the image for gstreamer-video to the new image you created in step 1, the name is the one you found in step 2
  4. Then rerun the docker-compose.yml to redeploy the fruitnanny application
  5. Profit...

Well theoretically that should be fine, alternatively if you don't want to build the image yourself you could just use klemmie117/fruitnanny-gstreamer-fix in step 3 as the image name.

Let me know if you're still having trouble and I can try and assist

@KoJaCx
Copy link

KoJaCx commented Apr 6, 2021

Thanks for your reply but when i used "docker build Dockerfile" after a few minutes i have this message

Step 4/5 : COPY docker/gstreamer/audio_entry.sh /
COPY failed: file not found in build context or excluded by .dockerignore: stat docker/gstreamer/audio_entry.sh: file does not exist

and after when i used "docker images" i saw

REPOSITORY                    TAG       IMAGE ID       CREATED          SIZE
<none>                        <none>    da4312697e3f   53 seconds ago   553MB

so i think the command was not finished correclty any idea ?

@ruaanmaraisklem
Copy link

Thanks for your reply but when i used "docker build Dockerfile" after a few minutes i have this message

Step 4/5 : COPY docker/gstreamer/audio_entry.sh /
COPY failed: file not found in build context or excluded by .dockerignore: stat docker/gstreamer/audio_entry.sh: file does not exist

and after when i used "docker images" i saw

REPOSITORY                    TAG       IMAGE ID       CREATED          SIZE
<none>                        <none>    da4312697e3f   53 seconds ago   553MB

so i think the command was not finished correclty any idea ?

You are correct, it did not finish. It's trying to copy the file audio_entry.sh to the docker image but can't find it. Are you sure you're in the /opt/fruitanny/docker/gstreamer directory when running docker build Dockerfile cause the audio_entry.sh and audio_stream.sh (it'll complain about this one too if it can't find it) are both in this directory. I had a similar problem and then just cd'd to the correct directory and everything went well after that

@KoJaCx
Copy link

KoJaCx commented Apr 7, 2021

maybe the problem is the command i used to build the Dockerfile because

cd /opt/fruitnanny/docker/gstreamer 
docker build Dockerfile         
unable to prepare context: context must be a directory: /opt/fruitnanny/docker/gstreamer/Dockerfile

so i used this command :
docker build /opt/fruitnanny/docker/gstreamer

and it's works but i have always this error

Step 4/5 : COPY docker/gstreamer/audio_entry.sh / COPY failed: file not found in build context or excluded by .dockerignore: stat docker/gstreamer/audio_entry.sh: file does not exist

@ruaanmaraisklem
Copy link

ruaanmaraisklem commented Apr 7, 2021

maybe the problem is the command i used to build the Dockerfile because

cd /opt/fruitnanny/docker/gstreamer 
docker build Dockerfile         
unable to prepare context: context must be a directory: /opt/fruitnanny/docker/gstreamer/Dockerfile

so i used this command :
docker build /opt/fruitnanny/docker/gstreamer

and it's works but i have always this error

Step 4/5 : COPY docker/gstreamer/audio_entry.sh / COPY failed: file not found in build context or excluded by .dockerignore: stat docker/gstreamer/audio_entry.sh: file does not exist

So what you do is cd /opt/fruitnanny/docker/gstreamer then just run docker build . the . here tells docker that the Dockerfile is in the current directory so it knows to run it and then it'll try to copy the files from the current directory, I just tried it again and it should work on your side as well.

Alternatively you can edit the Dockerfile using sudo nano /opt/fruitnanny/docker/gstreamer/Dockerfile and change line 6 & 7 from copy audio_entry.sh / and copy audio_stream.sh / to copy /opt/fruitnanny/docker/gstreamer/audio_entry.sh / and copy /opt/fruitnanny/docker/gstreamer/audio_stream.sh /.

Then if none of these 2 options work you can just pull the container that I created instead of the original container, this change would be in /opt/fruitnanny docker-compose.yml I'm not sure on which lines but just change the ivadim/fruitnanny-gstreamer container to klemmie117/fruitnanny-gstreamer-fix then you can rerun the installation as described in the project's Github page

@KoJaCx
Copy link

KoJaCx commented Apr 8, 2021

pfiou it's working with your last option, i edit the "docker-compose.yml" and replace the line for gstreamer-video. Thank you so much for your help !

@bureus
Copy link

bureus commented Apr 18, 2021

Awesome work! I got it to run as well so thanks alot @ruaanmaraisklem. But I have multiple issues with the site now, seems to be related to nginx, get random 504 on scripts and css. Do you guys see similar behavior? It works after a couple of refreshes. But cant understand why nginx is behaving like it does.

@ndallarmellinatxt
Copy link

Awesome work! I got it to run as well so thanks alot @ruaanmaraisklem. But I have multiple issues with the site now, seems to be related to nginx, get random 504 on scripts and css. Do you guys see similar behavior? It works after a couple of refreshes. But cant understand why nginx is behaving like it does.

I'm in the same situation as you

@J4nsen
Copy link
Author

J4nsen commented Apr 30, 2021

However, I faced the next major blocker. nginx reports lots of 502 Errors (Bad Gateway), which results in a broken webpage. With some luck it loads and works.

I digged a little deeper. The Nginx container seems to have a little to none timeout for the response. I tried to fix this in its container, but was not successful. Ultimately I just installed nginx on the host and used the configs from the repo, which is working fine.

This is my workaround, which i posted some weeks ago

@ndallarmellinatxt
Copy link

However, I faced the next major blocker. nginx reports lots of 502 Errors (Bad Gateway), which results in a broken webpage. With some luck it loads and works.

I digged a little deeper. The Nginx container seems to have a little to none timeout for the response. I tried to fix this in its container, but was not successful. Ultimately I just installed nginx on the host and used the configs from the repo, which is working fine.

This is my workaround, which i posted some weeks ago

i didn't see your solution, i also tried to install nginx locally and everything works again, thanks

@nine86
Copy link

nine86 commented May 6, 2021

I tried some of the solutions offered here. At first I was able to stream the video but when I tried it again it stops loading. Feeling really frustrated right now. Super appreciate any help available!
Untitled

I'm not using a DHT sensor but I have a mic plugged into my pi3 (but even the audio is not working).

@nine86
Copy link

nine86 commented May 6, 2021

I tried some of the solutions offered here. At first I was able to stream the video but when I tried it again it stops loading. Feeling really frustrated right now. Super appreciate any help available!
Untitled

I'm not using a DHT sensor but I have a mic plugged into my pi3 (but even the audio is not working).

As soon as I finished posting this it occurred to me that whenever the HDMI was unplugged the video would stream fine. Now to figure out the audio issue.

@egoitz89
Copy link

egoitz89 commented Aug 8, 2021

@ruaanmaraisklem, I've been hitting a wall on this issue so some further explanation your solution for the docker container would be greatly appreciated!

I managed to fix this issue by rebuilding the Docker container with the provided Dockerfile in /opt/fruitnanny/docker/gstreamer
If anyone wants to they can change the docker-compose.yml file in /opt/fruitnanny to pull my docker image instead of the ivadim one as I'm assuming ivadim has stopped maintaining this project. If anyone is interested just drop me a message here and I can explain my solution more thoroughly

I basically just rebuilt the Docker container by using the Dockerfile provided in /opt/fruitnanny/docker/gstreamer. I then pushed this container up to my own docker hub profile and now I use this newly created container to pull down in the Dockerfile in /opt/fruitnanny.

So in the Dockerfile in /opt/fruitnanny everywhere where the file references ivadim/fruitnanny-gstreamer I've replaced this with klemmie117/fruitnanny-gstreamer-fix, so if you'd like you are welcome to do the same and pull the image that I built to solve this issue

Hello,

I am also having some troubles to put my camera working. I tried to rebuild gstreamer module with klemmie117/fruitnanny-gstreamer-fix but did not archive it. This is what I did:
sudo nano /opt/fruitnanny docker-compose.yml
Edit line 19 ->
# image: ivadim/fruitnanny-gstreamer
image: klemmie117/fruitnanny-gstreamer-fix
Rerun:
docker-compose up -d

Do I have to make something more to fix it?

Thanks!

p.d update: after several tries, now the camera works, but not properly. I can see the image about 5 seconds, and it keeps shutdown another 15 seconds. And starts the cycle again. So, I understand that it is restarting continuously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants