# Video streaming AWS

Source: https://forum.modalai.com/topic/284/video-streaming-aws
Category: General Questions (https://forum.modalai.com/category/2/general-questions)
Posted: 2021-06-17 08:21:17 UTC by kasarrowtec
Replies: 12 · Views: 2162

## kasarrowtec · 2021-06-17 08:21:17 UTC

Hope you are well, I was hoping you could offer some advice on our current project.

We are trying to set up gstreamer in a docker container on the voxl - The gstreamer then sends it to AWS Kinesis. At the moment were just trying to get a bunny stream from the internet streaming to AWS - we understand later on when the VOXL is streaming from a connected camera we will need a VPN on the VOXL.

We think it may be a problem with the h264 encoder or parser, maybe we need a h265 encoder/parser? Any information about the VOXL encoding process or any plug-ins you may have will be great. We have ran the exact same thing on Ubuntu(64bit) and raspberrypi(ARM) to success but when we try on VOXL the following error code -

2021-06-16 14:02:20 [3399480432] Stream is ready

Pipeline is live and does not need PREROLL ...

Progress: (open) Opening Stream

Progress: (connect) Connecting to rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov

Progress: (open) Retrieving server options

Progress: (open) Retrieving media info

Progress: (request) SETUP stream 0

Progress: (request) SETUP stream 1

Progress: (open) Opened Stream

Setting pipeline to PLAYING ...

New clock: GstSystemClock

Progress: (request) Sending PLAY request

Progress: (request) Sending PLAY request

Progress: (request) Sent PLAY request

INFO - kinesisVideoStreamFormatChanged(): Stream format changed.

2021-06-16 14:02:22 [3286209648] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000040, Next state: 0x0000000000000080

2021-06-16 14:02:22 [3286209648] INFO - putStreamResultEvent(): Put stream result event. New upload handle 0

2021-06-16 14:02:22 [3286209648] DEBUG - stepStateMachine(): State Machine - Current state: 0x0000000000000080, Next state: 0x0000000000000100

Bus error

We use the following gst-launch command -
gst-launch-1.0 rtspsrc location="
rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov
" short-header=TRUE ! rtph264depay ! h264parse ! video/x-h264, format=avc,alignment=au ! kvssink stream-name="MyKVStream" storage-size=512 access-key="xxxxxxxxxxxxxxxxxxx" secret-key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" aws-region="eu-central-1"

Any pointers in the right direction would be much appreciated.

## Reply by kasarrowtec · 2021-06-17 09:05:46 UTC

@Kasum-Hussain Im launching this from a docker inside the VOXL

## Reply by Chad Sweet (ModalAI staff) · 2021-06-17 14:16:13 UTC

Can you please share the command you are using to launch the Docker as well?

## Reply by Eric Katzfey (ModalAI staff) · 2021-06-17 16:39:20 UTC (in reply to kasarrowtec)

@Kasum-Hussain There are a few things you can do to debug what is happening. In your launch line you have a src and a sink that are on the Internet. You can try each one separately and see if you can spot any problems. For example, instead of using the rtspsrc you can just use videotestsrc to generate a local stream to be sent to the kvssink. If that works, try the rtspsrc with a fakesink, or a filesink. Look to see if that is working properly. When you are convinced that both sides are working properly, then try to connect them directly. You can compare the messages coming out when on the Voxl to a successful case on the RPI and see if you spot any differences. You can also enable more verbose messaging in Gstreamer (https://gstreamer.freedesktop.org/documentation/tutorials/basic/debugging-tools.html?gi-language=c)

## Reply by kasarrowtec · 2021-06-21 07:42:40 UTC (in reply to Chad Sweet)

@Chad-Sweet This is the Docker file were using with command sudo docker run -it <imageID> 

FROM resin/rpi-raspbian:stretch
RUN apt-get update && \
    apt-get install -y \
    cmake \
    curl \
    g++ \
    gcc \
    git \
    gstreamer1.0-plugins-base-apps \
    gstreamer1.0-plugins-bad \
    gstreamer1.0-plugins-good \
    gstreamer1.0-plugins-ugly \
    gstreamer1.0-tools \
    gstreamer1.0-omx \
    libssl-dev \
    libcurl4-openssl-dev \
    liblog4cplus-dev \
    libgstreamer1.0-dev \
    libgstreamer-plugins-base1.0-dev \
    m4 \
    make \
    openssh-server \
    pkg-config \
    vim

#RUN curl -OL https://github.com/raspberrypi/firmware/archive/1.20180417.tar.gz
#RUN tar xvf 1.20180417.tar.gz
#RUN cp -r /opt/firmware-1.20180417/opt/vc ./
#RUN rm -rf firmware-1.20180417 1.20180417.tar.gz

###################################################
# create symlinks for libraries used by omxh264enc
###################################################

RUN     ln -s /opt/vc/lib/libopenmaxil.so /usr/lib/libopenmaxil.so && \
    ln -s /opt/vc/lib/libbcm_host.so /usr/lib/libbcm_host.so && \
        ln -s /opt/vc/lib/libvcos.so /usr/lib/libvcos.so &&  \
        ln -s /opt/vc/lib/libvchiq_arm.so /usr/lib/libvchiq_arm.so && \
        ln -s /opt/vc/lib/libbrcmGLESv2.so /usr/lib/libbrcmGLESv2.so && \
        ln -s /opt/vc/lib/libbrcmEGL.so /usr/lib/libbrcmEGL.so && \
        ln -s /opt/vc/lib/libGLESv2.so /usr/lib/libGLESv2.so && \
        ln -s /opt/vc/lib/libEGL.so /usr/lib/libEGL.so

WORKDIR /opt/
RUN    git clone https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
WORKDIR /opt/amazon-kinesis-video-streams-producer-sdk-cpp/build/
RUN cmake .. -DBUILD_GSTREAMER_PLUGIN=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DBUILD_OPENSSL_PLATFORM=linux-armv4 && \
    make

ENV gstLD_LIBRARY_PATH=/opt/amazon-kinesis-video-streams-producer-sdk-cpp/open-source/local/lib
ENV GST_PLUGIN_PATH=/opt/amazon-kinesis-video-streams-producer-sdk-cpp/build/:$GST_PLUGIN_PATH

## Reply by kasarrowtec · 2021-06-21 12:46:32 UTC

After some debugging today - it appears to be a UNALIGNED MEMORY ACCESS of STM32 error - weve seen this a few times now and are pretty sure it is something to do with this - any pointers from here would be great thanks

## Reply by Chad Sweet (ModalAI staff) · 2021-06-21 18:41:45 UTC

What is your ```docker run``` command? Want to make sure you're sharing your networking between docker and base OS

## Reply by kasarrowtec · 2021-06-22 07:54:27 UTC (in reply to Chad Sweet)

@Chad-Sweet docker run -it <image> 
This gets us to the bash of the docker

we know its sharing the network between docker and base OS (we had this thought) we used fakesink to confirm this. Were using a stream from the internet and streaming back to the internet - tested on a raspberry pi and it worked.

## Reply by kasarrowtec · 2021-06-22 12:46:39 UTC

UPDATE 

We have managed to fix it - we needed to run -DALIGNED_MEMORY_MODEL=TRUE with the cmake .. command.

So now the streaming to AWS part of it is okay and fully working.

Now as we are trying to connect a boson camera to the VOXL - we are hitting an error.

we run /boson-test

voxl-streamer -c video-test is working and we can see it with the RTSP url in VLC. but when we try voxl-streamer -c uvc-video and in the /etc/modalai/voxl-streamer.conf we change uvc video "device": "/dev/video2" - we get no error when streaming but when we try to watch the stream on VLC we get the logs - 
live555 error: Failed to connect with rtsp://192.168.7.155:8900/live
satip error: Failed to setup RTSP session

It also doesnt output an error if we use a video0 where no device is connected.

Do we need to disable live555 or are we doing it the wrong way ? or is the boson-test file were using intruding with it or is there a way of setting boson cameras up in particular ?

the camera we are using is FLIR BOSON 640 x 512 14mm

## Reply by Eric Katzfey (ModalAI staff) · 2021-06-22 14:50:50 UTC

Can you verify that the Boson is on /dev/video2? For example, do you see /dev/video2 only after plugging in the Boson and running boson-test?

## Reply by Eric Katzfey (ModalAI staff) · 2021-06-22 16:29:02 UTC (in reply to kasarrowtec)

@Kasum-Hussain You can enable debug messages in voxl-streamer with the ```-d``` and ```-v``` options. Also, please note that voxl-streamer will not work in a Docker.

## Reply by kasarrowtec · 2021-06-23 09:29:15 UTC (in reply to Eric Katzfey)

@Eric-Katzfey Hi Eric,

Yes i can confirm we do see /dev/video2 

do you have any documentation or instructions on setting up a FLIR boson camera with VOXL ? the boson-test was a small script another developer just gave me, so im not 100% sure how to use it.

thanks again for the help.

## Reply by kasarrowtec · 2021-06-23 09:35:20 UTC (in reply to kasarrowtec)

@Kasum-Hussain actually sorry my mistake i thought i saw video2 but no if i go into dev folder there is no video2 only video0 video1 video32 video33
