简体   繁体   中英

OpenCV stream captured CAM with H264 (mp4) codec

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!

  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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM