gstreamer via dockerfile

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

gstreamer via dockerfile

Andrés Meseguer Valenzuela
Hi, I am trying to use gstreamer via docker.
My purpose is that my container installs GStreamer and then, it runs a  
gstreamer pipeline such as displaying
my webcam for example.

I have writen this dockerfile:

FROM ubuntu:20.10

RUN apt-get update && \
       apt-get -y install sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser  
docker sudo

CMD /bin/bash

RUN sudo -s apt-get update
RUN apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base  
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad  
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools  
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3  
gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y

ENTRYPOINT gst-launch-1.0 v4l2src device=/dev/video0 !  
'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert !  
ximagesink

USER docker

It builds, but once I run the image with flags (--net=host -e DISPLAY  
-v $HOME/.Xauthority:/root/.Xauthority )
it returns an error:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot  
identify device '/dev/video0'.

I know that this is a problem of my dockerfile because this GStreamer  
pipeline works in local.
Hence, I would like to know how to solve this.
Thanks for your valuable time.
Regards,
Andrés.




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer via dockerfile

Craig Carey
You need to mount your video device, something like:

docker run ... --privileged  -v /dev/video0:/dev/video0 ...


On Thu, Dec 3, 2020 at 10:20 AM Andrés Meseguer Valenzuela <[hidden email]> wrote:
Hi, I am trying to use gstreamer via docker.
My purpose is that my container installs GStreamer and then, it runs a 
gstreamer pipeline such as displaying
my webcam for example.

I have writen this dockerfile:

FROM ubuntu:20.10

RUN apt-get update && \
       apt-get -y install sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser 
docker sudo

CMD /bin/bash

RUN sudo -s apt-get update
RUN apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base 
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools 
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 
gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y

ENTRYPOINT gst-launch-1.0 v4l2src device=/dev/video0 ! 
'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! 
ximagesink

USER docker

It builds, but once I run the image with flags (--net=host -e DISPLAY 
-v $HOME/.Xauthority:/root/.Xauthority )
it returns an error:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot 
identify device '/dev/video0'.

I know that this is a problem of my dockerfile because this GStreamer 
pipeline works in local.
Hence, I would like to know how to solve this.
Thanks for your valuable time.
Regards,
Andrés.




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer via dockerfile

Tyler Compton
Another way to do this is using `--device /dev/video0`, which gives the container access to less of your host device than `--privileged`.

On Thu, Dec 3, 2020, 03:40 Craig Carey <[hidden email]> wrote:
You need to mount your video device, something like:

docker run ... --privileged  -v /dev/video0:/dev/video0 ...


On Thu, Dec 3, 2020 at 10:20 AM Andrés Meseguer Valenzuela <[hidden email]> wrote:
Hi, I am trying to use gstreamer via docker.
My purpose is that my container installs GStreamer and then, it runs a 
gstreamer pipeline such as displaying
my webcam for example.

I have writen this dockerfile:

FROM ubuntu:20.10

RUN apt-get update && \
       apt-get -y install sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser 
docker sudo

CMD /bin/bash

RUN sudo -s apt-get update
RUN apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base 
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools 
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 
gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y

ENTRYPOINT gst-launch-1.0 v4l2src device=/dev/video0 ! 
'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! 
ximagesink

USER docker

It builds, but once I run the image with flags (--net=host -e DISPLAY 
-v $HOME/.Xauthority:/root/.Xauthority )
it returns an error:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot 
identify device '/dev/video0'.

I know that this is a problem of my dockerfile because this GStreamer 
pipeline works in local.
Hence, I would like to know how to solve this.
Thanks for your valuable time.
Regards,
Andrés.




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gstreamer via dockerfile

Benedict Holland
Mounting dev points into docker containers is a very good idea. I solve a lot of problems doing that. 

On Fri, Dec 4, 2020, 9:15 PM Tyler Compton <[hidden email]> wrote:
Another way to do this is using `--device /dev/video0`, which gives the container access to less of your host device than `--privileged`.

On Thu, Dec 3, 2020, 03:40 Craig Carey <[hidden email]> wrote:
You need to mount your video device, something like:

docker run ... --privileged  -v /dev/video0:/dev/video0 ...


On Thu, Dec 3, 2020 at 10:20 AM Andrés Meseguer Valenzuela <[hidden email]> wrote:
Hi, I am trying to use gstreamer via docker.
My purpose is that my container installs GStreamer and then, it runs a 
gstreamer pipeline such as displaying
my webcam for example.

I have writen this dockerfile:

FROM ubuntu:20.10

RUN apt-get update && \
       apt-get -y install sudo

RUN useradd -m docker && echo "docker:docker" | chpasswd && adduser 
docker sudo

CMD /bin/bash

RUN sudo -s apt-get update
RUN apt-get install libgstreamer1.0-0 gstreamer1.0-plugins-base 
gstreamer1.0-plugins-good gstreamer1.0-plugins-bad 
gstreamer1.0-plugins-ugly gstreamer1.0-libav gstreamer1.0-tools 
gstreamer1.0-x gstreamer1.0-alsa gstreamer1.0-gl gstreamer1.0-gtk3 
gstreamer1.0-qt5 gstreamer1.0-pulseaudio -y

ENTRYPOINT gst-launch-1.0 v4l2src device=/dev/video0 ! 
'video/x-raw,width=640,height=480,framerate=30/1' ! videoconvert ! 
ximagesink

USER docker

It builds, but once I run the image with flags (--net=host -e DISPLAY 
-v $HOME/.Xauthority:/root/.Xauthority )
it returns an error:
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Cannot 
identify device '/dev/video0'.

I know that this is a problem of my dockerfile because this GStreamer 
pipeline works in local.
Hence, I would like to know how to solve this.
Thanks for your valuable time.
Regards,
Andrés.




_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel