Cannot disable preview


35 posts   Page 1 of 2   1, 2
by Svenn » Thu May 16, 2013 4:02 pm
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
Posts: 2
Joined: Thu May 16, 2013 3:52 pm
by tvjon » Thu May 16, 2013 6:10 pm
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 ~ $
Posts: 303
Joined: Mon Jan 07, 2013 9:11 am
by pluggy » Thu May 16, 2013 6:12 pm
try :

raspistill -t 0 -o image.jpg -hf
Don't judge Linux by the Pi.......
User avatar
Posts: 2605
Joined: Thu May 31, 2012 3:52 pm
Location: Barnoldswick, Lancashire,UK
by jamesh » Thu May 16, 2013 6:23 pm
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.
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by jamesh » Thu May 16, 2013 6:44 pm
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.
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by tvjon » Thu May 16, 2013 9:40 pm
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.
Posts: 303
Joined: Mon Jan 07, 2013 9:11 am
by MattHawkinsUK » Thu May 16, 2013 10:56 pm
I think it is line 984

Code: Select all
{
   MMAL_STATUS_T status;


to

Code: Select all
{
   MMAL_STATUS_T status = MMAL_SUCCESS;
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)
User avatar
Posts: 491
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
by leol » Fri May 17, 2013 6:54 am
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
User avatar
Posts: 110
Joined: Fri Jan 13, 2012 4:27 pm
Location: Reading, England
by jamesh » Fri May 17, 2013 8:05 am
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.
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by leol » Fri May 17, 2013 8:46 am
Seems to be line 1034 and in my copy it is:
Code: Select all
MMAL_STATUS_T status = -1;


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
User avatar
Posts: 110
Joined: Fri Jan 13, 2012 4:27 pm
Location: Reading, England
by jamesh » Fri May 17, 2013 9:05 am
leol wrote:Seems to be line 1034 and in my copy it is:
Code: Select all
MMAL_STATUS_T status = -1;


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.
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by m1m1 » Fri May 17, 2013 9:29 am
I have changed it from -1 to MMAL_SUCCESS, compiled fine on the Pi and works, thanks.
Posts: 6
Joined: Mon Jun 25, 2012 6:28 pm
by tvjon » Fri May 17, 2013 10:10 am
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? :)
Posts: 303
Joined: Mon Jan 07, 2013 9:11 am
by brendanwells » Fri May 17, 2013 11:19 am
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?
Posts: 2
Joined: Fri May 17, 2013 11:15 am
by m1m1 » Fri May 17, 2013 12:01 pm
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
Last edited by m1m1 on Fri May 17, 2013 6:39 pm, edited 2 times in total.
Posts: 6
Joined: Mon Jun 25, 2012 6:28 pm
by brendanwells » Fri May 17, 2013 1:29 pm
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?
Posts: 2
Joined: Fri May 17, 2013 11:15 am
by mikerr » Fri May 17, 2013 1:34 pm
That's for that guide, m1m1 - I had to also install cmake:

Code: Select all
sudo apt-get install cmake


and sudo'd your final line to

Code: Select all
sudo make install
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/
Got a Pi Camera? View it in my android app - Raspicam Remote ! No software required on the pi
User avatar
Posts: 1258
Joined: Thu Jan 12, 2012 12:46 pm
Location: NorthWest, UK
by Svenn » Fri May 17, 2013 3:15 pm
Thanks m1m1! That worked perfectly.
Posts: 2
Joined: Thu May 16, 2013 3:52 pm
by jamesh » Fri May 17, 2013 3:17 pm
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)
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by jamesh » Fri May 17, 2013 3:18 pm
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.
Soon to be employed engineer - Hurrah! Volunteer at the Raspberry Pi Foundation, helper at PiAcademy September 2014.
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 11926
Joined: Sat Jul 30, 2011 7:41 pm
by SN » Fri May 17, 2013 3:41 pm
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 -
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?
User avatar
Posts: 1008
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
by Chris_Reynolds » Fri May 17, 2013 4:01 pm
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.
Posts: 68
Joined: Mon May 14, 2012 7:25 am
by towolf » Fri May 17, 2013 4:34 pm
raspivid has the same problem, how does the fix for that one look?
Posts: 388
Joined: Fri Jan 18, 2013 2:11 pm
by quagga » Fri May 17, 2013 6:16 pm
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;
Posts: 5
Joined: Thu May 16, 2013 10:14 pm
by m1m1 » Fri May 17, 2013 6:32 pm
Thanks for the feedback, I've edited my post with your corrections.
Posts: 6
Joined: Mon Jun 25, 2012 6:28 pm