SnowLeopard
Posts: 106
Joined: Sun Aug 18, 2013 6:10 am

raspivid 2GB size limit

Thu Oct 24, 2013 5:20 pm

I ran into the 2GB file size limit when recording a melting ice cube a couple weeks ago.
I just ran a test with the latest version to confirm that raspivid has a problem recording over 2GB:
[email protected] ~/work $ raspivid -v -n -t 100000000 -b 25000000 -o size-test.h264

raspivid Camera App v1.3.4

Width 1920, Height 1080, filename size-test.h264
bitrate 25000000, framerate 30, time delay 100000000
H264 Profile high
Wait method : Simple capture
Initial state 'record'


Preview No, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
Camera component done
Encoder component done
Starting component connection stage
Connecting camera stills port to encoder input port
Opening output file "size-test.h264"
Enabling encoder output port
Starting video capture
mmal: Failed to write buffer data (8191 from 27709)- aborting
mmal: Failed to write buffer data (4096 from 65536)- aborting
mmal: Failed to write buffer data (4096 from 28655)- aborting
mmal: Failed to write buffer data (4096 from 65536)- aborting
Finished capture
Closing down
mmal: Failed to write buffer data (4096 from 43772)- aborting
Close down completed, all components disconnected, disabled and destroyed

[email protected] ~/work $ ls -l size-test.h264
-rw-r--r-- 1 pi pi 2147483647 Oct 24 13:12 size-test.h264
[email protected] ~/work $
I had tried adding the defines mentioned in an old thread somewhere for large file support, but when compiling I got warnings about already defined.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22725
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid 2GB size limit

Thu Oct 24, 2013 6:24 pm

Odd, that was fixed ages ago.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

SnowLeopard
Posts: 106
Joined: Sun Aug 18, 2013 6:10 am

Re: raspivid 2GB size limit

Fri Oct 25, 2013 12:00 am

-D_FILE_OFFSET_BITS=64 is missing. I tried adding it and the new build wrote 2.6gb in about 20 minutes.
I put the change in the main CMakeLists.txt with the LARGEFILE_SOURCE defines and I did my first git pull request to submit the fix. :)

Code: Select all

[email protected] ~/work/userland-bug_fixes $ diff -u CMakeLists.txt.orig CMakeLists.txt
--- CMakeLists.txt.orig 2013-10-24 19:05:23.502029050 -0400
+++ CMakeLists.txt      2013-10-24 19:02:36.525742187 -0400
@@ -41,7 +41,7 @@
 add_definitions(-DUSE_VCHIQ_ARM -DVCHI_BULK_ALIGN=1 -DVCHI_BULK_GRANULARITY=1)
 add_definitions(-DOMX_SKIP64BIT)
 add_definitions(-DEGL_SERVER_DISPMANX)
-add_definitions(-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE)
+add_definitions(-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64)

 # do we actually need this?
 add_definitions(-D__VIDEOCORE4__)

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22725
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid 2GB size limit

Fri Oct 25, 2013 8:35 am

Hmm. It is odd, I asked Dom to sort that about 6 months ago and I thought it had been done. Must have lost the settings at some point.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22725
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid 2GB size limit

Fri Oct 25, 2013 8:35 am

Hmm. It is odd, I asked Dom to sort that about 6 months ago and I thought it had been done. Must have lost the settings at some point.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

SnowLeopard
Posts: 106
Joined: Sun Aug 18, 2013 6:10 am

Re: raspivid 2GB size limit

Fri Oct 25, 2013 3:58 pm

jamesh wrote:Hmm. It is odd, I asked Dom to sort that about 6 months ago and I thought it had been done. Must have lost the settings at some point.
Uhhh... my pull request was accepted and applied to the "next" branch, and I can see the updated CMakelists.txt, but I'm not sure that branch is of any use. (This branch is 3 commits ahead and 93 commits behind master)
First time I used github and I just followed the instructions that appeared on screen... guess it wasn't the right way.

EDIT: Resubmitted the change and looks like it will go on master branch properly this time.
EDIT-2: Change accepted and shows up on master branch.

dqpi
Posts: 33
Joined: Fri May 24, 2013 12:22 pm

Re: raspivid 2GB size limit

Sun Nov 10, 2013 2:33 pm

I was trying to record a 10 hour video using raspivid but it stopped at 2 GB. The first and only relevant Google hit lead me to this post. I've been struggling a bit with it but don't know how to use it.
Can you point me in the right direction?

Thanks in advance,

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22725
Joined: Sat Jul 30, 2011 7:41 pm

Re: raspivid 2GB size limit

Sun Nov 10, 2013 4:37 pm

You can get the latest course code from the raspberry pi userland github. If that doesnt make any sense you'll need to research it a bit.

This should enable larger files. BUt, you can reduce files size for very long recordings by decreasing the bit rate and/or decreasing resolution.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

dqpi
Posts: 33
Joined: Fri May 24, 2013 12:22 pm

Re: raspivid 2GB size limit

Sun Nov 10, 2013 6:09 pm

great, thanks that worked!

Return to “Camera board”