'Webcam Stream With ffmpeg: UDP Stream remotely

I've a C920 HD camera connected to a Raspberry Pi 4 and my goal is to be able to access a stream of that camera anytime from my phone / laptop both connected to my network with a VPN.

Now, I managed to use ffmpeg like this:

ffmpeg -f v4l2 -input_format h264 \
-video_size 1920x1080 \
-i /dev/video4 \
-copyinkf -codec copy \
-f mpegts udp://192.168.1.10:5000?pkt_size=1316

On the computer 192.168.1.10 I can launch VLC go into "Network Transmission" and type udp://@:5000 in oder to watch the stream.

This is a single stream and from what I understand my RPi is just "shooting" the frames at that computer whatever it is connected or not, how can I have a proper stream (maybe rtmp?) that I can watch in multiple devices?

Please note: I'm using -copyinkf -codec copy in order to avoid transcoding and other operations that might result in a very high CPU usage. Can I do it this way also?

Thank you.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source