Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5149

Camera board • Re: Newbie alert! Help with Rpi5 and camera distance recording

$
0
0
Thanks @rpdom for the snippet!

For those wondering yes I did read the entire RPI Camera documentation. It's information overload and I learn better with examples!

So I'm checking out your code and parts of it look similar to what I've manage to put together since my last post. Its just really ripping chunks of different examples and combining into my own with a while True loop I made in there. Before we get to mine I would like to go over yours, please correct me if I'm wrong or don't understand. I would really appreciate your patience with me! :)

Code:

size="640x480"  # Available 640x480, 1640x1232, 1920x1080, 3280x2464
Ok super dumb question but are these the only sizes the RPi camera supports or 'performs best' at? I ask because I believe I have mine doing a test 1 hr run right now (to see file size it creates) set to 800x600. Is that no good, issues? I have the wide angle version.

Code:

print(f"File: {filename} Part: {vidnum}", flush=True)
Dumb question again...what does flush=True do?

Code:

picam2.pre_callback = apply_timestamp
I have this too in my borrowed code, I'm assuming its basically telling the program to run this method at the start of recording?

Code:

filename = time.strftime("%Y%m%d-%H%M.mp4") # Filename will be YYYYMMDD-HHMM.mp4
I like this! you are basically telling it to record as an mp4 just by telling the filename? The system is smart enough to record in mp4 format and not others just by doing this?

Code:

encoder = H264Encoder()
This is in everyone's code, usually with a bunch of parameters, I though here is where you need to adjust things to ensure a smaller file size by reducing quality ect.. no? or does your script not care about file size and it records at whatever the default quality is? That's where I'm jammed up I want to set the size of the window 800x600 or 1024x768 I guess 640x480 (kinda small) combined with quality settings to minimize file size with minor loss in video quality. Your code at a high level looks similar to what I just put together. Like I said its running for 1 hr right now to see what size file it creates (as what I have in my code seem to yield the smallest files when testing at 5 or 10 seconds) and also to see if it crashes lol.

I like and want to play with your version of displaying the date/time that seems fancier than mine (well I say mine the code someone else wrote!)

What kind of file sizes are you getting for this program in a minute or hour? Or is this code just long gone and the project is no more?

@gordon77 to answer your question - First off what exactly am I "wasting" by recording non stop? The RPi5 is powered by solar power so no energy cost, I have 3 other RPI4's two of which honestly can be repurposed into one (MQTT server) which leaves me with an unused RPi4. SSD writes/reads, OK I'll give you that its causing wear and tear on the SSD. But if it dies I can just buy 2 more (1 used as a backup of the machine), right now I have some high end SSD's being used, I could easily buy 2 of the "RPi" branded SSD's and still pay less than 1 of my current SSD's so them getting burnt out is not a concern. If anything I'm curious to see how long it'll go before destruction.

I also like the idea of continuous recording because I have the wide angle camera so I capture way more than just my from door area, I get a good portion of the street/houses. Now I hope it never happens, but, we have all seen videos of criminals or crimes committed caught "by accident" by someone else's doorbell cam or the like. Would be nice to help out the police in such event if I capture something.

I have a dash cam in my truck, it records towards the front (duh) but also towards the back, which in this vehicle isn't too useful, too much blockage to record someone say rear ending me, but I can position it to cover my drivers seat and the center console and passenger seat which could be handy if an officer tries to play games on me saying I wasn't wearing my seat belt or my center console wasn't latched (required in my state for it to be latched in any kind of way if you have a firearm in it which I always do, unless I exit the vehicle them it comes with me, I'm not leaving unattended in my car). That kinda stuff could save me from jail or at least give me great evidence for a wrongful arrest lawsuit. Officer can claim whatever he wants, video doesn't lie.

And just like the home crime caught "by accident" scenario I have recorded many times people driving like maniacs on the road causing accidents with other cars down the road. All caught on my camera. I wait for the police to show up, explain the situation that I am a witness and have material evidence that shows what happened. I gladly hand them over the micro SD card that contains the situation, explain to them the right software they need to read the card as its protected, my contact info ect... I have on two random occasions gotten a thank you card through a lawyer on behalf of the victim saying that my video was crucial in establishing the facts of the incident at trial and without it they dont know how it would have turned out. Honestly I'm surprised I was never called as a witness. Makes me happy knowing I helped innocent people out. Woah super long rant, sorry!! Going to post my code "version 1.0" beta lol let me know what you all think, especially on how to improve it, file size minimal, quality decent enough, and perhaps a cleaner way to run for 12 hours or whatever, right its set to 1 because like I said I'm testing, in fact on my next post in a few mins I can tell you the size of the file it created, no motion really, so we'll see.

I'm going to need to re-partition my drive, I had extended the boot partition to use the whole drive, well now I'm realize its best that I have a separate partition for these videos in case something goes south and fills the drive, I don't want it blow up the OS. I'll have to do some googling on that one. Ok my (borrowed) code coming up!

Statistics: Posted by anglerfish27 — Sat Dec 28, 2024 8:25 pm



Viewing all articles
Browse latest Browse all 5149

Trending Articles