10

I have a few IP cameras that stream 720 X264 video over rtsp. The streams are really unreliable when viewing on Android. They also fail if more then 2 connections are made.

I have a ubuntu server that I can use to connect and restream as mjpeg or something else. There are tons of different commands out there but they all seem to involve transcoding the video.

How can I simply restream the live rtsp feed as a mjpeg without doing anything to the video itself? Theres no audio so no worries there.

JpaytonWPD
  • 485
  • 1
  • 7
  • 22

1 Answers1

15

It seems that recently I did something similar. I have added following section to the /etc/ffserver.conf file:

<Feed monitoring1.ffm>
File /tmp/monitoring1.ffm
FileMaxSize 50M
ACL allow 127.0.0.1
</Feed>

<Stream monitoring1.mjpg>
Feed monitoring1.ffm
Format mpjpeg
VideoCodec mjpeg
VideoFrameRate 22
VideoBufferSize 80
VideoSize 720x264
NoAudio
</Stream>

After that started server with command:

ffserver

and run streaming with command:

ffmpeg -i "rtsp://<ip_camera>:554/user=admin&password=&channel=1&stream=0.sdp" http://localhost:8090/monitoring1.ffm

Tune the ip camera url for your purposes. Now you can access the mjpeg stream by accessing following address with your browser/player:

http://localhost:8090/monitoring1.mjpg

Works fine for me and hope it solves your problem.

Rafał
  • 166
  • 3
  • 4
  • 1
    It looks like that would work. However I ended up getting some Free licenses to use Xeoma which handled this for me and added a bunch of features. Like motion detection that triggers a popup with the live video on my Kodi Media center. Archive recording by motion, and transcoding with date/time stamps so I can have my tablet act as a monitor. – JpaytonWPD Aug 03 '15 at 16:15
  • 1
    I have followed your approach but keep getting "No such file or directory" when running the ffmpeg command. Any idea what this could be? – mJay May 20 '17 at 20:14
  • 1
    @mJay: The only thing that comes to mind is checking what "file" it is looking for. You could try to increase log level of ffmpeg to "verbose". You can do it by using "-report" switch for ffmpeg command. Maybe you could look a bit closer at the URL you are using in "-i" parameter. Did you not forget about protocol identifier, so it could interpret it as a file locator instead of URL? – Rafał Apr 15 '18 at 09:46