Page 1 of 2
Cannot disable preview
Posted: Thu May 16, 2013 4:02 pm
by Svenn
I tired using the -n command as shown in the documentation but I cannot disable the preview. This is the command I am using:
Code: Select all
raspistill -t 2000 -o image.jpg -n
Which gives me this error:
Code: Select all
mmal: Unknown status error
mmal: main: Failed to connect camera to preview
mmal: Unknown status error
Segmentation fault
Re: Cannot disable preview
Posted: Thu May 16, 2013 6:10 pm
by tvjon
Same here. presumably that wasn't tested, as:
pi@raspberrypi ~ $ raspistill -n
mmal: Unknown status error
mmal: main: Failed to connect camera to preview
mmal: Unknown status error
Segmentation fault
pi@raspberrypi ~ $
Re: Cannot disable preview
Posted: Thu May 16, 2013 6:12 pm
by pluggy
try :
raspistill -t 0 -o image.jpg -hf
Re: Cannot disable preview
Posted: Thu May 16, 2013 6:23 pm
by jamesh
Weird. Dom reported something like that but everything worked fine for me, so I wasn't able to say what the problem was. If preview is disabled, IIRC it shouldn't even try to connect the camera to the preview component...I'll take another look.
Re: Cannot disable preview
Posted: Thu May 16, 2013 6:44 pm
by jamesh
Ah, think I've found an uninitialised variable which explains why some people see the problem and other don't
Can someone who is seeing this problem and can recompile, correct line 1016 in RaspiStill.c as follows
Code: Select all
MMAL_STATUS_T status = MMAL_SUCCESS;
and report back if it fixes the problem. Ta.
Re: Cannot disable preview
Posted: Thu May 16, 2013 9:40 pm
by tvjon
Line 1016 is the signal_handler function in the file I've downloaded.
Any pointers to the function where MMAL_STATUS_T status needs initialising?
It's init'd to -1 in main() for example.
Re: Cannot disable preview
Posted: Thu May 16, 2013 10:56 pm
by MattHawkinsUK
I think it is line 984
to
Code: Select all
{
MMAL_STATUS_T status = MMAL_SUCCESS;
Re: Cannot disable preview
Posted: Fri May 17, 2013 6:54 am
by leol
Did not work for me. I changed line 984. Got this warning on compiling:
Code: Select all
[ 95%] Building C object host_applications/linux/apps/raspicam/CMakeFiles/raspistill.dir/RaspiStill.c.o
/home/pi/work/userland/host_applications/linux/apps/raspicam/RaspiStill.c: In function âencoder_buffer_callbackâ:
/home/pi/work/userland/host_applications/linux/apps/raspicam/RaspiStill.c:549:33: warning: âstatusâ may be used uninitialized in this function [-Wuninitialized]
When running I got::
Code: Select all
pi@raspberrypi ~/work $ ./raspistill -n -v -o test.jpg
RaspiStill Camera App
=====================
Width 2592, Height 1944, quality 85, filename test.jpg
Time delay 5000, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Preview No, Full screen Yes
Preview window 0,0,1024,768
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 400, 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
Camera component done
Encoder component done
Starting component connection stage
mmal: Unknown status error
mmal: main: Failed to connect camera to preview
mmal: Unknown status error
Closing down
Segmentation fault
This was built on the Pi by the way.
Leo
Re: Cannot disable preview
Posted: Fri May 17, 2013 8:05 am
by jamesh
Sorry it should be line 1027 (almost the first line in the main () function).
I'd made the change before I did a git pull so my raspistill.c was slightly out of date from some changes DOm made.
Re: Cannot disable preview
Posted: Fri May 17, 2013 8:46 am
by leol
Seems to be line 1034 and in my copy it is:
I have changed the source but unfortunately my pi with the camera attached has crashed and I can't get to it until this evening. (I'm at work and Pi is at home!)
I'm getting these crashes quite a lot. Reading other threads I think it is a power issue. I will investigate this weekend.
Leo
Re: Cannot disable preview
Posted: Fri May 17, 2013 9:05 am
by jamesh
leol wrote:Seems to be line 1034 and in my copy it is:
I have changed the source but unfortunately my pi with the camera attached has crashed and I can't get to it until this evening. (I'm at work and Pi is at home!)
I'm getting these crashes quite a lot. Reading other threads I think it is a power issue. I will investigate this weekend.
Leo
Weird that it's got -1 and it's on a different line, that means my source tree is out of date, and yet is supposed to be the main dev tree....
-1 is certainly wrong.
Re: Cannot disable preview
Posted: Fri May 17, 2013 9:29 am
by m1m1
I have changed it from -1 to MMAL_SUCCESS, compiled fine on the Pi and works, thanks.
Re: Cannot disable preview
Posted: Fri May 17, 2013 10:10 am
by tvjon
Yes, that was the line I posted last night.
I'm slightly more awake now, & have just recompiled & confirm that does indeed work, no longer seg' faulting
I recompiled it on the Pi. I have yagarto on the mac, but have only used it for non-Pi ARM® code so far.
jamesh, thanks for the fix. Can you elaborate on your "unusual" cross compilation technique, or is it secret?

