ffmpeg restream rtsp to mjpeg

五迷三道 提交于 2019-12-18 11:13:30

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/29699980/ffmpeg-restream-rtsp-to-mjpeg

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!