mkvserver_mk2 icon indicating copy to clipboard operation
mkvserver_mk2 copied to clipboard

Is this a replacement for ffserver?

Open RobLewis opened this issue 6 years ago • 4 comments

I'm trying to set up ffmpeg on a Raspberry Pi 3B+ to record 2 USB webcams (/dev/video0 and /dev/video1) to disk and simultaneously stream them live to connected web browsers (presumably using <video> elements). ffserver sounds like what I need, except it appears to be discontinued. Can mkvserver_mk2 do this? How would I set it up? I'm wondering why ffserver is no longer offered, as it seems like it filled a common need.

RobLewis avatar Dec 26 '18 21:12 RobLewis

Hi, ffserver was removed because it was unmaintained. This project was used as a basis for a replacement for ffserver. A new repository called ffserver is present on my profile, however, there is still a crucial (memory-leak) bug I have not been able to fix. Furthermore, embedding matroska in websites is still not possible (or is it?). You may be able to alter the source to produce webm instead of matroska and try with that. Be aware that using webm may require re-encoding which is explicitly not supported by my server implementations. This step should be done before feeding the video to the server.

I hope that clears up your questions. Sadly video-streaming is not a trivial problem and simple solutions are rare if not non-existent. :)

klaxa avatar Dec 26 '18 21:12 klaxa

Thanks very much. Can you describe the memory leak further? It might be tolerable in my application. As for re-encoding the video, can't I just have ffmpeg encode the raw video from the cameras as webm? I'm seeing conflicting information online, but some are saying Chrome plays matroska fine, others say you can "fool" it by setting the type to webm.

RobLewis avatar Dec 26 '18 22:12 RobLewis

The leak is due to libmicrohttpd's callbacks being called at a point where some data is still needed from the http-client-struct. I'd have to take a much deeper look again to find out how my high-level streaming-client is coupled to the low-level http-client. The file you would be looking at is lmhttpd.c in https://github.com/klaxa/ffserver/ . It is also described in the first issue of the repository.

Yes, you can simply use ffmpeg to encode to webm compatible codecs.

Maybe Chrome/Chromium can play matroska these days, maybe you can even fool it by saying it's webm when it's really matroska, I have no idea about that.

Good luck with your project :)

klaxa avatar Dec 27 '18 00:12 klaxa

thank youuuuuuuuuuuuu very much. chromium can play matroska for other format act shuch as below to have your own live stream on browser:

  1. if your video's format is matroska then run the server simply: ./server video.m4v
  2. if your video's format is not matroska (e.g. it's m4v) then run below commands: ffmpeg -i video.m4v -f matroska video.mkv ./server video.m4v this solution solved my issue

milad2golnia avatar Aug 04 '19 04:08 milad2golnia