3

I have an aquarium camera which streams over RTSP. Unfortunately when I access the IP address, the stream wants to load a VLC plugin. I want to be able to share this stream with others without the need to install software or plugins etc. The only way I can find to do this is either use a paid for service (not ideal) or take the stream, transcode it to a web friendly stream, making the new stream accessible.

Is it possible to make a raspberry pi the middle man here? I found some information but not sure if it's the best solution:

https://web.archive.org/web/20151012014829/http://www.videolan.org:80/doc/streaming-howto/en/ch03.html

The camera is connected via USB to a wifi hub box which is in turn connected to my home network via wifi. I would be looking at connecting the Pi to my router via cable.

Thanks in advance.

2

You can store streams on the raspberry pi drive by:

ffmpeg -i "rtsp://yourRtspStreamSource" -hls_time 3 -hls_wrap 10 "yourOutputDir/streaming.m3u8"  

And then, re-stream streaming.m3u8 over HTTP:

ffmpeg -re -i "yourOutputDir/streaming.m3u8" -pix_fmt yuv420p -vsync 1 -threads 0 -vcodec libx264 -r 30 -g 60 -sc_threshold 0 -b:v 512k -bufsize 640k -maxrate 640k -preset veryfast -profile:v baseline -tune film -acodec aac -b:a 128k -ac 2 -ar 48000 -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -bsf:v h264_mp4toannexb -f mpegts udp://127.0.0.1:10000?pkt_size=1316  

I haven't tested it but must work. It gives the RTSP streams and saves to streaming.m3u8 then re-stream the streaming.m3u8 to your localhost.


More information:

Convert rtsp-stream into http stream
Re-stream using FFmpeg

| improve this answer | |
  • Hi thanks for your suggestion. This appears to be working. The part I'm stuck on is accessing the re-stream, which is probably just my lack of knowledge in Linux and networks! I have the following outputs: drive.google.com/… – Chrizh Feb 11 at 18:58
  • I just skim what you did and my suggestion is fire commands as root user by running su. – M. Rostami Feb 12 at 0:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.