I want to live stream video from h.264/h.265 IP camera to browser with little to no delay and in decent quality (Full HD). I know there are couple of questions like this one but the answers seem to be either incomplete or outdated. So far I've tried ffmpeg and ffserver and had some success with them, but there are problems:
When I stream to mjpg the quality isn't great, if I use webm quality is better but there is significant delay (aprox. 5 seconds), probably due to transcoding from h264 to vp9. How can I improve it? Is it possible to stream h264 without transcoding it to different format? Are there any better solutions than ffserver and ffmpeg?
Here is the config I've used for mjpg:
ffmpeg -rtsp_transport tcp -i rtsp://rtsp_user:[email protected]:554/Streaming/Channels/101 -q:v 3 http://localhost:8090/feed3.ffm
on ffserver:
<feed feed3.ffm>
file /tmp/feed3.ffm
filemaxsize 1G
acl allow 127.0.0.1
</feed>
<Stream cam3.mjpg>
Feed feed3.ffm
Format mpjpeg
VideoCodec mjpeg
VideoFrameRate 25
VideoIntraOnly
VideoBufferSize 8192
VideoBitRate 8192
VideoSize 1920x1080
VideoQMin 5
VideoQMax 15
NoAudio
Strict -1
</Stream>
And for webm:
ffmpeg -rtsp_transport tcp -i rtsp://rtsp_user:[email protected]:554/Streaming/Channels/101 -c:v libvpx http://127.0.0.1:8090/feed4.ffm
ffserver:
<Stream cam4.webm>
Feed feed4.ffm
Format webm
# Audio settings
NoAudio
# Video settings
VideoCodec libvpx
VideoSize 720x576
VideoFrameRate 25
AVOptionVideo qmin 10
AVOptionVideo qmax 42
AVOptionAudio flags +global_header
PreRoll -1
StartSendOnKey
VideoBitRate 400
</Stream>