Javacv: FFMPEGFrameGrabber start does nothing after run continuously

Created on 16 Dec 2020  路  10Comments  路  Source: bytedeco/javacv

Hi, I've been using ffmpeg frame grabber to extract each frame from a video (loaded from external storage). Each frame will be preprocessed and sent into machine learning model, and yes this is a CPU intensive work. Currently I am trying to predict all the datatest, by running prediction continuously. I dont have any problem with phone other than Samsung (I've tried OPPO F1, MI note 8, redmi 9) which successfully ran 400-500 videos, but when I tried using Samsung phone, it would stuck on x-th attempt data (intermittent, lets say it's stuck at the 7th/8th video), at the grabber.start() line. The result from of each video processing will be emitted to the screen (this is an Observable function created using RxJava)

Here's the code snippet that will be run as mush as the amount of datatest video:

        try { 
        val grabber = FFmpegFrameGrabber(inputStream)
        hsv = Mat()
        skinMask = Mat()
        grabber.start() // <--- stuck here

        var idx = 1

        while (true) {
            /* 15 FPS, grabImage twice */
            val nthFrame = grabber.grabImage() ?: break
            grabber.grabImage() ?: break

            var mat = converterToMat.convertToOrgOpenCvCoreMat(nthFrame)

            mat = preprocessImageGetSkin(mat, cropSize, idx++)

            bmp = Bitmap.createBitmap(mat.cols(), mat.rows(), Bitmap.Config.ARGB_8888);
            Utils.matToBitmap(mat, bmp)

            outputData.add(mobileNetV2Classifier.recognize(bmp)[0])

            /* Clean Components */
            bmp.recycle()
            bmp = null
            mat.release()

        }


        grabber.stop()
        grabber.release()
    } catch (e: Exception) {
        // do nothing
    }`

What I've known so far:

  • It seems that the problem is not from the video, since the error is intermittent (sometimes stuck at 4th video, sometimes 8th, etc).
  • There're no error log produced, it just do nothing

Is it something that caused by samsung's custom rom?

details:

  • Smartphone: Samsung Galaxy S9+, Android 10
help wanted question

All 10 comments

  • There're no error log produced, it just do nothing

Make sure FFmpegLogCallback.set() has been called, with log level set to "debug" or "trace".

@saudet Thank you for the prompt reply.
I tried to call FFmpegLogCallback.set() and there're new log appeared, but there's only "Info" log even though I've set the log level to Debug (from the android logcat). Am i doing it the right way?

(ignore the printed number)

** Successfully extracted video log:

I/kom.kotlin.sib: Explicit concurrent copying GC freed 51789(2504KB) AllocSpace objects, 49(31MB) LOS objects, 49% free, 7660KB/14MB, paused 33us total 39.040ms
I/System.out: Filename : SIBI_20201204_092539.mp4
I/System.out: 1
2
3
W/System.err: Info: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'java.io.BufferedInputStream@2342dfa':
Info: Metadata:
Info: major_brand :
Info: mp42
Info:
Info: minor_version :
Info: 0
Info:
Info: compatible_brands:
Info: isommp42
Info:
Info: creation_time :
Info: 2020-12-04T02:25:48.000000Z
Info:
Info: com.android.version:
Info: 10
Info:
Info: Duration:
Info: 00:00:09.10
Info: , start:
Info: 0.000000
Info: , bitrate:
Info: 8763 kb/s
W/System.err: Info:
Info: Stream #0:0
Info: (eng)
Info: : Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s
Info: (default)
Info:
Info: Metadata:
Info: creation_time :
Info: 2020-12-04T02:25:48.000000Z
Info:
Info: handler_name :
Info: SoundHandle
Info:
Info: Stream #0:1
Info: (eng)
Info: : Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080, 8501 kb/s
Info: , SAR 1:1 DAR 16:9
Info: ,
Info: 29.99 fps,
Info: 90k tbr,
Info: 90k tbn,
Info: 180k tbc
Info: (default)
Info:
Info: Metadata:
Info: rotate :
Info: 90
Info:
Info: creation_time :
Info: 2020-12-04T02:25:48.000000Z
W/System.err: Info:
Info: handler_name :
Info: VideoHandle
Info:
Info: Side data:
Info:
Info: displaymatrix: rotation of -90.00 degrees
Info:
I/System.out: 4
W/System.err: Warning: [swscaler @ 0x7e1cd4ea80] No accelerated colorspace conversion found from yuv420p to bgr24.
I/System.out: Output : 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

** Failed version:
I/kom.kotlin.sib: Explicit concurrent copying GC freed 19443(1975KB) AllocSpace objects, 54(32MB) LOS objects, 49% free, 7592KB/14MB, paused 48us total 31.723ms
I/System.out: Filename : SIBI_20201204_092617.mp4
I/System.out: 1
2
3

The function to set the log for FFmpeg is av_log_set_level(), something like this:

av_log_set_level(AV_LOG_TRACE);

Hi @saudet, thank you for the help.
I've tried to set log level to TRACE and DEBUG. Still, there're no log produced during non-success grabber.start() called, and sorry I dont really understand the meaning of each log. Here's what I got from the log:

  • if grabber.start() successfully called, there'll be INFO log as I've sent on previous comment, and now there're DEBUG log.
  • While grabber starts grabbing each frame, there's a DEBUG log as shown below
  • To give you context, I printed number 1-4 to indicate succession of each code line.
println("1")
hsv = Mat()
println("2")
skinMask = Mat()
println("3")
grabber.start()
println("4")

(AV_LOG_TRACE)

I/System.out: Filename : SIBI_20201204_092502.mp4
I/System.out: 1
2
3
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] ISO: File Type Major Brand: mp42
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] Unknown dref type 0x206c7275 size 12
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] Unknown dref type 0x206c7275 size 12
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 30.000000 0.015737
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.970030 0.014980
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] Before avformat_find_stream_info() pos: 9942953 bytes read:13899 seeks:1 nb_streams:2
W/System.err: Debug: [h264 @ 0x7ed5bb8100] nal_unit_type: 7(SPS), nal_ref_idc: 3
Debug: [h264 @ 0x7ed5bb8100] nal_unit_type: 8(PPS), nal_ref_idc: 3
Debug: [h264 @ 0x7ed5bb8100] nal_unit_type: 5(IDR), nal_ref_idc: 3
Debug: [h264 @ 0x7ed5bb8100] Format yuv420p chosen by get_format().
Debug: [h264 @ 0x7ed5bb8100] Reinit context to 1920x1088, pix_fmt: yuv420p
W/System.err: Debug: [h264 @ 0x7ed5bb8100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
I/chatty: uid=10314(com.fasilkom.kotlin.sibi) RxComputationTh identical 4 lines
W/System.err: Debug: [h264 @ 0x7ed5bb8100] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] All info found
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.750000 0.018271
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.833333 0.017042
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.833333 0.017042
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.916667 0.016979
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.916667 0.016979
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 30.000000 0.018080
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 30.000000 0.018080
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.970030 0.017550
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] rfps: 29.970030 0.017550
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] After avformat_find_stream_info() pos: 1297418 bytes read:1279663 seeks:3 frames:32
Info: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'java.io.BufferedInputStream@e5c9254':
Info: Metadata:
Info: major_brand :
Info: mp42
Info:
Info: minor_version :
Info: 0
Info:
Info: compatible_brands:
Info: isommp42
W/System.err: Info:
Info: creation_time :
Info: 2020-12-04T02:25:11.000000Z
Info:
Info: com.android.version:
Info: 10
Info:
Info: Duration:
Info: 00:00:09.05
Info: , start:
Info: 0.000000
Info: , bitrate:
Info: 8791 kb/s
Info:
Info: Stream #0:0
Info: (eng)
Debug: , 1, 1/48000
Info: : Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 255 kb/s
Info: (default)
Info:
Info: Metadata:
Info: creation_time :
Info: 2020-12-04T02:25:11.000000Z
Info:
Info: handler_name :
Info: SoundHandle
Info:
Info: Stream #0:1
Info: (eng)
Debug: , 31, 1/90000
Info: : Video: h264 (Baseline), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m, left), 1920x1080 (1920x1088), 0/1, 8529 kb/s
Info: , SAR 1:1 DAR 16:9
Info: ,
Info: 30.06 fps,
Info: 90k tbr,
Info: 90k tbn,
Info: 180k tbc
Info: (default)
Info:
Info: Metadata:
Info: rotate :
W/System.err: Info: 90
Info:
Info: creation_time :
Info: 2020-12-04T02:25:11.000000Z
Info:
Info: handler_name :
Info: VideoHandle
Info:
Info: Side data:
Info:
Info: displaymatrix: rotation of -90.00 degrees
Info:
Debug: [h264 @ 0x7e302dc800] nal_unit_type: 7(SPS), nal_ref_idc: 3
Debug: [h264 @ 0x7e302dc800] nal_unit_type: 8(PPS), nal_ref_idc: 3
I/System.out: 4
W/System.err: Debug: [h264 @ 0x7e302dc800] nal_unit_type: 5(IDR), nal_ref_idc: 3
Debug: [h264 @ 0x7e302dc800] Format yuv420p chosen by get_format().
Debug: [h264 @ 0x7e302dc800] Reinit context to 1920x1088, pix_fmt: yuv420p
... // skipped duplicate lines
...
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 406, dts 8660688
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 407, dts 8700854
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 408, dts 8720979
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 409, dts 8741875
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 410, dts 8760188
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 411, dts 8782063
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 412, dts 8801396
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 413, dts 8820750
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 414, dts 8841625
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 415, dts 8861125
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 416, dts 8879938
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 417, dts 8899479
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 418, dts 8919229
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 0, sample 419, dts 8939521
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 245, dts 8162367
W/System.err: Debug: [h264 @ 0x7e2c987e00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 246, dts 8204467
W/System.err: Debug: [h264 @ 0x7e55998300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 247, dts 8227778
W/System.err: Debug: [h264 @ 0x7e55999c00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 248, dts 8265289
W/System.err: Debug: [h264 @ 0x7e2c986f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 249, dts 8300933
W/System.err: Debug: [h264 @ 0x7e2c987400] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 250, dts 8322922
W/System.err: Debug: [h264 @ 0x7e2c987900] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 251, dts 8361544
W/System.err: Debug: [h264 @ 0x7e2c987e00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 252, dts 8400922
W/System.err: Debug: [h264 @ 0x7e55998300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 253, dts 8425444
W/System.err: Debug: [h264 @ 0x7e55999c00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 254, dts 8455000
W/System.err: Debug: [h264 @ 0x7e2c986f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 255, dts 8495078
W/System.err: Debug: [h264 @ 0x7e2c987400] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 256, dts 8535722
W/System.err: Debug: [h264 @ 0x7e2c987900] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 257, dts 8567089
W/System.err: Debug: [h264 @ 0x7e2c987e00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 258, dts 8603933
W/System.err: Debug: [h264 @ 0x7e55998300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 259, dts 8625711
W/System.err: Debug: [h264 @ 0x7e55999c00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 260, dts 8660344
W/System.err: Debug: [h264 @ 0x7e2c986f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 261, dts 8705556
W/System.err: Debug: [h264 @ 0x7e2c987400] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 262, dts 8732733
W/System.err: Debug: [h264 @ 0x7e2c987900] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 263, dts 8759911
W/System.err: Debug: [h264 @ 0x7e2c987e00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 264, dts 8803311
W/System.err: Debug: [h264 @ 0x7e55998300] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 265, dts 8827778
W/System.err: Debug: [h264 @ 0x7e55999c00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 266, dts 8857333
W/System.err: Debug: [h264 @ 0x7e2c986f00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 267, dts 8890200
W/System.err: Debug: [h264 @ 0x7e2c987400] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 268, dts 8918344
W/System.err: Debug: [h264 @ 0x7e2c987900] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 269, dts 8950200
W/System.err: Debug: [h264 @ 0x7e2c987e00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 270, dts 8985189
W/System.err: Debug: [h264 @ 0x7e55998300] nal_unit_type: 5(IDR), nal_ref_idc: 3
W/System.err: Debug: [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ed5abbe00] stream 1, sample 271, dts 9016578
W/System.err: Debug: [h264 @ 0x7e55999c00] nal_unit_type: 1(Coded slice of a non-IDR picture), nal_ref_idc: 1
I/System.out: Output : 0 0 0 0 0 0 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
I/System.out: SIBI_20201204_092502.mp4 // next video
predicted label : 17
I/kom.kotlin.sib: Explicit concurrent copying GC freed 51975(2600KB) AllocSpace objects, 49(31MB) LOS objects, 49% free, 7653KB/14MB, paused 33us total 41.745ms
I/System.out: Filename : SIBI_20201204_092539.mp4
I/System.out: 1
2
3
// stuck here (grabber.start())

It looks like it might be waiting on the synchronized { } block here:
https://github.com/bytedeco/javacv/blob/master/src/main/java/org/bytedeco/javacv/FFmpegFrameGrabber.java#L806
That sounds like there's a bug in the VM of that device. You could try to call startUnsafe() instead.

Hi @saudet , so I've tried using start() and startUnsafe().
I also tried to put breakpoints to several line of the code as shown below.
The issue is at the startUnsafe() call. when I reached certain number of videos and tried to call the startUnsafe(), it do nothing (either by using start() or the startUnsafe() itself). It's stuck there (it didnt reach the last 2 breakpoints as if the function is not successfully called) and it can't progress

Screen Shot 2020-12-17 at 09 35 50

Which line in startUnsafe() exactly?

  1. I tried to use start() and startUnsafe() here. it stucks after this call -> [119] grabber.startUnsafe(), but when I change this line back to grabber.start() function here, it will stuck on 2nd picture (at the [649] this.startUnsafe(findStreamInfo) line)
    Screen Shot 2020-12-17 at 10 26 37

  2. stuck after[649] this.startUnsafe(findStreamInfo), I think the function is not successfully called because the 2 breakpoints inside startUnsafe function are not triggered.
    Screen Shot 2020-12-17 at 10 27 29

So the VM isn't even calling startUnsafe()? I'm not sure what you want me to do about that.
You'll probably need to report that issue to Google or Samsung to get it fixed...

You could try to modify the code in FFmpegFrameGrabber in random ways to see if there's a way to make it work?

yeah :(, thank you for helping me @saudet. I'll give u an update if I manage to make it work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fif10 picture fif10  路  3Comments

cansik picture cansik  路  4Comments

chenhl05 picture chenhl05  路  4Comments

kongqw picture kongqw  路  4Comments

RaGreen picture RaGreen  路  4Comments