0

I try to stream my RTSP-IP-Camera on a website. I use the Nginx webserver. My source in the html-code is:

  <source src=rtmp://ip-address:1935/live/ type="application/x-mpegURL" />

To convert the rtsp stream i use this ffmpeg code:

ffmpeg -rtsp_transport tcp -i rtsp://user:password@ip-camera:554/h264Preview_01_main -vcodec copy -acodec copy -f mp4 -y rtmp://ip-address:1935/live/

I get the error message "muxer does not support non seekable output Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument"

I also tried to convert the rtsp-camera into a mp4 file and then access the file as source in my html code, but i couldnt read the file while ffmpeg wrote in it.

If you need more information let me know.

Thank you and have a nice day.

Vepok
  • 13
  • 1
  • 3
  • I got it working with an installation of obs-studio. So the rtsp-ip-camera is as a vlc-source in obs. The obs sends the stream to my nginx rtmp server and in my html-code the rtmp-server is the source. My goal is to keep of obs-studio and send the camera stream directly as source in the html-code or to the rtmp-server application. The ip-camera is not able to send via rtmp. – Vepok Nov 22 '21 at 13:56
  • I tried some more, but i wont reach my goal. Here is what i tried today: `` is the source in my html config. And my ffmpeg: `ffmpeg -v info -rtsp_transport tcp -i rtsp://user:password@cameraip:port/h264Preview_01_main -c:v copy -c:a copy -maxrate 400k -bufsize 1835k -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_list_size 6 -hls_wrap 10 -start_number 1 /etc/nginx/html/test.m3u8` – Vepok Nov 23 '21 at 17:01

1 Answers1

0

First, you should use format flv, not mp4. More, you should specify a stream(StreamKey for obs) like livestream:

ffmpeg -rtsp_transport tcp -i rtsp://user:password@ip-camera:554/h264Preview_01_main -c copy \
  -f flv -y rtmp://ip-address:1935/live/livestream

Then you covert RTSP to RTMP, and you can use server to covert the RTMP to HLS, like what you did.

The latency of HLS is large, about 5~10s, if you want to get lower latency, please use HTTP-FLV or WebRTC, see link here

Winlin
  • 1,136
  • 6
  • 25
  • Thanks for your response. It worked. Now i just need to find out how to scale the stream. – Vepok Apr 28 '22 at 08:38
  • Good news! Well I don't understand what's *scale the stream*, I think it's better to discuss on discord first. You could find the discord of srs in https://github.com/ossrs/srs – Winlin May 01 '22 at 00:36
  • Hello, with "scale" i meant to change the resolution of the stream to fit better on the site :) – Vepok Jun 22 '22 at 07:26
  • OK, you could use multiple resolution HLS, please read https://stackoverflow.com/a/71985380/17679565 – Winlin Jun 27 '22 at 09:03