dtic
Posts: 9
Joined: Fri May 10, 2013 7:45 pm

raspistill timelapse after disconnecting network cable

Tue May 28, 2013 6:03 am

I log into the raspi (with up to date wheezy-raspbian) over a wired network using SSH and then run this command:

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000
That should take one photo every 30 second for 6 hours in a row. I then remove the network cable. Result after 6 hours: only 257 saved images ( a0001.jpg ... a0257.jpg ). Why? Does the command time out after ~2 hours if the connection is severed in this way?

(No, I can't keep the network cable connected, because it would get in the way of things given the location of the raspi. Yes, I know I could get a wifi dongle and keep the connection. But I don't have one right now. Yes, I know I could create some kind of cronjob code. But I'd like to use the simpler command above if possible.)

Brickart
Posts: 6
Joined: Fri Aug 03, 2012 5:58 am
Location: Germany / Osnabrück

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 6:25 am

I didn't used the time lapse from raspistill but a small python script. Here, I had the same problem: When I closed the connection, the script stopped. My solution was: putting the job into the background.

So try

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000 &
Edit
Remember: raspistill is buggy and produces mirror images. You have to flip your images.

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000 -hf &
Last edited by Brickart on Tue May 28, 2013 6:35 am, edited 1 time in total.

User avatar
RaTTuS
Posts: 10539
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 6:27 am

screen would help or cron
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 6:50 am

Brickart wrote: Edit
Remember: raspistill is buggy and produces mirror images. You have to flip your images.

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000 -hf &
...no longer true as of the version of 27/5/2013

Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

dtic
Posts: 9
Joined: Fri May 10, 2013 7:45 pm

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 7:04 am

Brickart wrote:My solution was: putting the job into the background.
So try

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000 &
Thanks. I will try that. But, out of pure curiousity, can anyone tell why the process worked for ~2 hours before ending? I didn't connect to the raspi during that time and hadn't intentionally set any other processes to start.

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

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 7:12 am

texy wrote:
Brickart wrote: Edit
Remember: raspistill is buggy and produces mirror images. You have to flip your images.

Code: Select all

raspistill -o a%04d.jpg -t 21600000 -tl 30000 -hf &
...no longer true as of the version of 27/5/2013

Texy
And its was the firmware that was buggy (well, had an incorrect setting rather than buggy), not raspistill....
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

JiriH
Posts: 9
Joined: Sun May 26, 2013 2:07 pm

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 7:20 am

You have to use nohup command, because when ssh session timedout, it will terminate commands that you run over ssh

Code: Select all

nohup raspistill -o a%04d.jpg -t 21600000 -tl 30000 > /dev/null 2>&1 &
That will work after ssh sesion will expire

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

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 7:23 am

JiriH wrote:You have to use nohup command, because when ssh session timedout, it will terminate commands that you run over ssh

Code: Select all

nohup raspistill -o a%04d.jpg -t 21600000 -tl 30000 > /dev/null 2>&1 &
That will work after ssh sesion will expire
There's always a new Linux command to learn!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

Brickart
Posts: 6
Joined: Fri Aug 03, 2012 5:58 am
Location: Germany / Osnabrück

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 8:04 am

JiriH wrote:You have to use nohup command, because when ssh session timedout, it will terminate commands that you run over ssh
It worked without nohup for me - strange... The next time I use this command also: It is never too late to learn!
jamesh wrote: And its was the firmware that was buggy (well, had an incorrect setting rather than buggy), not raspistill....
From the point of view of the user, it was raspistill: It has not done what was expected. But good to hear, the bug has been removed - whereever it was. How can I get the bug-fix? Yesterday evening I had done an apt-get upgrade, but I still received a mirrored picture.

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

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 8:32 am

Brickart wrote:
JiriH wrote:You have to use nohup command, because when ssh session timedout, it will terminate commands that you run over ssh
It worked without nohup for me - strange... The next time I use this command also: It is never too late to learn!
jamesh wrote: And its was the firmware that was buggy (well, had an incorrect setting rather than buggy), not raspistill....
From the point of view of the user, it was raspistill: It has not done what was expected. But good to hear, the bug has been removed - whereever it was. How can I get the bug-fix? Yesterday evening I had done an apt-get upgrade, but I still received a mirrored picture.
I'd still say it wasn't really a bug - just a flag set the opposite to what might be expected. But hey ho. Anyway, update then upgrade should get you the new firmware I think.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 9:07 am

If the raspistill and raspivid can be updated by apt-get upgrade, then it stands to reason that those applications are part of a package.
What is the package called?
This brings me back to an earlier question of installing the camera applications without a full apt-get upgrade.
I undestand that a

Code: Select all

sudo apt-get update && sudo apt-get install [insert package name here]
will install the package if its not already installed, and also upgrade it to the latest version if it is.
Texy
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

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

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 9:12 am

texy wrote:If the raspistill and raspivid can be updated by apt-get upgrade, then it stands to reason that those applications are part of a package.
What is the package called?
This brings me back to an earlier question of installing the camera applications without a full apt-get upgrade.
I undestand that a

Code: Select all

sudo apt-get update && sudo apt-get install [insert package name here]
will install the package if its not already installed, and also upgrade it to the latest version if it is.
Texy
Dunno! I'll ask Dom.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

texy
Forum Moderator
Forum Moderator
Posts: 5161
Joined: Sat Mar 03, 2012 10:59 am
Location: Berkshire, England

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 9:21 am

I'm not in front of a Pi at the moment, but

Code: Select all

dpkg --get-selections
will list all currently installed packages - so google tells me ;)
That may give a clue...........

