简体   繁体   中英

ffmpeg reduce memory consumption

I'm developing an application, capturing some ip camera with RTSP protocols and send them to one server. everything is going well when the resolution of ip cameras is low but when they're increased the memory consumption of my program goes up suddenly.

I've realized that ffmpeg stores a sequence of frames which we can seek to. 1.is there any way to reduce the len of that?

2.is it possible to reduce the frame size when the ffmpeg reads the frames from the input(=>ip camera)? the size 400x400 is enough for my app but currently it's 2048

3.or any other way to help me reduce memory usage

1) To reduce memory :

i) Reduce frame rate : use -framerate

ii) Increase compression by selecting longer GOP : use -g

2) To scale your input : use -s switch

ffmpeg -framerate 25 -g 14 -i input.mp4 -vcodec libx264 -s 400x400 http://localhost:1234/out.ffm

Edited:

For integrating ffmpeg to your c++ project, these are some of the solutions:

  1. Using system(ffmpeg command line); // Easy
  2. Use CreatePrcess and pipes to hide console window and show progress in your GUI. // Medium
  3. Use ffmpeg distributed include files and libraries to integrate in your project. // Need high learning curve

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