Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. [HowTo] Anleitung: Einbindung IP-Kamera(s)

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    [HowTo] Anleitung: Einbindung IP-Kamera(s)

    This topic has been deleted. Only users with topic management privileges can see it.
    • fu_zhou
      fu_zhou last edited by

      ****11.07.2017

      Achtung: bei mir funktioniert v4l2loopback nicht mehr, seitdem ich auf Jessie 4.9 upgegradet habe. Damit wird /dev/video0 nicht mehr erzeugt und gstreamer liefer kein Bild mehr an motion. Ich bin noch auf der Suche, im Moment bin ich auf rtsp mit ffmpeg umgestiegen, was aber eine höhere CPU Last zur Folge hat. Das Installieren der Kernel-Headers ging unter 4.9 wesentlich schneller, als bei der vorherigen Version. Ob es daran liegt?

      Es wäre Klasse, wenn jemand helfen kann, den v4l2loopback unter Jessie 4.9 wieder ans laufen zu kriegen…****

      Hallo zusammen,

      hier mein Tutorial zum Einbinden von IP-Kameras im ioBroker. Man muss hier "nur" den Link zum rtsp-Stream der Kamera kennen, den liefert eigentlich auch das billigste fern-Ost-Gerät als h.264. Bilder mit Telegram versenden geht nun auch ohne, dass die Kamera einen CGI-Befehl für Snapshots versteht.

      Ich habe mich für ein Multihost-System mit 2 x Raspberry Pi 3 entschieden, weil die Dekodierung des Streams und die Bewegungserkennung einiges an CPU-Leistung braucht. Gestartet habe ich aber mit einem Raspi, auf dem ioBroker und motion parallel lief - das geht auch.

      Auf beiden Raspis läuft Jessie und ioBroker, der Raspi, der die IP-Kameras handelt, ist das untergeordnete System. ioBroker habe ich jeweils auf ein USB-Speichermedium umgezogen, hier werden auch die Bilder und Filme abgelegt.

      Das eigentliche "Gehirn" hinter der Lösung ist "ruhigundrelaxed" hier aus dem Forum. Von ihm stammt der Adapter und alle notwendigen Informationen, so dass es funktioniert. Ich habe ca. 10 Tage gebraucht, bis alles geklappt hat, mit der Anleitung unten sollte man in 2 Stunden durch sein. Die Installationsgeschwindigkeit hängt wesentlich von der Qualität und Geschwindigkeit der verwendeten SD-Karte ab.

      Die Lösung verwendet motion, gstreamer und v4l2loopback. Damit wird die Rechenleistung der GPU genutzt, um den Stream zu dekodieren und die CPU brennt nicht gleich durch 😉

      Sämtliche Config-Files sind mit hier im Beitrag enthalten.

      Offene Punkte:

      • Autostart von gstreamer.service funktioniert nicht (timeout oder so ähnlich), der Service muss nach dem Booten per Hand gestartet werden. Vielleicht kann sich das jemand mal anschauen?

      • Es ist im Moment nur eine Kamera in motion eingebunden. Mehrere Kameras benötigen jeweils ein Config-File. Das könnte sich dann auch jemand mal anschauen?

      Wir fangen mit der Installation von motion an (auf dem Raspi, der die IP Kameras verwalten soll, wenn nur ein Raspi im Einsatz ist, natürlich auf dem):

      sudo bash
      
      apt-get install autoconf automake build-essential git libtool libjpeg8-dev libzip-dev libavformat-dev libavcodec-dev libavutil-dev libav-tools libswscale-dev libavdevice-dev -y
      
      cd /
      
      git clone https://github.com/Motion-Project/motion.git
      

      bei Fehlermelung “Problem with the SSL CA cert (path? access rights?)”

      sudo apt-get install --reinstall ca-certificates
      

      und dann noch einmal

      git clone https://github.com/Motion-Project/motion.git
      
      cd motion
      
      autoreconf -fiv
      
      ./configure
      
      make
      
      make install && ldconfig
      

      Jetzt den motion-Service einrichten, so dass motion beim Reboot automatisch gestartet wird:

      Installationsort finden, die Ausgabe wird bei ExecStart= von motion.service (s.u.) eingetragen

      which motion
      
      sudo nano /etc/systemd/system/motion.service
      

      Inhalt:

      [Unit]
      Description=Motion Daemon
      
      [Service]
      Type=forking
      PIDFile=/var/run/motion/motion.pid
      ExecStart=/usr/local/bin/motion -c /usr/local/etc/motion/motion.conf
      Restart=on-failure
      Requires=gstreamer.service
      [Install]
      RequiredBy=gstreamer.service
      

      Service dem Autostart hinzufügen

      sudo systemctl enable motion.service
      

      Konfiguration von motion:

      sudo bash
      
      cp /usr/local/etc/motion/motion-dist.conf /usr/local/etc/motion/motion.conf
      
      nano /usr/local/etc/motion/motion.conf
      

      Hier unterscheide ich jetzt in 3 Teile, die aber nicht hintereinander in der motion.conf, sondern "durcheinander" stehen. ACHTUNG: es sind nur die Einträge aufgeführt, die angepasst werden müssen oder (optional) durch mich angepasst wurden. D.h. ein Zusammenkopieren der 3 Abschnitte führt nicht zu einer kompletten motion.conf. Die komplette motion.conf ist im Anhang.

      1. Grundsätzliche Konfiguration, folgende Einträge überprüfen/ bearbeiten, Kommentare auf deutsch in () natürlich nicht mit übernehmen, aber berücksichtigen:

      # Start in daemon (background) mode and release terminal (default: off)
      daemon on
      
      # File to store the process ID, also called pid file. (default: not defined)
      process_id_file /var/run/motion/motion.pid
      
      # Use a file to save logs messages, if not defined stderr and syslog is used. (default: not defined)
      logfile /usbstick/IPCam/motion.log (an das System anpassen)
      
      # Videodevice to be used for capturing  (default /dev/video0)
      # for FreeBSD default is /dev/bktr0
      videodevice /dev/video0 
      
      # Target base directory for pictures and films
      # Recommended to use absolute path. (Default: current working directory)
      target_dir /usbstick/IPCam (an das System anpassen)
      
      # The mini-http server listens to this port for requests (default: 0 = disabled)
      stream_port 8181 (darf nicht mit ioBroker kollidieren, wenn auf dem selben Pi)
      
      # Restrict stream connections to localhost only (default: on)
      stream_localhost off
      
      # TCP/IP port for the http server to listen on (default: 0 = disabled)
      webcontrol_port 8182 (darf nicht mit iobroker kollidieren, wenn auf dem selben Pi)
      
      # Restrict control connections to localhost only (default: on)
      webcontrol_localhost off
      
      # Output for http server, select off to choose raw text plain (default: on)
      webcontrol_html_output off
      

      2. Optionale Konfiguration: Die Werte passen für den Standort meiner Kamera, die Empfindlichkeit der Kamera etc. ganz gut, es gibt kaum Fehlauslösungen. Video-Aufzeichnung ist ausgeschaltet, es werden nur Bilder gemacht. Pfadangaben müssen natürlich wieder an das entsprechende System angepasst werden. Es lohnt sich auf jeden Fall, die motion.conf mal durchzuarbeiten, um sie an seine Bedürfnisse anzupassen.

      # Maximum number of frames to be captured per second.
      # Valid range: 2-100\. Default: 100 (almost no limit).
      framerate 5
      
      # Threshold for number of changed pixels in an image that
      # triggers motion detection (default: 1500)
      threshold 1500
      
      # Automatically tune the noise threshold (default: on)
      noise_tune off
      
      # Ignore sudden massive light intensity changes given as a percentage of the picture
      # area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled
      lightswitch 3
      
      # Picture frames must contain motion at least the specified number of frames
      # in a row before they are detected as true motion. At the default of 1, all
      # motion is detected. Valid range: 1 to thousands, recommended 1-5
      minimum_motion_frames 2
      
      # Specifies the number of pre-captured (buffered) pictures from before motion
      # was detected that will be output at motion detection.
      # Recommended range: 0 to 5 (default: 0)
      # Do not use large values! Large values will cause Motion to skip video frames $
      # cause unsmooth movies. To smooth movies use larger values of post_capture ins$
      pre_capture 1
      
      # Number of frames to capture after motion is no longer detected (default: 0)
      post_capture 1
      
      # Event Gap is the seconds of no motion detection that triggers the end of an event.
      # An event is defined as a series of motion images taken within a short timeframe.
      # Recommended value is 60 seconds (Default). The value -1 is allowed and disables
      # events causing all Motion to be written to one single movie file and no pre_capture.
      # If set to 0, motion is running in gapless mode. Movies don't have gaps anymore. An
      # event ends right after no more motion is detected and post_capture is over.
      event_gap 1
      
      # Maximum length in seconds of a movie
      # When value is exceeded a new movie file is created. (Default: 0 = infinite)
      max_movie_time 30
      
      # Output 'normal' pictures when motion is detected (default: on)
      # Valid values: on, off, first, best, center
      # When set to 'first', only the first picture of an event is saved.
      # Picture with most motion of an event is saved when set to 'best'.
      # Picture with motion nearest center of picture is saved when set to 'center'.
      # Can be used as preview shot for the corresponding movie.
      output_pictures center
      
      # The quality (in percent) to be used by the jpeg and webp compression (default: 75)
      quality 90
      
      # Use ffmpeg to encode movies in realtime (default: off)
      ffmpeg_output_movies off
      
      # Locate and draw a box around the moving object.
      # Valid values: on, off, preview (default: off)
      # Set to 'preview' will only draw a box in preview_shot pictures.
      locate_motion_mode on
      
      # Set the look and style of the locate box if enabled.
      # Valid values: box, redbox, cross, redcross (default: box)
      # Set to 'box' will draw the traditional box.
      # Set to 'redbox' will draw a red box.
      # Set to 'cross' will draw a little cross to mark center.
      # Set to 'redcross' will draw a little red cross to mark center.
      locate_motion_style redbox
      
      # Draw the number of changed pixed on the images (default: off)
      # Will normally be set to off except when you setup and adjust the motion settings
      # Text is placed in upper right corner
      text_changes on
      
      # Draw characters at twice normal size on images. (default: off)
      text_double on
      
      # Target base directory for pictures and films
      # Recommended to use absolute path. (Default: current working directory)
      target_dir /usbstick/ipcam
      
      # File path for snapshots (jpeg, ppm or webp) relative to target_dir
      # Default: %v-%Y%m%d%H%M%S-snapshot
      # Default value is equivalent to legacy oldlayout option
      # For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-snapshot
      # File extension .jpg, .ppm or .webp is automatically added so do not include this.
      # Note: A symbolic link called lastsnap.jpg created in the target_dir will always
      # point to the latest snapshot, unless snapshot_filename is exactly 'lastsnap'
      snapshot_filename %v-%q_%Y-%m-%d%_H%-M-%S-snapshot
      
      # File path for motion triggered images (jpeg, ppm or .webp) relative to target_dir
      # Default: %v-%Y%m%d%H%M%S-%q
      # Default value is equivalent to legacy oldlayout option
      # For Motion 3.0 compatible mode choose: %Y/%m/%d/%H/%M/%S-%q
      # File extension .jpg, .ppm or .webp is automatically added so do not include this
      # Set to 'preview' together with best-preview feature enables special naming
      # convention for preview shots. See motion guide for details
      picture_filename %v-%q_%Y-%m-%d_%H-%M-%S
      
      # File path for motion triggered ffmpeg films (movies) relative to target_dir
      # Default: %v-%Y%m%d%H%M%S
      # File extensions(.mpg .avi) are automatically added so do not include them
      movie_filename %v_%Y-%m-%d_%H-%M-%S
      
      # Quality of the jpeg (in percent) images produced (default: 50)
      stream_quality 90
      
      # Output frames at 1 fps when no motion is detected and increase to the
      # rate given by stream_maxrate when motion is detected (default: off)
      stream_motion on
      
      # Maximum framerate for streams (default: 1)
      stream_maxrate 10
      

      3. Konfiguration für den ioBroker-motion-Adapter. Auch hier sind die Pfadangaben entsprechend an das System anzupassen.

      # Command to be executed when an event starts. (default: none)
      # An event starts at first motion detected after a period of no motion defined by event_gap
      on_event_start /usbstick/motion/events.sh on_event_start %t %s %N
      
      # Command to be executed when an event ends after a period of no motion
      # (default: none). The period of no motion is defined by option event_gap.
      on_event_end /usbstick/motion/events.sh on_event_end %t %s %N
      
      # Command to be executed when a picture (.ppm|.jpg|.webp) is saved (default: none)
      # To give the filename as an argument to a command append it with %f
      on_picture_save /usbstick/motion/events.sh on_picture_save %t %s %N %f
      
      # Command to be executed when a motion frame is detected (default: none)
      on_motion_detected value /usbstick/motion/events.sh on_motion_detected %t %s %N
      
      # Command to be executed when motion in a predefined area is detected
      # Check option 'area_detect'. (default: none)
      on_area_detected /usbstick/motion/events.sh on_area_detected %t %s %N
      
      # Command to be executed when a movie file (.mpg|.avi) is created. (default: none)
      # To give the filename as an argument to a command append it with %f
      on_movie_start /usbstick/motion/events.sh on_movie_start %t %s %N %f
      
      # Command to be executed when a movie file (.mpg|.avi) is closed. (default: none)
      # To give the filename as an argument to a command append it with %f
      on_movie_end /usbstick/motion/events.sh on_movie_end %t %s %N %f
      
      # Command to be executed when a camera can't be opened or if it is lost
      # NOTE: There is situations when motion don't detect a lost camera!
      # It depends on the driver, some drivers dosn't detect a lost camera at all
      # Some hangs the motion thread. Some even hangs the PC! (default: none)
      on_camera_lost /usbstick/motion/events.sh on_camera_lost %t %s %N
      

      Bei Änderungen in der motion.conf, muss motion.service neu gestartet werden, um die Änderungen zu übernehmen:

      sudo systemctl restart motion.service
      

      evtl. muss auch gstreamer neu gestartet werden (s. nächster Abschnitt):

      sudo systemctl restart gstreamer.service
      

      Jetzt gstreamer installieren. gstreamer selbst ist wohl bei Jessie dabei, daher nur noch die notwendigen Pakete holen:

      sudo bash
      
      apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins gstreamer1.0-omx
      

      gstreamer konfigurieren

      rtsp-Link der Kamera herausfinden, z.B. durch Kamera-Dokumentation, iSpy, Internet-Recherche etc. Der wird dann in der gstreamer.service bei location= eingetragen (s.u. - zwischen … rtspsrc und ! rtph264depay ... - bei mir rtsp://192.168.0.8/Streaming/Channels/101, ich habe noch eine IP-Kamera, da ist es lediglich rtsp://192.168.0.9).

      sudo nano /etc/systemd/system/gstreamer.service
      

      Inhalt:

      [Unit]
      Description=Launch and monitor Gstreamer Pipeline
      
      [Service]
      ExecStart=/usr/bin/gst-launch-1.0 rtspsrc location=rtsp://192.168.0.8/Streaming/Channels/101 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! tee ! v4l2sink device=/dev/video0
      Restart=always
      [Install]
      WantedBy=multi-user.target
      

      Service dem Autostart zufügen:

      sudo systemctl enable gstreamer.service
      

      Das ist der Problemfall, der beim Booten nicht starten möchte.

      mit````
      sudo systemctl status gstreamer.service

      findet man den Grund, warum er nicht startet
      
      mit````
      sudo systemctl restart gstreamer.service
      

      kriegt man es dann händisch hin.

      v4l2loopback installieren

      sudo bash
      
      apt-get install raspberrypi-kernel-headers
      
      cd /
      
      git clone https://github.com/umlaeute/v4l2loopback
      
      cd v4l2loopback
      
      make && sudo make install
      

      v4l2loopback dem Autostart zufügen

      sudo bash
      
      nano /etc/modules-load.d/modules.conf
      
      

      Am Ende ergänzen:

      v4l2loopback
      

      Soweit ist jetzt also der Pi vorbereitet. Nach einem Reboot und Starten vom gstreamer.service solltet ihr mit "IP-Adresse:8181" z.B. http://192.168.0.51:8181 nun ein Live Bild mit 1 Frame pro Sekunde bekommen, solange keine Bewegung erkannt wird. Bei Bewegung geht die Frame-Rate hoch, wie in der motion.conf definiert.

      Jetzt zum ioBroker:

      motion-Adapter installieren von Github

      https://github.com/ruhigundrelaxed/ioBroker.motion
      

      Instanz erzeugen, bei Multihost-System auf dem Pi, auf dem motion, gstreamer, v4l2loopback läuft.

      Instanz konfigurieren:

      Motion HTTP-Server Adresse: http://127.0.0.1

      Motion HTTP-Server Port: 8182 wie in der motion.conf angegeben

      Motion event Port: 8183 wie in der events.sh angegeben

      events.sh anlegen (Pfadangabe an System anpassen):

      sudo nano /usbstick/motion/events.sh
      

      Inhalt:

      #!/bin/bash
      case $1 in
         "on_area_detected" )
              json_answer="{\"event\": \"on_area_detected\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4}"
              ;;
         "on_camera_lost" )
              json_answer="{\"event\": \"on_camera_lost\", \"thread\": $2, \"timestamp\": \"$3\"}"
              ;;
         "on_event_start" )
              json_answer="{\"event\": \"on_event_start\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4}"
              ;;
         "on_event_end" )
              json_answer="{\"event\": \"on_event_end\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4}"
              ;;
         "on_motion_detected" )
             json_answer="{\"event\": \"on_motion_detected\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4}"
              ;;
         "on_movie_start" )
             json_answer="{\"event\": \"on_movie_start\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4, \"filename\": \"$5\"}"
              ;;
         "on_movie_end" )
             json_answer="{\"event\": \"on_movie_end\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4, \"filename\": \"$5\"}"
              ;;
         "on_picture_save" )
              json_answer="{\"event\": \"on_picture_save\", \"thread\": $2, \"timestamp\": \"$3\", \"noiselevel\": $4, \"filename\": \"$5\"}"
              ;;
          *)
             json_answer=$1
      
      esac
      
      echo $json_answer |netcat 127.0.0.1 8183
      

      Die 8183 am Ende der letzten Zeile ist der Event-Port aus dem Konfigurations-Dialog des Adapters.

      events.sh ausführbar machen (ohne hat es bei mir nicht funktioniert):

      chmod +x /usbstick/motion/events.sh
      

      Damit sollte ioBroker bei Bewegung unter Objekte - motion.0 - thread0 - events - event "true" bekommen, solange das event andauert. Dieses "True" kann man jetzt natürlich auch als Bewegungsmelder verwenden, um z.B. Licht zu schalten. In der motion.conf habe ich die event-Dauer auf eine Sekunde gesetzt, somit kommt für meine Anforderungen eine vernünftige Anzahl Bilder raus. Unter lastpicture findet man den Name des Bildes, das an der Stelle abgelegt ist, wie in der motion.conf definiert (bei mir /usbstick/ipcam). Dieses letzte Bild können wir uns nun per Telegram schicken lassen. Dazu muss Telegram in einem Multihost-System eine Instanz auf dem Pi mit dem motion-Adapter bekommen, ist nur ein Pi in Gebrauch, geht es genauso.

      Das Skript siehst dann wie folgt aus (Pfadangaben und Instanz ggf. anpassen):

      on("motion.0.thread0.events.lastpicture", function(obj)
      {
      sendTo('telegram.1', "/usbstick/ipcam/" + getState("motion.0.thread0.events.lastpicture").val);
      });
      

      Im vis könnt ihr euch das Live-Bild mit dem dem basic -Image Widget anzeigen lassen, Quelle ist "IP-Adresse:8181", z.B. http://192.168.0.51:8181/

      Das war es soweit… Alle Files findet ihr auch im Anhang.

      Hier ein schöner Schnappschuss als Beispiel:
      356_87-03_2017-05-28_08-45-49.jpg

      1 Reply Last reply Reply Quote 0
      • G
        gst666 last edited by

        Danke für Dein Tutorial. Vielleicht kannst Du die Überschrift noch abändern (lassen). Es geht ja nicht um die eigentliche Einbindung der IP-Kamera, sondern an eine Bewegtbilderekennung.

        Vorschlag: Bewegtbilderekennung mittels IP-Kamera auf RASPI

        1 Reply Last reply Reply Quote 0
        • ruhigundrelaxed
          ruhigundrelaxed last edited by

          Wow! Fettes kudos für diese Anleitung.

          Das ist beeindruckend umfänglich.

          Folgende Anmerkungen:

          1.) Dem Beitrags von gst666 möchte ich zustimmen. Die Überschrifft könnte schon geändert werden. Denn deine Anleitung funktioniert, wenn auch in leicht geänderter/ gekürzter variante auch mit usb cams und mmal (rpi cam). Fast alles was Bilder liefert…

          2.)Ich dachte, dass das gstreamer.service autostart Problem gelöst ist. Hatte das dann nicht weiter verfolgt. Sry. Da diese Unit bei mir läuft gehe ich nicht von einem generellen Problem aus. Kannst du mir nochmal mailen, was "systemctl status gstreamer.service" direkt nach dem booten sagt? Ausserdem schicke mal eine Liste der laufenden tasks. In etwa: ps aux > tasks.txt. Evt. müssen wir da mal bei den systemd Jungs anklopfen.

          3.)Allgemein eine bzw. mehrere Cams in motion einzubinden ist kein größeres Problem. Der config file von motion wird gesplittet. D.h. die allgemeinen Parameter bleiben in: motion.conf und die Kamera spezifischen wandern in einen jeweils pro Kamera separaten File. Die motion dokumentation klappert das ganz gut ab. Früher wurden diese einzelenen files noch in der motion.conf eingetragen, aktuell werden sie aus einem ordner gelesen. (z.B. /etc/motion/conf.d/)

          Alles kein Hexenwerk. ABER: Ob der rpi das kann ist fraglich. Keine Ahnung ob der h264 block der gpu paralleles decoding kann. Falls ja, muss sinngemäß ein weiteres loopbackdevice erzeugt werden. (man kann dem loopback modul beim laden mitgeben, wieviele devices es erzeugen soll) und eine weitere gstreamer pipeline aufgesetzt werden.

          4.)

          Man kann natürlich drei mal eine Schublade aufmachen und jeweils ein Paket reinlegen:
          > apt-get install -y gstreamer1.0-tools && apt-get install -y gstreamer1.0-plugins && apt-get install -y gstreamer1.0-omx
          oder

          man macht einmal die Schublade auf und legt 3 Pakete rein.

          apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins gstreamer1.0-omx
          

          Sollte schneller sein und ist einfacher zu lesen.

          Oder machst du das absichtlich so.

          Ansonsten richtig coole Anleitung. Danke dafür…

          Ein paar Worte zum Adapter:

          Veröffentlichen via npm:

          Wenn sich, sagen wir mal, 2 weitere Benutzer gefunden haben. Und wenn auch deren Installation stabil läuft. Dann würde ich mich mal trauen diesen Adapter irgendwie zu veröffentlichen.

          Pläne / Brainstorming:

          Ich denke darüber nach, folgende Schritte zu automatisieren:

          1.) > events.sh anlegen (Pfadangabe an System anpassen)
          2.) Die Adapterspezifischen motion Konfigurationen. (Also z.B. die "on" events) automatisch vom Adapter durchführen zu lassen.

          (Das was du als: Konfiguration für den ioBroker-motion-Adapter. bezeichnet hast.)

          3.) Feel free to add your wishes.

          Saluti da colonia

          1 Reply Last reply Reply Quote 0
          • fu_zhou
            fu_zhou last edited by

            > apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins gstreamer1.0-omx
            habe ich übernommen

            > 1.) Dem Beitrags von gst666 möchte ich zustimmen. Die Überschrifft könnte schon geändert werden. Denn deine Anleitung funktioniert, wenn auch in leicht geänderter/ gekürzter variante auch mit usb cams und mmal (rpi cam). Fast alles was Bilder liefert…
            habe mich hierzu an den Admin gewandt

            1 Reply Last reply Reply Quote 0
            • ruhigundrelaxed
              ruhigundrelaxed last edited by

              Cool.

              Hier noch mal ein paar infos für mutige die das mal mit 2 Cams ausprobieren wollen:

              modprobe v4l2loopback devices=2
              
              /usr/bin/gst-launch-1.0 rtspsrc location=rtsp://**IPCAM1**/Streaming/Channels/101 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! tee ! v4l2sink device=/dev/video0
              
              /usr/bin/gst-launch-1.0 rtspsrc location=rtsp://**IPCAM2**/Streaming/Channels/101 ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! tee ! v4l2sink device=/dev/video1
              

              Die o.g. Zeilen richten nur das GPU decoding ein. Zum testen….

              Meine Vermutung ist: omxh264dec funktioniert nur mit einem stream....

              Komplett ungetestet. Wenn sich jemand getraut hat, bitte berichten.

              1 Reply Last reply Reply Quote 0
              • lobomau
                lobomau last edited by

                Ich habe mich rangesetzt und versuche es zu installieren. Bei mir ist Hauptsystem ein brix und raspicam läuft auf raspi3.

                Habe also mit der Installation auf dem brix begonnen:

                Hier nach
                > autoreconf -fiv
                kam am Ende:

                configure: error: Required package 'pkg-config' not found, please check motion_guide.html and install necessary dependencies.
                

                Darauf hin habe ich:````
                apt-get install pkg-config

                gemacht.
                
                Dann geht nicht direkt "make"… sondern wieder:````
                autoreconf -fiv
                
                ./configure
                
                make
                

                "Install complete!"

                Scheint also der erste Abschnitt geklappt zu haben…

                1 Reply Last reply Reply Quote 0
                • lobomau
                  lobomau last edited by

                  @fu_zhou:

                  3. Konfiguration für den ioBroker-motion-Adapter. Auch hier sind die Pfadangaben entsprechend an das System anzupassen.

                  # 
                  ...
                  ```` `  Hier ist der iobroker-motion Adapter gemeint? Dort gebe ich den Code ein wie in der Konsole? Vielleicht verstehe ich es sobald ich den Adapter installiert habe…
                  

                  ` > Jetzt gstreamer installieren. gstreamer selbst ist wohl bei Jessie dabei, daher nur noch die notwendigen Pakete holen:

                  sudo bash
                  
                  apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins gstreamer1.0-omx
                  ```` `  
                  

                  Das Paket findet er scheinbar nicht. Habe auch````
                  apt-get update

                  root@brix-3150:/motion# sudo bash
                  root@brix-3150:/motion# apt-get install -y gstreamer1.0-tools gstreamer1.0-plugins gstreamer1.0-omx
                  Paketlisten werden gelesen... Fertig
                  Abhängigkeitsbaum wird aufgebaut.
                  Statusinformationen werden eingelesen.... Fertig
                  Hinweis: »gstreamer1.0-plugins-ugly-amr« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-ugly-dbg« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-ugly-doc« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-base-apps« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-good« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-bad« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-base« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-bad-videoparsers« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-really-bad« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-bad-dbg« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-bad-doc« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-bad-faad« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-base-dbg« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-good-dbg« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-base-doc« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-good-doc« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  Hinweis: »gstreamer1.0-plugins-ugly« wird für regulären Ausdruck »gstreamer1.0-plugins« gewählt.
                  E: Paket gstreamer1.0-omx kann nicht gefunden werden.
                  E: Mittels des Musters »gstreamer1.0-omx« konnte kein Paket gefunden werden.
                  E: Mittels regulärem Ausdruck »gstreamer1.0-omx« konnte kein Paket gefunden werden.
                  root@brix-3150:/motion#

                  1 Reply Last reply Reply Quote 0
                  • ruhigundrelaxed
                    ruhigundrelaxed last edited by

                    Hi lobomau,

                    also, dass du das omx paket nicht findest liegt wahrscheinlich daran, dass du das nicht auf einem rpi sondern auf deinem brix installierst.

                    Nur beim RPI kann ich mit sicherheit sagen das omx das decoding auf der gpu macht.

                    Du hast allerdings eine intel hd gpu in deiner brix kiste. Die kann imho auch h264 decodieren. Allerdings nicht mit omx sondern mit vaapi.

                    Im einfachste Fall könnte es reichen, in der pipline omxh264dec durch vaapidecode zu tauschen. Müsstest du ausprobieren. Evt. ist noch mehr tuning an der pipeline nötig.

                    Leider habe ich grade keinen Rechner mit Intel GPU zum probieren.

                    Sinngemäß mußt du das folgende tun:

                    1.) Erstmal die vaapi installieren und schauen ob sie läuft. ->apt-cache search vaapi<- zeigt dir die verfügbaren vaapi pakete. Auch das gstreamer vaapi plugin sollte auftauchen. das paket vainfo installieren, und das program vainfo ausführen. Es sollte dir dann erzählen ob deine vaapi läuft.

                    2.) Nun mal probieren ob die gstreamer pipeline mit vaapidecode anstelle von omxh264dec läuft.

                    Dann melden und wir sehen weiter….

                    Viel Glück & Gruß

                    Martin

                    1 Reply Last reply Reply Quote 0
                    • lobomau
                      lobomau last edited by

                      Hab Mal nach Paketen gesucht und gefunden:

                      gstreamer1.0-vaapi - VA-API plugins for GStreamer
                      gstreamer1.0-vaapi-doc - GStreamer VA-API documentation and manualsi965-va-driver - VAAPI driver for Intel G45 & HD Graphics family
                      libvdpau-va-gl1 - VDPAU driver with OpenGL/VAAPI backend
                      

                      Dann teste ich mal die Installation…

                      1 Reply Last reply Reply Quote 0
                      • fu_zhou
                        fu_zhou last edited by

                        @lobomau:

                        @fu_zhou:

                        3. Konfiguration für den ioBroker-motion-Adapter. Auch hier sind die Pfadangaben entsprechend an das System anzupassen.

                        # 
                        ...
                        ```` `  Hier ist der iobroker-motion Adapter gemeint? Dort gebe ich den Code ein wie in der Konsole? Vielleicht verstehe ich es sobald ich den Adapter installiert habe… `  
                        

                        Nein, hier ist tatsächlich noch die motion.conf gemeint, um motion für den motion-Adapter vorzubereiten.

                        1 Reply Last reply Reply Quote 0
                        • lobomau
                          lobomau last edited by

                          @lobomau:

                          Hab Mal nach Paketen gesucht und gefunden:

                          gstreamer1.0-vaapi - VA-API plugins for GStreamer
                          gstreamer1.0-vaapi-doc - GStreamer VA-API documentation and manualsi965-va-driver - VAAPI driver for Intel G45 & HD Graphics family
                          libvdpau-va-gl1 - VDPAU driver with OpenGL/VAAPI backend
                          

                          Dann teste ich mal die Installation… `
                          Installation war kein Problem.

                          Ich hänge jedoch fest die richtige Adresse für rtsp herauszubekommen. Steht ja viel zu im Netz.

                          Habe erstmal folgendes probiert mit der IP vom raspi3 mit raspi-cam:

                          raspivid -o - -t 0 -w 1280 -h 720 -fps 25 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264
                          

                          und mit VLC die Adresse probiert:

                          rtsp://192.168.0.205:8554/h264
                          

                          Aber da kommt bei VLC immer ein Fehler.

                          1 Reply Last reply Reply Quote 0
                          • fu_zhou
                            fu_zhou last edited by

                            Auf jeden Fall warst du mit dem VLC mal richtig unterwegs. Vielleicht hilft dir das:

                            https://www.ispyconnect.com/man.aspx?n=Raspberry+Pi

                            Ich habe iSpy auf einem Windows-PC installiert und unter Angabe des Models nach dem Stream suchen lassen. Das hat ganz gut funktioniert. Ob's mir der RasPi Cam geht, weiß ich nicht, aber dass sie aufgeführt ist, lässt schon mal hoffen…

                            Hast mal nur rtsp://###.###.###.###:8554/ probiert?

                            1 Reply Last reply Reply Quote 0
                            • lobomau
                              lobomau last edited by

                              @fu_zhou:

                              Hast mal nur rtsp://###.###.###.###:8554/ probiert? `
                              Das geht auch nicht. ABer wahrscheinlich läuft motion gar nicht, so dass VLC auch nichts anzeigen kann.

                              Nach````
                              raspivid -o - -t 0 -w 1280 -h 720 -fps 5 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554}' :demux=h264

                              
                              In der Konsole sieht es am Ende dann so aus:
                              

                              [73d00508] core input debug: Buffering 74%
                              [73d00508] core input debug: Buffering 79%
                              [73d00508] core input debug: Buffering 84%
                              [73d00508] core input debug: Buffering 89%
                              [73d00508] core input debug: Buffering 94%
                              [73d00508] core input debug: Buffering 99%
                              [73d00508] core input debug: Stream buffering done (840 ms in 1 ms)
                              [73d00508] core input debug: Decoder wait done in 0 ms
                              [73d00508] core input error: ES_OUT_SET_(GROUP_)PCR is called too late (pts_delay increased to 806 ms)
                              [73d00508] core input error: ES_OUT_RESET_PCR called
                              [73d00508] core input debug: Buffering 0%
                              [73d00508] core input debug: Buffering 4%
                              [73d00508] core input debug: Buffering 9%
                              [73d00508] core input debug: Buffering 14%
                              [73d00508] core input debug: Buffering 19%
                              [73d00508] core input debug: Buffering 24%
                              [73d00508] core input debug: Buffering 29%
                              [73d00508] core input debug: Buffering 34%
                              [73d00508] core input debug: Buffering 39%
                              [73d00508] core input debug: Buffering 44%
                              [73d00508] core input debug: Buffering 49%
                              [73d00508] core input debug: Buffering 54%
                              [73d00508] core input debug: Buffering 59%
                              [73d00508] core input debug: Buffering 64%
                              [73d00508] core input debug: Buffering 69%
                              [73d00508] core input debug: Buffering 74%
                              [73d00508] core input debug: Buffering 79%
                              [73d00508] core input debug: Buffering 84%
                              [73d00508] core input debug: Buffering 89%
                              [73d00508] core input debug: Buffering 94%
                              [73d00508] core input debug: Buffering 99%
                              [73d00508] core input debug: Stream buffering done (840 ms in 1 ms)
                              [73d00508] core input debug: Decoder wait done in 0 ms

                              1 Reply Last reply Reply Quote 0
                              • arteck
                                arteck Developer Most Active last edited by

                                na dann schau ich mal

                                ok…hab da noch was...

                                man sollte für die GPU mem allokieren

                                gpu_mem=128

                                1 Reply Last reply Reply Quote 0
                                • lobomau
                                  lobomau last edited by

                                  @arteck:

                                  na dann schau ich mal

                                  ok…hab da noch was...

                                  man sollte für die GPU mem allokieren

                                  gpu_mem=128 `
                                  das ist das was man unter raspi-config einstellt? Da hatte ich bereits 128 eingestellt.

                                  1 Reply Last reply Reply Quote 0
                                  • arteck
                                    arteck Developer Most Active last edited by

                                    ok bevor ich jetzt suche…

                                    wie fummel ich 2 Kameras da rein ??

                                    1 Reply Last reply Reply Quote 0
                                    • lobomau
                                      lobomau last edited by

                                      @arteck:

                                      ok bevor ich jetzt suche…

                                      wie fummel ich 2 Kameras da rein ?? `
                                      Vielleicht hilft das hier weiter:

                                       If you only have one camera you only need the motion.conf file but if you have more than one camera, then you will need to have one camera config file per camera plus the motion.conf file.
                                      
                                      So if you have for example two cameras you need motion.conf and two camera config files. So a total of three config files.
                                      
                                      An option that is common to all cameras can be placed in motion.conf. (You can also put all parameters in the camera files but that makes a lot of editing when you change a common thing).
                                      
                                      An option that is unique to a camera must be defined in each camera file.
                                      
                                      It is often seen that people copy the entire motion.conf into the camera config files and change a few options. This works but it not recommended because it is more difficult to maintain and overview. Keep all the common options in motion.conf and the few unique only in the camera config files
                                      
                                      The first camera is defined in the first camera file called from motion.conf. The 2nd camera is defined in the 2nd camera file called from motion.conf etc.
                                      
                                      Any option defined in motion.conf will be used for all cameras except for the cameras in which the same option is defined in a camera config file.
                                      
                                      To make it clear, the camera files format and syntax is the same as motion.conf. An example of what you might want in a camera file as follows: assume you have two cameras, attached to one system. Create files camera0.conf and camera1.conf. At the end of motion.conf, uncomment out the lines that refer to them. The full contents of the camera files can be as simple as
                                      
                                      camera0.conf:
                                      videodevice /dev/video0
                                      stream_port 8081
                                      
                                      camera1.conf:
                                      videodevice /dev/video1
                                      stream_port 8082
                                      

                                      Quelle: http://htmlpreview.github.io/?https://g … guide.html

                                      1 Reply Last reply Reply Quote 0
                                      • arteck
                                        arteck Developer Most Active last edited by

                                        soweit hab ich schon

                                        aber

                                        ich verstehe es auch so das ich 2 gstreamer.service instanzen laufen haben muss

                                        richtig ??

                                        1 Reply Last reply Reply Quote 0
                                        • lobomau
                                          lobomau last edited by

                                          Kann ich das Ganze auch mit einem stream über http anstatt rtsp machen?

                                          Das habe ich jetzt hinbekommen, dass ich einen stream bekomme über http://IP:port

                                          Ich bin hier nach vorgegangen:

                                          https://www.pcwelt.de/ratgeber/Mit_dem_ … 38548.html

                                          1 Reply Last reply Reply Quote 0
                                          • fu_zhou
                                            fu_zhou last edited by

                                            Achtung: bei mir funktioniert v4l2loopback nicht mehr, seitdem ich auf Jessie 4.9 upgegradet habe. Damit wird /dev/video0 nicht mehr erzeugt und gstreamer liefer kein Bild mehr an motion. Ich bin noch auf der Suche, im Moment bin ich auf rtsp mit ffmpeg umgestiegen, was aber eine höhere CPU Last zur Folge hat. Das Installieren der Kernel-Headers ging unter 4.9 wesentlich schneller, als bei der vorherigen Version. Ob es daran liegt?

                                            Es wäre Klasse, wenn jemand helfen kann, den v4l2loopback unter Jessie 4.9 wieder ans laufen zu kriegen…

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            936
                                            Online

                                            31.6k
                                            Users

                                            79.6k
                                            Topics

                                            1.3m
                                            Posts

                                            8
                                            26
                                            22846
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo