OpenCV stream captured CAM with H264 (mp4) codec
Asked Answered
K

2

7

I like to stream the web cam pictures wich are captured by opencv. I think about a solution with ffmpeg and live555 (poorly they are not document so well). My problems are:

  1. How can convert the captured images to a H264 format so the picures/second match. If it is in a loop I get more than 25 pictures/sekond and the video is to fast.

  2. How can i directly stream the converted H264 stream over the network via rtp / rtps or similar.

Thanks for your help!

Karren answered 3/7, 2012 at 12:17 Comment(0)
T
3
  1. This is a common problem.
    • if you are not require to distribute your software (private use / server side / open-source), you may use FFMpeg compiled with x264 encoder, there's a config flag for that in FFMpeg's config script.
    • If you do require to distribute your software, i don't know any LGPL licensed library for that, i believe there is no such library. You'd have to use some paid solution.
  2. You should implement DeviceSource.cpp, see DeviceSource.hh and use it as the FramedSource.

Edit: Apple revealed video encoder API, allowing access to stream of h264 frames in iOS8

Tutto answered 2/8, 2012 at 12:28 Comment(0)
G
1

For an example of how to use x264 and Live555 to encode and stream frames, see the following:

  1. spyPanda open source project.
  2. How to write a Live555 FramedSource to allow me to stream H.264 live SO question.
Graces answered 27/2, 2013 at 11:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.