T.
Various male/female 40- and 26-way GPIO header for sale here ( IDEAL FOR YOUR PiZero ):
https://www.raspberrypi.org/forums/viewtopic.php?f=93&t=147682#p971555

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

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 10:09 am

sudo apt-get update && sudo apt-get install raspberrypi*

Should install new firmware and Dom thinks the camera apps as well.

But for the bleeding edge stuff (day to day), you'll need to rpi-update or grab the source and recompile it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

jarrah31
Posts: 125
Joined: Wed Oct 10, 2012 10:16 am

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 11:12 am

Is there a way to be notified of these new camera module firmware updates, such as via a sticky perhaps on the CSI Camera Module page please? At the moment you just have to be lucky to spot that an improved version is out within another unrelated thread. :)

Thanks.

peewee2
Posts: 61
Joined: Sun Apr 14, 2013 7:04 pm

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 5:54 pm

our prototype mars rover uses the raspi cam for navigation, it detects obstacles using the cam.

This morning we were testing it on the roof of the science block, things were going well until it reached the roof edge, on detecting the roof edge, it promptly turned right and plunged 200 feet to the ground below where it crashed on the the roof of the principle's car. The principle is pretty angry and has banned all further raspi development.

Could this be because the mmal code has been changed so that images are now no longer mirrored?

where's my rottweiler lawyer :-)

dtic
Posts: 9
Joined: Fri May 10, 2013 7:45 pm

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 7:50 pm

Brickart wrote:
JiriH wrote:You have to use nohup command, because when ssh session timedout, it will terminate commands that you run over ssh
It worked without nohup for me - strange... The next time I use this command also: It is never too late to learn!
Adding & at the end as Brickart first suggested worked in my 6 hour timelapse photo run too.

maddogdave
Posts: 46
Joined: Sat Dec 17, 2011 6:05 pm
Location: Berkshire England

Re: raspistill timelapse after disconnecting network cable

Tue May 28, 2013 11:55 pm

Thanks JiriH for the nohup tip. I was looking for a simple solution to leaving a time lapse running after logging in via ssh without having to write / run a script. For those that are interested I'm running the camera on a battery powered model A with just an Edimax wifi dongle plugged in. To enable the camera I'm using an iPhone (forgive me) to create a wifi hotspot and then using vssh lite to log in to the Pi and run the command to start the time lapse. It can now run its duration after I've disconnected. There are probably lots of ways to achieve a similar result but this one worked for me easily.
Dave

User avatar
HopWorks
Posts: 60
Joined: Mon Aug 05, 2013 9:52 pm

Re: raspistill timelapse after disconnecting network cable

Sun Aug 25, 2013 12:21 am

I little bit dated thread, but I have tried nohup and it just hangs. I reboot, login with putty from my laptop, run a raspistill from the CLI and it works just fine.

I go to my webmin (sorry... raspbian, lamp server, with webmin and samba) and try it with a cron job and not only does it NOT work, but when I putty and try again, it hangs. I tried killing, and terminating the raspistill process from webmin and rinsed/repeat. No go.

I reboot and I can CLI raspistill again, but I am still not sure what is going on here. As others have said, if the program is single use only, why does it hang instead of exiting quickly with an error? OK, it does that, but with misleading info about how my GPU doesn't have enough memory, etc. I don't even USE my GPU and have it set for ZERO memory allocated.

I apologize sincerely for my linux ignorance, if that is the cause. If it isn't, I hope it is fixed soon.

Thank you for your time!

EDIT: I just tried raspistill again and got...

Code: Select all

[email protected]:/var/www/cam# raspistill -o cron%06d.jpg
tvservice-client: Failed to connect to TV service: -1
WHAT??

User avatar
jbeale
Posts: 3581
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: raspistill timelapse after disconnecting network cable

Mon Aug 26, 2013 10:37 pm

HopWorks wrote:I reboot and I can CLI raspistill again, but I am still not sure what is going on here. As others have said, if the program is single use only, why does it hang instead of exiting quickly with an error? OK, it does that, but with misleading info about how my GPU doesn't have enough memory, etc. I don't even USE my GPU and have it set for ZERO memory allocated.
The GPU in the RasPi does many things, not just display graphics. In this SOC design the GPU is actually the "main" control block, the ARM CPU is sort of an accessory to it. In particular, the GPU runs the RPi camera, and if the GPU is not allocated enough memory, it will not work.

User avatar
HopWorks
Posts: 60
Joined: Mon Aug 05, 2013 9:52 pm

Re: raspistill timelapse after disconnecting network cable

Mon Aug 26, 2013 11:29 pm

jbeale wrote:
HopWorks wrote:I reboot and I can CLI raspistill again, but I am still not sure what is going on here. As others have said, if the program is single use only, why does it hang instead of exiting quickly with an error? OK, it does that, but with misleading info about how my GPU doesn't have enough memory, etc. I don't even USE my GPU and have it set for ZERO memory allocated.
The GPU in the RasPi does many things, not just display graphics. In this SOC design the GPU is actually the "main" control block, the ARM CPU is sort of an accessory to it. In particular, the GPU runs the RPi camera, and if the GPU is not allocated enough memory, it will not work.
This confuses me because when I went to raspi-config, I entered ZERO for the GPU. And although in webmin I do not see a full 512mb allocated, I figured it was just decimal used for the calculation of memory, as hard drive suppliers do.

So either the config app that configures the RPi has a fail safe that hard codes a floor to the GPU memory footprint to save me from myself, or my experience with raspistill is working for me without use of the GPU. That makes a little sense, since I haven't tried to encode any other file type.

But reading what you said, my raspistill shouldn't work with my GPU allocation at zero and it does. So should I consider that running another process using raspistill is dependent on the GPU memory allocation? So if I set it at say, 128mb, I can run multiple processes on raspistill and have it work? Everything I read about raspistill has told me that if I have it in another process, I would expect my RPi to either 'hang' or give erroneous errors like the one I saw about the GPU memory.

I will run the config and change the allocated memory to the GPU and see if that changes my outcome. I hope you're right because that solves my issue. Thank You!

User avatar
HopWorks
Posts: 60
Joined: Mon Aug 05, 2013 9:52 pm

Re: raspistill timelapse after disconnecting network cable

Mon Aug 26, 2013 11:47 pm

Well OK! I took a raspistill from Webmin's command shell feature and it worked. I went back to my putty and it worked also. So that is the trick I guess, making sure you have some memory allocated to the GPU.

So moving forward, my WEBMIN now shows less memory available. It didn't with refreshes earlier, but now the reported memory available makes sense.

So if you do not mind me asking, how much should I safely allocate to the GPU to allow say three instances of raspistill's without hanging? How can I find out how much each instance/process takes up? I guess I better figure this out because I wanted to try to run multiple cameras on the same RPi through logic channeling.

Thank you sir for your time!!!

User avatar
HopWorks
Posts: 60
Joined: Mon Aug 05, 2013 9:52 pm

Re: raspistill timelapse after disconnecting network cable

Mon Aug 26, 2013 11:58 pm

This interesting. I didn't even run raspistill yet via putty or otherwise after a reboot. And when I tried it with a cron job? I got

Code: Select all

mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
mmal: camera component couldn't be enabled
mmal: main: Failed to create camera component
mmal: Only 32M of gpu_mem is configured. Try running "sudo raspi-config" and ensure that "memory_split" has a value of 128 or greater
I will try it again with 128 allocated. I turned it down to 32mb to see if I could do more than one process of raspistill.

User avatar
HopWorks
Posts: 60
Joined: Mon Aug 05, 2013 9:52 pm

Re: raspistill timelapse after disconnecting network cable

Tue Aug 27, 2013 12:07 am

This time all I got was "no output generated" from webmin's scheduled cronjob. It most likely is user error on my part, but it is a different output than what I got before I set the GPU to 128mb. I did the SAME command via CLI on putty and it worked.

I will have to play with it, and I am sorry if my noobness targeted another possible cause for this issue. I saw so many other people complaining about the same thing and figured that multiple raspistill processes was throwing the bug and I rushed to confirm it. Now that I know more about the usage of the GPU in this system, I get it (albeit a very little) and will work around it.

Thank you so much AGAIN for your time!!!

Hop

Return to “Camera board”