Skip to content

Slow FPS and no effect by transcode on Raspberry Pi #347

@yakir12

Description

@yakir12

I'm measuring FPS of Raspberry Pi Camera Module 2 NoIR on a Raspberry Pi 4. Due to issue #346 I'm using VideoIO.jl v0.9.5. This is Julia v1.7.2.

I'm seeing surprisingly low FPS (~7 FPS) as well as no effect by setting transcode = false.

Since the frame pipeline has a buffer which can return a buffered frame much faster than retrieving a new one from the CCD, it is necessary to either "flush" the buffer before timing (any ideas on how to do that?), or simply filter out the unrealistically high FPS (which is what I did here).
I think I managed to achieve this with:

using VideoIO, UnicodePlots

function benchmark(cam)
    img = read(cam)
    t = zeros(100)
    for i in eachindex(t)
        read!(cam, img)
        t[i] = Base.time()
    end
    fps = 1 ./ diff(t)
    filter!(<(50), fps) # filter out all the unrealisticly high FPSs
    println(histogram(fps))
end

for transcode in (true, false)
    cam = opencamera(; transcode)
    println("Transcode: ", transcode)
    benchmark(cam)
    close(cam)
end

The results are:

Transcode: true
                ┌                                        ┐ 
   [ 6.0,  7.0) ┤████████████████████████████████████  94  
   [ 7.0,  8.0) ┤█▎ 3                                      
   [ 8.0,  9.0) ┤  0                                       
   [ 9.0, 10.0) ┤  0                                       
   [10.0, 11.0) ┤  0                                       
   [11.0, 12.0) ┤▍ 1                                       
                └                                        ┘ 
                                 Frequency                 
Transcode: false
                ┌                                        ┐ 
   [ 5.0, 10.0) ┤████████████████████████████████████  98  
   [10.0, 15.0) ┤  0                                       
   [15.0, 20.0) ┤  0                                       
   [20.0, 25.0) ┤  0                                       
   [25.0, 30.0) ┤  0                                       
   [30.0, 35.0) ┤  0                                       
   [35.0, 40.0) ┤▍ 1                                       
                └                                        ┘ 
                                 Frequency                 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions