|
Post by leviw on Mar 10, 2017 14:51:54 GMT -7
I just configured our video system to begin streaming when it starts up. This eliminates the need to log into the pi using putty. It creates a new video file in year-month-date-hour-minute format so you can run it several times without overwriting any files. Here are the steps if you want to do this too: - Connect to the pi using putty
- sudo nano /etc/rc.local
- mkdir /home/pi/videos
- Add this near the bottom, but before exit 0:
# Run the streaming program DATE=$(date +"%Y-%m-%d-%H%M")
su pi -c "raspivid -t 0 -h 800 -w 1280 -fps 22 -vf -hf -b 2000000 -n -o - | tee -a /home/pi/videos/$DATE.h264 | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8080/}' -vvv :demux=h264"
That's it. The rc.local file runs when the pi starts up and you should see your camera turn on. (by the way, that light can be disabled) The files are stored in /home/pi/videos/, which is just videos/ when you log in with putty.
Now you can turn on the payload, wait a minute or two for the system to start up and the ubiquity modems to connect, then open VLC and the video stream as normal. Also, when you lose connection to the payload, the video will continue recording onto the SD card.
Change the resultion and other parameters to suite. We've been experimenting with different resolutions and frame rates to try to increase our range and picture quality.
As always, I suggest testing for yourself before trusting it to a flight. But this works well for us.
|
|
|
Post by njordan on Mar 22, 2017 17:58:14 GMT -7
Can you include a screenshot
|
|
|
Post by swidmier on Mar 29, 2017 18:56:47 GMT -7
We attempted to use this configuration with our payload tonight and we were unable to successfully connect using VLC. We are unable to find the saved stream in the file system, either. I believe we correctly implemented the configuration, so I'm not sure what went wrong.
|
|
|
Post by leviw on Mar 31, 2017 14:17:30 GMT -7
Here is a screenshot of our /etc/rc.local file. Make sure you create the /home/pi/videos folder first as it just tries to put the file in there, it won't make the directory for you. (That may have been the problem.) This allows us to turn on the payload, wait about ~60 seconds for it to boot up and begin streaming (watch for the red light on the camera) and then we can open VLC and open the network stream as usual. We don't need to use putty at all unless we want to tell it to shut down. I'd like to say we always do that, but.. we usually just unplug it. We're working on adding a button and script to gracefully shut down without requiring putty. The date on our pi is severely wrong, hm. Let me know if it works, or does not work, for you. Attachments:
|
|
|
Post by CofC_HighBall on Apr 2, 2017 11:13:07 GMT -7
Can confirm results! We have turn start streaming now with supplied code. Thank you, good stuff! As mentioned, once it starts it cannot be stopped unless with a hard reset.
|
|
|
Post by Sean Curry on Apr 14, 2017 8:23:03 GMT -7
Thanks for posting this. We tried it yesterday, and it worked - video capture started automatically. However, we couldn't connect with VLC until we started Putty. We didn't need to actually login - just connect with a Putty session. It's as if the IP address for VLC didn't become known until Putty connected. Any ideas?
Thanks,
Sean Oregon Tornadoes
|
|
|
Post by leviw on Apr 14, 2017 11:00:29 GMT -7
Hm, the video stream should be available without needing putty. How long was the payload on before you attempted to connect with VLC? Is it possible that either the pi or ubiquity modems were still starting up on the first attempt with VLC, but had finished by the time you tried connecting with putty?
If it happens again, you might try opening a windows command prompt and pinging the payload's IP, just to see if it's up and the ubiquity connection is ready.
|
|
|
Post by Sean Curry on Apr 14, 2017 19:56:00 GMT -7
Good suggestions. We'll try waiting longer to start VLC, plus will check with Ping.
Thanks,
Sean Oregon Tornadoes
|
|
|
Post by leviw on Apr 15, 2017 7:22:33 GMT -7
By the way, I think I remember reading that you're in Medford? Our team is from Corvallis Oregon. We'll be doing a practice launch next weekend and you're welcome to come visit any time. We're happy to share what we know, and learn from other teams.
|
|
|
Post by David MSGC on Apr 15, 2017 16:54:45 GMT -7
Just an FYI, the "new" .iso for the video system will have the video stream start automatically and an httpd dameon will be implemented to stop and restart video and some other functions such as shutdown etc.
|
|
|
Post by Sean Curry on Apr 17, 2017 12:23:24 GMT -7
By the way, I think I remember reading that you're in Medford? Our team is from Corvallis Oregon. We'll be doing a practice launch next weekend and you're welcome to come visit any time. We're happy to share what we know, and learn from other teams. Yes, I'm part of the North Medford High School Team, the Oregon Tornadoes. We're also doing a practice launch this weekend, a tethered launch of the full payload on Earth Day at ScienceWorks in Ashland. Maybe we'll get a chance to visit some time, and let's definitely share our learnings as the Eclipse gets nearer. Sean
|
|
|
Post by irowe on May 17, 2017 12:42:09 GMT -7
leviw I have updated the code according to your method. However, the light on the camera never illuminates. I turn the key on the payload, turn on the ground station, watch the Ubiquiti modems connect, but nothing ever happens. I have double checked that my etc/rc.local matches yours and that my /home/pi/videos folder exists. I know for sure there is nothing running because I cannot connect to the stream in VLC. If I use putty and begin a stream, it succeeds (red light on camera, VLC can open stream). Any ideas? UPDATE: I commented out the Real Time clock lines in the code and now the stream starts on boot up. However, now the Ubiquitis cannot connect.
|
|
|
Post by leviw on May 17, 2017 13:56:27 GMT -7
Good catch on commenting out the RTC lines! Are the ubiquity modems connecting to each other (signal strength and connection lights on) or are you just unable to ssh into the pi?
Nothing in that rc.local file should prevent the ubiquity modems or ssh from working, is it possible one of the payload batteries ran low?
|
|
|
Post by irowe on May 18, 2017 8:53:07 GMT -7
Are the ubiquity modems connecting to each other (signal strength and connection lights on) or are you just unable to ssh into the pi? After further testing, I have discerned the following. When first being powered on, everthing works perfectly. I turn the key on the payload, turn on the ground station, and in a few minutes the stream is available for me to view through VLC. I streamed for 4 or 5 minutes before I powered off the ground station for another 2 minutes. I powered back on and the Ubiquitis reconnected, and I could view the stream again. However, after repowering the ground station, I was unable to maintain connection with the Ubiquiti for more than a minute or so at a time before they disconnected and I couldn't get a stream. I would turn the ground station off and on again to get connection again, and then the same thing would happen. After a couple of rounds of this, I couldn't get the Ubiquiti to connect at all (no signal strength or connection lights, just power and the blinking LAN light). I was using fresh batteries at the time, with the payload sitting 6 feet from the station with the dish pointed at it. Thanks so much for your help.
|
|
|
Post by leviw on May 18, 2017 12:39:09 GMT -7
That's really interesting. I haven't experienced this problem but I suspect that whatever is happening would happen with or without my changes to the rc.local file.
Do the payload's ubiquity lights show the same behavior? (power, lan, no signal?) You said you had tried restarting the ground station, I wonder if restarting the pi while ubiquity was not connected would fix it temporarily, or if ubiquity would stay disconnected? I realize that's not a solution, but might help troubleshoot where the problem is.
One potential experiment would be to comment out the changes, restart the pi, then see if the ubiquity modems have the same problem over several disconnect/reconnect cycles.
I don't have one handy to test this before writing it, but I think the ubiquity modems will connect to each other even if they aren't connected to a computer. The signal strength bars should light up regardless of what the pi does. That LAN light does require a computer though.
|
|