3

I am currently working on a student project, we have to create a live streaming service for videos with those constraints :

  • We capture the video from the Webcam with OpenCV
  • We want to stream the video while it's recorded
  • We have a file capture.avi that is saved to the computer, and while this file is saved, we want to stream it.

Currently, we have no idea how to do it, we don't know if the file transferred from A to B will be openable (Via VLC for example) in B, and if we won't have any interruption.

We plan to use RTSP for the network protocol. We code everything in C++.

Here the questions :

  • Does RTSP take care to stream a file that is being written
  • What format of the source should we use ? Should we stream the frames captured from OpenCV from A to B (So in B we have to use OpenCV to convert the frames to a video), or should we let OpenCV create a video file in A, and stream that video file from A to B ?

Thank you !

Erowlin
  • 9,555
  • 4
  • 35
  • 63
  • 1
    Try using mjpeg encoding for real time streaming. The video encoding will not be expensive and will not depend on many frames. – Pervez Alam Apr 17 '14 at 11:55
  • how is the audio supposed to be handled? – Zaw Lin Apr 24 '14 at 00:48
  • @Zaw Lin You are going to use OpenCV only for recording, or is there any pre-process before recording and streaming? – Haris Apr 24 '14 at 13:03
  • @Haris, i just would like to know if it's a concern of op. if audio can be discarded, it simplify matters – Zaw Lin Apr 24 '14 at 16:50
  • Ok sorry for that, my silly mistake I meant for OP. – Haris Apr 24 '14 at 16:55
  • Yes, we have to stream audio too, but we actually don't have a plan for it. The perfect solution should capture video & audio in the same time, and stream it. OpenCV can only capture Video i think, so if you have another solution to apture video + audio in the same time, it would be perfect. I Know that ffmpeg is capable of it, but I can't manage a good guide for it, and the documentation is pretty confusing about it. – Erowlin Apr 25 '14 at 00:41
  • What platform are you working on i.e. Windows? Linux? Is video capture the only reason you want to use OpenCV? – Ralf Apr 28 '14 at 16:55

1 Answers1

1

I don't believe it is safe to do so and what you need is two buffers.

  • The first would allow whatever library you want to use to write you recorded video to your local file system.
  • The later would allow your video to be streamed through your network.

Both should share the same context therefore the same data which would manage the synchronization of the two buffers.

mcorbe
  • 165
  • 1
  • 8