bytedeco/javacv

FFmpegFrameGrabber videocapture require memory increase

Aperta

#2249 aperta il 8 lug 2024

 (9 commenti) (0 reazioni) (0 assegnatari)Java (1583 fork)batch import
help wantedquestion

Metriche repository

Star
 (6985 stelle)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

when I use FFmpegFrameGrabber to capture from rtsp video, I notice the memory will be increase soon, it looks unnormal.

os: windows jdk:1.8 javacv:1.5.11-SNAPSHOT

package com.example.demo.server;

import lombok.extern.slf4j.Slf4j;
import org.bytedeco.javacv.FFmpegFrameGrabber;
import com.carrotsearch.sizeof.RamUsageEstimator;

@Slf4j
class demo1 {
    public static void main() throws FFmpegFrameGrabber.Exception {
        for (int i=0;i<100;i++){
        FFmpegFrameGrabber grabber;
        grabber = new FFmpegFrameGrabber("rtsp://128.8.84.224:18554/stream");
        try {
            grabber.start();
        } catch (FFmpegFrameGrabber.Exception e) {
            e.printStackTrace();
        }

        long size1 = RamUsageEstimator.sizeOf(grabber);
        log.info("#### start state grabber cost "+size1+" bytes");

        grabber.stop();
        grabber.release();
        }
    }
}

the memory will keep increasing

Guida contributor