Re: Cannot disable preview
Posted: Fri May 17, 2013 11:19 am
by brendanwells
I have git pulled the code and altered the line in question;
1034 MMAL_STATUS_T status = MMAL_SUCCESS;
But cannot get it to make?
How are you guys re-compiling this?
Re: Cannot disable preview
Posted: Fri May 17, 2013 12:01 pm
by m1m1
Here is what worked for me (on the Pi, on Raspbmc):
Code: Select all
sudo apt-get install git gcc build-essential cmake
git clone git://github.com/raspberrypi/userland.git
cd userland
sed -i 's/if (DEFINED CMAKE_TOOLCHAIN_FILE)/if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)/g' makefiles/cmake/arm-linux.cmake
"sed -i 's/if (DEFINED CMAKE_TOOLCHAIN_FILE)/if (NOT DEFINED CMAKE_TOOLCHAIN_FILE)/g' makefiles/cmake/arm-linux.cmake"
is one command from double quote to double quote
Change line 1034 in host_applications/linux/apps/raspicam/RaspiStill.c to:
Code: Select all
MMAL_STATUS_T status = MMAL_SUCCESS;
then again in the userland dir:
Code: Select all
mkdir build
cd build
sudo cmake -DCMAKE_BUILD_TYPE=Release ..
sudo make
sudo make install
Re: Cannot disable preview
Posted: Fri May 17, 2013 1:29 pm
by brendanwells
You are a gentleman and a scholar, thankyou very much that worked great, well done to JamesH too for getting all this together! Will there be a fix in the repo's and for raspivid too?
Re: Cannot disable preview
Posted: Fri May 17, 2013 1:34 pm
by mikerr
That's for that guide, m1m1 - I had to also install cmake:
and sudo'd your final line to
all worked like a charm from then and now disabling preview works fine.
Get my ready fixed binary here if you trust me
Code: Select all
wget https://www.dropbox.com/s/cu3aviqktx7xru9/raspistill
sudo cp /opt/vc/bin/raspistill /opt/vc/bin/raspistill.orig
sudo cp raspistill /opt/vc/bin/
Re: Cannot disable preview
Posted: Fri May 17, 2013 3:15 pm
by Svenn
Thanks m1m1! That worked perfectly.
Re: Cannot disable preview
Posted: Fri May 17, 2013 3:17 pm
by jamesh
tvjon wrote:
jamesh, thanks for the fix. Can you elaborate on your "unusual" cross compilation technique, or is it secret?

Not that unusual, I set up Eclipse to do cross compilation using the Linaro tools from the github tools, then tweaked all the includes and libraries in Eclipse to use github userland. The Foundation doesn't work that way, so it 'unusual' to them, just not to me! Problem is it doesn't move from machine to machine well due to Eclipse not allowing relative paths for tool chains (as far as I can tell)
Re: Cannot disable preview
Posted: Fri May 17, 2013 3:18 pm
by jamesh
I posted the fix so Dom has it now - I also got another fix for the problem with the --help option but haven't had time to look at the image being flipped problem yet.
Not sure how long it takes Dom to push any changes to github. Not long.
Re: Cannot disable preview
Posted: Fri May 17, 2013 3:41 pm
by SN
for those not into recompilation, this little bodge works
a simple solution to the flickering on the screen (because -nopreview is broken) is to make the preview size very small and place it to the left and above the screen so only ONE pixel is updated on the console like so
/opt/vc/bin/raspistill -t 0 -w 1024 -h 768 -p -31,-23,32,24 -o -
Re: Cannot disable preview
Posted: Fri May 17, 2013 4:01 pm
by Chris_Reynolds
Thanks for the build instructions m1m1, they're not quite working for me and wondered if anyone can help.
I get a 'fatal error: interface/vcos/vcos.h: No such file or directory'
All the userland stuff is on my Pi under ~/userland including that vcos.h so I'm guessing that the compiler doesn't know to use ~/userland or /home/pi/userland as a place to start looking for include files. I've never built anything like this under Debian before (my makefile knowledge stopped in about 1992 and was for Microsoft C 5.1) so before I start randomly hacking stuff in is there an obvious thing I need to do or set?
Many thanks.
Re: Cannot disable preview
Posted: Fri May 17, 2013 4:34 pm
by towolf
raspivid has the same problem, how does the fix for that one look?
Re: Cannot disable preview
Posted: Fri May 17, 2013 6:16 pm
by quagga
towolf wrote:raspivid has the same problem, how does the fix for that one look?
Do as above, but
Change line 852 in host_applications/linux/apps/raspicam/RaspiVid.c to:
Code: Select all
MMAL_STATUS_T status = MMAL_SUCCESS;
Re: Cannot disable preview
Posted: Fri May 17, 2013 6:32 pm
by m1m1
Thanks for the feedback, I've edited my post with your corrections.