jacksonliam / mjpg-streamer

Fork of http://sourceforge.net/projects/mjpg-streamer/
3.04k stars 1.23k forks source link

Maximum output_file size of 2GB? #142

Open formidable01 opened 6 years ago

formidable01 commented 6 years ago

I am running mjpg-streamer with three plugins active on my RPi. The command line is:

mjpg_streamer -i input_raspicam.so -x 1280 -y 720 -ISO 25 -sh 75 -co 100 -br 70 -quality 10 -framerate 10 -cs ${this.cameraID} -o output_ws.so -p ${this.wsPort} -o output_file.so -f /home/stir/videos -m video.${this.cameraID}.${d}.mjpeg -ooutput_http.so -w /home/pi/www${this.cameraID} -p ${this.httpPort}`

I'm doing a lot of stuff streaming to a web socket, collecting images to a file and streaming to a HTTP port so I can easily capture stills. And it all works great. But I recently noticed that the MJPEG output_file collection stops at around 2GB. I looked at the code and can't see any obvious reason for that. It does align closely with the RAM size of the RPi. Am I exceeding the max_frame_size? Is there a way to work-around this?

formidable01 commented 6 years ago

This appears to be 32 bit Linux LFS issue. The make flow should be modified to use the following gcc compile switch -D_FILE_OFFSET_BITS=64 when building on RPi (for instance)

jacksonliam commented 6 years ago

Ahh yes, great investigation, thanks!

I think this can be also fixed with a #define in the source file.

formidable01 commented 6 years ago

I found that in addition to the compile switch -D_FILE_OFFSET_BITS=64, these also need to be defined -D_LARGEFILE_SOURCE and -D_LARGEFILE64_SOURCE I tested the rebuilt plugin and it successfully generates file >2GB

jacksonliam commented 6 years ago

Thanks, I'll leave this issue open until I get a chance to fix it in the source!

CarlosGS commented 6 years ago

Hi! Where should we put the mentioned flags?

chris-pws commented 6 years ago

Hi Carlos,

You should be able to use the compile switch flags mentioned in this thread by using the advanced compilation instructions using cmake:

https://github.com/jacksonliam/mjpg-streamer#advanced-compilation-via-cmake

On 21 July 2018 at 10:50, Carlos Garcia Saura notifications@github.com wrote:

Hi! Where should we put the mentioned flags?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/jacksonliam/mjpg-streamer/issues/142#issuecomment-406801552, or mute the thread https://github.com/notifications/unsubscribe-auth/ACvnCbHunOA3ENThxz2JzQnIWdnJB-arks5uIz_RgaJpZM4UjR8Y .

CarlosGS commented 6 years ago

Ahh, thats it!! Thank you for the clarification :-)

paulhayes commented 4 years ago

I've had the same issue, so thought I'd follow the advice given above, but without any success.

I tried running cmake with the following flags:

cmake -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 ..

I've also tried adding the following to CMakeLists.txt

add_definitions(-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)

Both methods successfully built, but when testing I still get the error while recording to disk write(): File too large

Does anyone know what I'm doing wrong?

EDIT

Solved!

I fixed this by putting the definitions in the main CMakeLists.txt not the output_file plugin CMake file.