RTSP stream from container to the host

449 views
Skip to first unread message

Igor Ok

unread,
Dec 11, 2017, 1:16:17 PM12/11/17
to docker-java-dev
Hi all,

I have some problemes with streaming video from dokcer container to the host.

For test case i streamed a video from the host to the same host as follows:

1) Working code (stream to the same host: 127.0.0.1 --> 127.0.0.1)

streamServer.sh:
find ~/.config/vlc -delete
vlc --play-and-exit -I dummy -vvv GoPro_HERO6_Surfing.mp4 --file-caching 300 --start-time 31.000 --sout "#transcode{vcodec=h264,acodec=mpga,scale=Auto,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://localhost:1234/stream}" --sout-all --sout-keep

streamClient.sh:
wait 7s
vlc -vvv rtsp://localhost:1234/stream



Now i use the same code to stream the same video from container to the host but it fails.

2) Not working code (stream from container 172.18.0.2 --> to the host docker0 172.18.0.1)

Docker Container side:

Dockerfile:
# Use an official Python runtime as a parent image
FROM python:2.7-slim
WORKDIR /astream
ADD . /astream

COPY gopro.mp4 /astream/
COPY startStream.sh /astream/

RUN useradd -m vlc
RUN apt-get update && apt-get install -y vlc
EXPOSE 1234
ENTRYPOINT ["/astream/startStream.sh"]

startStream.sh:
#!/bin/bash

find ~/.config/vlc -delete
name=$SCRIPTPATH"/gopro.mp4";

sout="#transcode{vcodec=h264,acodec=mpga,scale=Auto,ab=128,channels=2,samplerate=44100}:rtp{sdp=rtsp://172.18.0.1:1234/test}"

# su vlc -> here vlc is a user name (created in Dockerfile)
su vlc -c "vlc --play-and-exit -I dummy -vvv $name --file-caching 300 --start-time $1 --sout '$sout' --sout-all --sout-keep"

Host side:

streamClient.sh
vlc -vvv rtsp://$1:1234/test

This part is not working. With wireshark i can not even see any incomming packets on docker0.

Can anyone help me with that?
Thanks in advance.
Igor
Reply all
Reply to author
Forward
0 new messages