onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Streaming video and audio with Auvidea B101

Tue Feb 04, 2020 9:18 am

Hi people, sorry if this entry shouldn't go here (moderator, you can move it please)

I have the module B101 of Auvidea and i have now video and audio separately ( the user 6by9 helped me :D )

I would like stream the signal to an RTMP server, so i think that i need use the commands as "gst-launch1.0" and "ffmpeg" for join both. ( i can't use "avconf" instead of "ffmpeg" becouse has installed by default on raspbian buster version)

For now, i have the next commands for get audio and video separately in VLC;


Video (with "yavta" modded version by 6by9 https://github.com/6by9/yavta"):

Code: Select all

./yavta --capture=1000 -n 3 --encode-to=- -f UYVY -m -T /dev/video0 | vlc stream:///dev/stdin :demux=h264

Audio:

Code: Select all

arecord -D hw:1,0 -d 25 -f cd | vlc stream:///dev/stdin

Can you help me for made a correct command with both stream indefinetily to RTMP server?? thank's guys.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13235
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Streaming video and audio with Auvidea B101

Tue Feb 04, 2020 12:09 pm

Please at least use the search facility on the forums
https://www.raspberrypi.org/forums/view ... 4#p1448573
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Re: Streaming video and audio with Auvidea B101

Tue Feb 04, 2020 12:57 pm

6by9 wrote: Please at least use the search facility on the forums
https://www.raspberrypi.org/forums/view ... 4#p1448573

Ohh thank's again 6by9.
I'm try but i think that i have a conduct error with "v4l2h264enc".
When i put the command "gst-inspect-1.0 | grep v4l2" i can see this;

Code: Select all

video4linux2:  v4l2src: Video (video4linux2) Source
video4linux2:  v4l2sink: Video (video4linux2) Sink
video4linux2:  v4l2radio: Radio (video4linux2) Tuner
video4linux2:  v4l2deviceprovider (GstDeviceProviderFactory)

Maybe need install something?¿

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13235
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Streaming video and audio with Auvidea B101

Tue Feb 04, 2020 1:18 pm

A standard 4.19 (or 5.4) Linux kernel for Raspbian should include bcm2835-codec ("modinfo bcm2835-codec" to confirm).
That should create /dev/video10, /dev/video11, and /dev/video12 for decode, encode, and isp/resize respectively.

v4l2h264enc is part of gst-plugins-good

Code: Select all

pi@raspberrypi:~ $ gst-inspect-1.0 v4l2h264enc
Factory Details:
  Rank                     primary + 1 (257)
  Long-name                V4L2 H.264 Encoder
  Klass                    Codec/Encoder/Video
  Description              Encode H.264 video streams via V4L2 API
  Author                   ayaka <ayaka@soulik.info>

Plugin Details:
  Name                     video4linux2
  Description              elements for Video 4 Linux
  Filename                 /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstvideo4linux2.so
  Version                  1.14.4
  License                  LGPL
  Source module            gst-plugins-good
  Source release date      2018-10-02
  Binary package           GStreamer Good Plugins (unknown Debian derivative)
  Origin URL               http://packages.qa.debian.org/gst-plugins-good1.0

GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstVideoEncoder
                         +----GstV4l2VideoEnc
                               +----GstV4l2H264Enc
                                     +----v4l2h264enc

Implemented Interfaces:
  GstPreset

Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
          stream-format: byte-stream
              alignment: au
  
  SINK template: 'sink'
    Availability: Always
    Capabilities:
      video/x-raw
                 format: { (string)I420, (string)YV12, (string)NV12, (string)NV21, (string)RGB16, (string)RGB, (string)BGR, (string)BGRx, (string)BGRA, (string)YUY2, (string)YVYU, (string)UYVY }
                  width: [ 1, 32768 ]
                 height: [ 1, 32768 ]
              framerate: [ 0/1, 2147483647/1 ]

Element has no clocking capabilities.
Element has no URI handling capabilities.

Pads:
  SINK: 'sink'
    Pad Template: 'sink'
  SRC: 'src'
    Pad Template: 'src'

Element Properties:
  capture-io-mode     : Capture I/O mode (matches src pad)
                        flags: readable, writable
                        Enum "GstV4l2IOMode" Default: 0, "auto"
                           (0): auto             - GST_V4L2_IO_AUTO
                           (1): rw               - GST_V4L2_IO_RW
                           (2): mmap             - GST_V4L2_IO_MMAP
                           (3): userptr          - GST_V4L2_IO_USERPTR
                           (4): dmabuf           - GST_V4L2_IO_DMABUF
                           (5): dmabuf-import    - GST_V4L2_IO_DMABUF_IMPORT
  device              : Device location
                        flags: readable
                        String. Default: "/dev/video11"
  device-fd           : File descriptor of the device
                        flags: readable
                        Integer. Range: -1 - 2147483647 Default: -1 
  device-name         : Name of the device
                        flags: readable
                        String. Default: null
  extra-controls      : Extra v4l2 controls (CIDs) for the device
                        flags: readable, writable
                        Boxed pointer of type "GstStructure"
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "v4l2h264enc0"
  output-io-mode      : Output side I/O mode (matches sink pad)
                        flags: readable, writable
                        Enum "GstV4l2IOMode" Default: 0, "auto"
                           (0): auto             - GST_V4L2_IO_AUTO
                           (1): rw               - GST_V4L2_IO_RW
                           (2): mmap             - GST_V4L2_IO_MMAP
                           (3): userptr          - GST_V4L2_IO_USERPTR
                           (4): dmabuf           - GST_V4L2_IO_DMABUF
                          (5): dmabuf-import    - GST_V4L2_IO_DMABUF_IMPORT
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  qos                 : Handle Quality-of-Service events from downstream
                        flags: readable, writable
                        Boolean. Default: false
That's from GStreamer 1.14.4, which is the default shipped with Raspbian.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Re: Streaming video and audio with Auvidea B101

Wed Feb 05, 2020 8:02 am

Ok, i have the next output;

Code: Select all

pi@raspberrypi:~ $ modinfo bcm2835-codec
filename:       /lib/modules/4.14.34-v7+/kernel/drivers/staging/vc04_services/bcm2835-codec/bcm2835-codec.ko
version:        0.0.1
license:        GPL
author:         Dave Stevenson, <dave.stevenson@raspberrypi.org>
description:    BCM2835 codec V4L2 driver
srcversion:     35FF52EC8D17C5D9EF36C15
alias:          of:N*T*Craspberrypi,bcm2835-v4l2-encoderC*
alias:          of:N*T*Craspberrypi,bcm2835-v4l2-encoder
alias:          of:N*T*Craspberrypi,bcm2835-v4l2-decoderC*
alias:          of:N*T*Craspberrypi,bcm2835-v4l2-decoder
depends:        v4l2-mem2mem,bcm2835-mmal-vchiq,videodev,videobuf2-v4l2,videobuf2-core,videobuf2-dma-contig
staging:        Y
intree:         Y
name:           bcm2835_codec
vermagic:       4.14.34-v7+ SMP mod_unload modversions ARMv7 p2v8 
parm:           debug:activates debug info (uint)


pi@raspberrypi:~ $ gst-inspect-1.0 v4l2h264enc
Does not exist the element or complement «v4l2h264enc»


With Raspbian by default, i remember have "/dev/video10", 11 and 12 but don't remember when i lost this, i think that are after enable "hdmi_safe=1" or after install this https://github.com/maditnerd/tc358743.git.

"apt" said that i had installed "gstreamer1.0-plugins-good" and didn't necessary again.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13235
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Streaming video and audio with Auvidea B101

Wed Feb 05, 2020 8:13 am

Have you reduced gpu_mem in config.txt? "vcgencmd get_mem gpu".
If below 16MB then it disables almost all multimedia because it has no memory to work with. You'll want around 80MB for video encode.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Re: Streaming video and audio with Auvidea B101

Wed Feb 05, 2020 8:54 am

6by9 wrote: Have you reduced gpu_mem in config.txt? "vcgencmd get_mem gpu".
If below 16MB then it disables almost all multimedia because it has no memory to work with. You'll want around 80MB for video encode.

Mmm i have setted "gpu_mem=256" in my "/boot/config.txt" file. My Raspberry Pi are the 3B rev 1.2 model with Raspbian Buster and GUI for Desktop. Is it ok?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 13235
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Streaming video and audio with Auvidea B101

Wed Feb 05, 2020 9:14 am

Code: Select all

/lib/modules/4.14.34-v7+
Huh. How/why are you running a 4.14 kernel on Buster? IIRC The current kernel release in apt is 4.19.93, with rpi-update on 4.19.97.

I guess you blindly followed maditnerd's script, which clones and builds my old kernel branch. There's no need to as all the relevant modules are already merged into the standard kernels.
Please confirm with "uname -a"

Code: Select all

sudo apt update
sudo apt install --reinstall raspberrypi-kernel
should get you back to the stock kernel.
That probably also explains why you were having to do odd things with the dtoverlays.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Re: Streaming video and audio with Auvidea B101

Wed Feb 05, 2020 10:03 am

6by9 wrote: I guess you blindly followed maditnerd's script, which clones and builds my old kernel branch. There's no need to as all the relevant modules are already merged into the standard kernels.
Please confirm with "uname -a"

:o Exactly, you have reason... i working with kernel 4.14. After use the command for reinstall raspberrypi-kernel already have 4.19 i can run the gst command without error about "v4l2h264enc", solved this :D

About the revelevant modules merged into the standard kernels... do you mean that i don't need clone and install the maditnerd's script??

I testing on two differents streaming servers. On one server i can see the audio (bad, with cuts) and video (normally bad, pixelated). I thing that problems maybe are for a high memory consumption. I will try all process with lite version of raspbian without desktop and return back here with news. Thank's again.

onlypalmero
Posts: 19
Joined: Wed Jan 29, 2020 9:24 am

Re: Streaming video and audio with Auvidea B101

Thu Feb 06, 2020 12:19 pm

Finally, with raspbian without desktop is more fast and the audio is better but the video is very bad and the streaming is lost within a few minutes forcing to restart the raspberry PI.

Personally, i think that this solution (B101 + Raspberry) are only for testing purposes. Anyway... very thank's for all your support 6by9.

Return to “Interfacing (DSI, CSI, I2C, etc.)”