I have a GStreamer pipeline running on a Raspberry Pi on my home's LAN that is multicasting a UDP video (h264) and audio (opus) stream.
MULTICAST_IP_ADDR=224.1.1.1
VIDEO_UDP_PORT=5001
AUDIO_UDP_PORT=5002
gst-launch-1.0 -v rpicamsrc vflip=true hflip=true \
name=src preview=0 fullscreen=0 bitrate=10000000 \
annotation-mode=time annotation-text-size=20 \
! video/x-h264,width=960,height=540,framerate=24/1 \
! h264parse \
! rtph264pay config-interval=1 pt=96 \
! queue max-size-bytes=0 max-size-buffers=0 \
! udpsink host=$MULTICAST_IP_ADDR auto-multicast=true port=$VIDEO_UDP_PORT \
alsasrc device=plug:dsnooped provide-clock=false \
! audio/x-raw,rate=44100 \
! audiorate \
! audioconvert \
! audioresample \
! opusenc \
! rtpopuspay \
! queue max-size-bytes=0 max-size-buffers=0 \
! udpsink host=$MULTICAST_IP_ADDR auto-multicast=true port=$AUDIO_UDP_PORT
I have verified that the multicast is working and is accessible to the devices on the LAN.
I also have an OpenVPN server configured through my router that allows me to access my home network while I'm away.
I realized today that, for some networking reason that i don't yet understand, I'm not able to access the multicast stream (e.g. udp://@224.1.1.1:5001) through my OpenVPN connection like I can when im directly connected to the LAN.
Can you help me find a way to view this stream while connected through OpenVPN?
Any suggestions and ideas are greatly appreciated, let me know if any other details about my set up would help.
A nice solution was to use HTTP Live Streaming (HLS). On the same Raspberry Pi that is running the multicast video / audio I've done two things:
sudo rm /var/www/picam-viewer/hls/*.ts
sudo rm /var/www/picam-viewer/hls/*.m3u8
VIDEO_CAPS="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264,payload=(int)96"
AUDIO_CAPS="application/x-rtp,media=(string)audio,clock-rate=(int)48000,encoding-name=(string)OPUS"
sudo gst-launch-1.0 -v udpsrc address=224.1.1.1 port=5002 caps=$AUDIO_CAPS \
! rtpopusdepay \
! opusdec \
! audioconvert \
! avenc_aac \
! queue \
! combine_to_hls.audio \
udpsrc address=224.1.1.1 port=5001 caps=$VIDEO_CAPS \
! rtph264depay \
! h264parse \
! queue \
! hlssink2 location="/var/www/picam-viewer/hls/%06d.ts" playlist-location="/var/www/picam-viewer/hls/list.m3u8" max-files=5 playlist-length=3 target-duration=2 name=combine_to_hls
So far this works very well while away from the house over an OpenVPN connection. I did have to reach out to my ISP to request a public IP address for the VPN to work. Thankfully my ISP is not evil and was very helpful with this request (local municipal ISP).