bytedeco/javacv

grabber.start() loop Throwing OutOfMemoryError

Open

#1,922 opened on Nov 3, 2022

View on GitHub
 (10 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hello, I use FFmpegFrameGrabber to read a big video(397M,10s,mov format). When calling grabber.start(), it is blocked all the time. Cyclically print 'Throwing OutOfMemoryError' and 'Starting a blocking GC Alloc' without stopping or throwing exceptions. How do I solve this problem? My version is 1.5.7,on Android.

grabber = new FFmpegFrameGrabber(fileInputStream); grabber.start(); recorder = new FFmpegFrameRecorder(outPath, grabber.getImageWidth(), grabber.getImageHeight(), grabber.getAudioChannels()); //设置输出的视频参数与原视频相同 recorder.setFrameRate(grabber.getFrameRate()); recorder.setVideoBitrate(grabber.getVideoBitrate()); recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); recorder.setAudioBitrate(grabber.getAudioBitrate()); recorder.setAudioCodec(grabber.getAudioCodec()); recorder.setSampleRate(grabber.getSampleRate()); recorder.start();

log: Starting a blocking GC Alloc 09:47:42.504 I Alloc concurrent copying GC freed 3(16KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 269MB/293MB, paused 90us total 54.308ms 09:47:42.504 I Forcing collection of SoftReferences for 512MB allocation 09:47:42.504 I Starting a blocking GC Alloc 09:47:42.752 I Alloc concurrent copying GC freed 6(16KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 269MB/293MB, paused 83us total 248.210ms 09:47:42.753 W Throwing OutOfMemoryError "Failed to allocate a 536870928 byte allocation with 25165824 free bytes and 242MB until OOM, target footprint 307650936, growth limit 536870912" (VmSize 8224484 kB) 09:47:42.753 System.err com.hbbc.spzzzj W Error on InputStream.reset() or skip(): java.lang.OutOfMemoryError: Failed to allocate a 536870928 byte allocation with 25165824 free bytes and 242MB until OOM, target footprint 307650936, growth limit 536870912 09:47:42.753 I Starting a blocking GC Alloc 09:47:42.753 I Starting a blocking GC Alloc 09:47:42.767 I Alloc young concurrent copying GC freed 23(46KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 269MB/293MB, paused 98us total 14.144ms 09:47:42.767 I Starting a blocking GC Alloc 09:47:42.822 I Alloc concurrent copying GC freed 6(16KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 269MB/293MB, paused 99us total 54.765ms 09:47:42.822 I Forcing collection of SoftReferences for 512MB allocation 09:47:42.822 I Starting a blocking GC Alloc 09:47:43.071 I Alloc concurrent copying GC freed 37(17KB) AllocSpace objects, 0(0B) LOS objects, 8% free, 269MB/293MB, paused 87us total 249.032ms 09:47:43.072 W Throwing OutOfMemoryError "Failed to allocate a 536870924 byte allocation with 25165824 free bytes and 242MB until OOM, target footprint 307634552, growth limit 536870912" (VmSize 8222436 kB) 09:47:43.072 I Starting a blocking GC Alloc 09:47:43.072 I Starting a blocking GC Alloc

Contributor guide