AllskyTeam / allsky

A Raspberry Pi operated Wireless Allsky Camera
MIT License
1.19k stars 180 forks source link

TimeLapse Not Created #449

Closed yzhzhang closed 3 years ago

yzhzhang commented 3 years ago

Hi all,

I am using the latest Allsky program downloaded recently; it works very well, saved all images from dusk to dawn in the $day folder, saved keogram and startrails, except that it doesn't create a timelapse in the next morning.

I am using a RasPi 3b+revision 1.3 (1Gb). I am using an off-market color fisheye camera. I rescaled images to 1419*1064 pixels, and each image is about 700kb in size. I save images every 2 minutes overnight, and roughly got 180 images.

The problem is: it does create a .mp4 file in the respective $day folder, but that .mp4 is like 0 bytes. Absolutely nothing. I have tried a suggestion in another post to change -vcodec libx264 in timelapse.sh into -vcodec libx264rgb, but still no luck. I also increased the GPU memory size from 128 to 256. Otherwise I didn't touch anywhere in the code. And yes the "Timelapse" in config.sh is set to true.

Any suggestions would be really appreciated!

Thanks, Yizhou

fuadramsey commented 3 years ago

What resolved that for me was increasing the swap file. I think I was running out of ram since I'm on a PiZeroW (512mb). After I did that it has been very reliable. I increased my swap size to 1gb.

https://pimylifeup.com/raspberry-pi-swap-file/

yzhzhang commented 3 years ago

What resolved that for me was increasing the swap file. I think I was running out of ram since I'm on a PiZeroW (512mb). After I did that it has been very reliable. I increased my swap size to 1gb.

https://pimylifeup.com/raspberry-pi-swap-file/

Thank you! It was 100mb and I changed it to 1024. I'll give it a go tonight!

swatty007 commented 3 years ago

If that does not help you can also try to set the TIMELAPSEWIDTH & TIMELAPSEHEIGHT to some smaller values. that solved the issue for me since the default values caused it to crash.

EricClaeys commented 3 years ago

yzhzhang, you don't need to wait until tomorrow morning to see if the timelapse is created after you increased swap. Do the following in a terminal window:

cd
scripts/timelapse.sh 20210825

or whatever date you want to use. Did the timelapse get created in version 0.7?

yzhzhang commented 3 years ago

yzhzhang, you don't need to wait until tomorrow morning to see if the timelapse is created after you increased swap. Do the following in a terminal window:

cd
scripts/timelapse.sh 20210825

or whatever date you want to use. Did the timelapse get created in version 0.7?

Thanks for the note!

Hmmm I tried that and I got the error below; Any idea what it means? Why I have "permission denied" problem and why does it trying to remove images? This is a new RasPi and only used for Allsky purpose; only installed Allsky program, nothing else.


pi@allsky:~ $ cd allsky pi@allsky:~/allsky $ scripts/timelapse.sh 20210825 timelapse.sh: Creating symlinks to generate timelapse rm: cannot remove '/home/pi/allsky/images/20210825/sequence/0142.jpg': Permission denied rm: cannot remove '/home/pi/allsky/images/20210825/sequence/0130.jpg': Permission denied ...... rm: cannot remove '/home/pi/allsky/images/20210825/sequence/0166.jpg': Permission denied rm: cannot remove '/home/pi/allsky/images/20210825/sequence/0051.jpg': Permission denied scripts/timelapse.sh: line 39: /home/pi/allsky/tmp/timelapseTMP.txt: Permission denied gawk: cmd. line:4: (FILENAME=- FNR=1) fatal: can't redirect to `/home/pi/allsky/tmp/timelapseTMP.txt' (Permission denied) ln: failed to create symbolic link '/home/pi/allsky/images/20210825/sequence/0001.jpg': File exists timelapse.sh: Created 181 links total

/home/pi/allsky/images/20210825/allsky-20210825.mp4: Permission denied

*** timelapse.sh: ERROR: ffmpeg failed with RET=1 Links in '/home/pi/allsky/images/20210825/sequence' left for debugging. Remove them when the problem is fixed.

EricClaeys commented 3 years ago

zhzhang, Somehow your permissions got hosed up. By any chance did you run timelapse.sh using "sudo"? You shouldn't. In a command window, do the following: cd ~/allsky ls -ld images images/* images/*/sequence tmp

everything should be "drwxr-xr-x X pi pi ..." which is mode 755, owned and grouped to pi. If they aren't you'll need to fix that and will probably need "sudo" for it.

timelapse.sh creates some temporary files and removes them if it was successful. If it got an ERROR it leaves the files for debugging. The next time timelapse.sh runs it tries to remove the temporary files (which are in /home/pi/allsky/images/DATE/sequence).

Eric

yzhzhang commented 3 years ago

zhzhang, Somehow your permissions got hosed up. By any chance did you run timelapse.sh using "sudo"? You shouldn't. In a command window, do the following: cd ~/allsky ls -ld images images/* images/*/sequence tmp

everything should be "drwxr-xr-x X pi pi ..." which is mode 755, owned and grouped to pi. If they aren't you'll need to fix that and will probably need "sudo" for it.

Thanks Eric! No I didn't use "sudo". I ran exactly as you typed, "scripts/timelapse.sh 20210825".

I just ran what you suggested and I got this: Looks everything is owned and grouped to "root" instead of "pi"? Is this a problem? I am very new to Pi and this, can you suggest how to fix? Thanks a lot!

Yizhou

Allsky

yzhzhang commented 3 years ago

everything should be "drwxr-xr-x X pi pi ..." which is mode 755, owned and grouped to pi. If they aren't you'll need to fix that and will probably need "sudo" for it.

Hmmm I changed everything you listed to pi:pi, but still got "permission denied" error when running a timelapse.sh. I noticed that the auto-generated daily folder is still created as root:root.... I suppose I installed this thing wrong? During install is there a place for me to specify owner/group? At this moment is there a fix or I need to delete everything and re-install?

Thanks, Yizhou

allsky2

EricClaeys commented 3 years ago

Yizhou, the permissions issue is definately a problem. The "allsky" software runs as pi, and since it doesn't have permissions to write, change, or delete anything, it's not going to work. I'd fix it the brute force method:

cd
sudo find . -print -exec chown pi
sudo find . -print -exec chgrp pi

I'm doing this from memory so you'll want to run "man find" to see if I have the arguments correct. Basically, it's finding all files and directories in ~/allsky and changing the owner and group to pi. If that STILL doesn't work I suggest deleting everything and reinstalling. Eric

yzhzhang commented 3 years ago

Yizhou, the permissions issue is definately a problem. The "allsky" software runs as pi, and since it doesn't have permissions to write, change, or delete anything, it's not going to work. I'd fix it the brute force method:

cd
sudo find . -print -exec chown pi
sudo find . -print -exec chgrp pi

I'm doing this from memory so you'll want to run "man find" to see if I have the arguments correct. Basically, it's finding all files and directories in ~/allsky and changing the owner and group to pi. If that STILL doesn't work I suggest deleting everything and reinstalling. Eric

Thank you Eric! I'll give it a try. My concern as I shown in post above is that the auto-generated daily folder in allsky/images are still under root:root; I am not sure if changing existing folder to pi:pi help with that.

I am very new to this; can you please advise what's the best/cleanest way to uninstall & re-install this, and install it with the correct ownership? Thanks a lot!

Yizhou

thomasjacquin commented 3 years ago

Hi @yzhzhang, During installation, the install.sh script looks for an environment variable logname. I have heard reports about this variable not being set properly on some Raspberry Pis that got installed using NOOBS. Before you run the install.sh script, type logname in a terminal and check what it says. It is important that it says pi and not root because the script will use that name to install everything, including the allsky service. As a temporary workaround (to save you from reinstalling), try this:

cd /home/pi/
sudo chown -R pi:pi allsky

This should set the ownership recursively in the allsky directory.

yzhzhang commented 3 years ago

Thanks Thomas. I don't know if this makes sense, but I added a sentence "sudo chown pi:pi ${DIR} ${DIR}/*" in GenerateForDay.sh, and now it works and save timelapse videos! Thanks all for the help!

Yizhou

EricClaeys commented 3 years ago

Thomas, FYI, the install.sh script uses the output of the lognamecommand, it doesn't look for an environment variable logname. I assume it uses lognamein case someone is running the install script under a different user than "pi"? If we assume users shouldn't run it under root, should install.sh check if $(logname) = "root", and if so, display an error message and exit? That will resolve the case where logname is "root", but won't resolve the problem is logname is a bogus value.

thomasjacquin commented 3 years ago

Yes @EricClaeys you're right, this is a command. I am using logname because I ported the code so that it can run on any linux computer. I have tested it on my Ubuntu laptop and it works with no issues. I don't remember if I fully ported the GUI but I think it was working as well. Maybe we should exit the install if logname == root. That would be an early catch and save users a headache later.

EricClaeys commented 3 years ago

How’s this look?

It tries to workaround the issue if possible.

I tested it by changing the check for “root” to a check for “pi”, then adding an “exit” at line 65 before the actual work begins.

It would probably be good to test while logged in as “root” as well. Doing an “su -l root” doesn’t work since ‘logname’ still returns ‘pi’ although $LOGNAME returns ‘root’.

Eric

From: Thomas Jacquin @.> Sent: Tuesday, August 31, 2021 12:11 PM To: thomasjacquin/allsky @.> Cc: EricClaeys @.>; Mention @.> Subject: Re: [thomasjacquin/allsky] TimeLapse Not Created (#449)

Yes @EricClaeys https://github.com/EricClaeys you're right, this is a command. I am using logname because I ported the code so that it can run on any linux computer. I have tested it on my Ubuntu laptop and it works with no issues. I don't remember if I fully ported the GUI but I think it was working as well. Maybe we should exit the install if logname == root. That would be an early catch and save users a headache later.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thomasjacquin/allsky/issues/449#issuecomment-909425756 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AT2PYK4R45BW5SKDFWQZJB3T7UELPANCNFSM5C322XBA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AT2PYKZ6IUBR3NHWBXQ7UC3T7UELPA5CNFSM5C322XBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOGY2LYXA.gif

EricClaeys commented 3 years ago

Here's a draft of the allsky/install.sh script. Apparently you can't send them via email.

install.zip

EricClaeys commented 3 years ago

Closing since @yzhzhang's issue was resolved.