Raspberry π

Posted on
Page
of 53
  • I use newsgroups which have a load.

  • They are still working on the tutorials at the mo.

    There is a discord channel with lots of discussion here: https://discord.com/channels/585101360362684422/585101360920395777

    And at least one repositry of ‘blits’ https://blithub.co.uk

    Just think though, if you bought my 32blit you could make yourself a snake clone where the snake is a chain gang that goes around chomping down pots of Belgian mix!

  • Cool. Let me know if she's interested.

    As well as the above links there’s stuff on github too https://github.com/32blit

  • Somehow, I have two RPi Zeroes with the same MAC address on the eth0 adapter

    I have had this problem more than once now, and it messes up routing on my network, with packets being sent randomly.

    In case anyone else has this problem:

    sudo apt-get install macchanger
    
    sudo vi /etc/systemd/system/changemac@.service
    
    [Unit]
    Description=changes mac for %I
    Wants=network.target
    Before=network.target
    BindsTo=sys-subsystem-net-devices-%i.device
    After=sys-subsystem-net-devices-%i.device
    
    [Service]
    Type=oneshot
    ExecStart=/usr/bin/macchanger --mac=xx:xx:xx:xx:xx %I
    RemainAfterExit=yes
    
    [Install]
    WantedBy=multi-user.target
    
    sudo systemctl enable changemac@eth0.service
    
    sudo reboot
    

    (Where eth0 is your adapter)

  • I found a zip with 1000 SNES and 1000 Megadrive games, when I went looking last time.

    ping me if you want a copy

  • New to all this, haven't actually bought one yet but that's what my question's about.

    I want to do the smart home thing with Home Assistant, set up a pi NAS and pi hole and track some flights with a Flightaware USB stick.

    Is there any reason I can't do all of this on one Pi 4 using docker containers and bog standard pi OS?

    Home Assistant says that it runs best on a dedicated Pi but if it's powerful enough, shouldn't this be OK?

    And would 2Gb of ram be enough to do this all on one machine?

    I'll probably end up getting a zero to run the flight tracker as it will need to be in our loft bedroom somewhere in our new place and I don't want the noise of spinning hard drives, if that helps.

  • I tend to use separate Pis as it's easier admin and one thing crashing or restarting won't hit end everything (although Docker should hopefully minimise that.)

    Also, I seem to remember that running Home Assistant running in Docker has some limits. When I looked at it previously add-ons didn't work which was a big issue.

  • You could ease the load by using nextdns.io instead of Pi Hole...

  • As a Python learning thing I'm working on auto tweeting short timelapses from one of my cameras. The twitter account I created is called @5into15

    The chronological tweets show all my attempts to tweet and detail what should be attached. The images are deliberately shonky this evening.

    So far I've successfully tweeted pre captured image & video and one "live" image. Next run of the script should hopefully capture, process & tweet a short timelapse 60s into 3s which if it works I'll repeat over a longer duration... the final objective is to get 5 mins at 1 image per second played back at 20fps for a 15s video. I might have to adapt the script to fix skipped images over the longer time period although at 1 fps this hopefully won't occur (fwiw at 2 fps captured it happens lots).

    The hardest bit so far was installing Twython. There's so many out of date articles using what are now out of date commands it took a while to sort but was useful just for teaching me that lesson itself.

    Anyway, basic bread & butter stuff to most of you no doubt but really useful learning for me.

  • ^ I've got it working but the current ffmpeg conversion of 300 image files to a short video is taking about 30mins. Using picamera was quicker & simpler but the video output wasn't liked by twitter.

    https://twitter.com/5into15/status/1371448549678968835?s=19

  • Could you use opencv / webrtc / aiortc instead? (As you're using Python already).

  • I will take a look, thanks. Getting the ffmpeg step to 12 mins from 30+ reduces final quality hugely and is still too slow for 15s output imo.

  • Interesting project. Which pi is it? Would have expected a pi 4 to be a bit faster than that, and wouldn't be surprised if an earlier pi was that slow.

    Also, what is the command line you're using to invoke ffmpeg? Maybe you're missing some threading/optimisation options...

  • Which pi is it?

    Zero W!

    Also, what is the command line you're using to invoke ffmpeg? Maybe you're missing some threading/optimisation options..

    Most likely yes, it's currently 14 minutes into processing at crf 51 which is lowest quality...

    ffmpeg -r 20 -i image%04d.jpg -r 20 -vcodec libx264 -crf 51 -vf scale=1280:720 output.mp4
    

    Fwiw the images are captured at 1280:720 too.

    I can't figure out why -r 20 is needed as part of the input, it's on my list of things to drop out and see what happens.

  • ^ the lowest quality is very poor.

    Doing a hopefully better one of this view now. Will let it process in my bag on my pedal home.


    2 Attachments

    • 20210315_174344.jpg
    • 20210315_174351.jpg
  • Ah, Zero W. Not much oompf there as it's a single core 1GHz chip. But they are cheap and great for this kind of thing.

    "-r 20" specifies a 20fps frame rate. I don't think specifying it twice would be a cause of any performance problem.

    The -crf is the x264 quantizer 'constant rate factor' and the range is 0-51. A lower number is higher quality, so you're already at the lowest (and hopefully fastest) option there.

    If the input images are already 1280x720 then I wonder what happens if you remove the whole "-vf scale=1280:720" section. You may be getting a performance hit of it having to pass everything through the scale filter only for it to end up doing nothing. If it is required (as without it you get something a different size) you could try "-s 1280x720" instead but that's just a stab in the dark.

    Other than that I think the only other option for making it faster is to use a different vcodec that may not do as much compression (and therefore be faster, but lead to bigger output files).

    (I'm not a ffmpeg expert at all, I've used it a couple of times, but on high powered machines where I haven't had to optimise it as stuff just runs quickly regardless.)

  • Ta. I appreciate I'm asking a lot of it, but it is interesting see what it can do.

    I found crf 51 is poor. Back at 17 for my last timelapse video but it was too dusk by then, after a short youtube stream so I could adjust the focus as it was set for close up bird feeders still. At crf 17 it was about 45 mins to process.

    Good point about the vf scale I'll try removing that to see how it behaves as a result.

    I tried one other codec earlier, it's in a copy of the script but I've shut it all down now and cba to reopen to get its name. Output quality wasn't upto much but I could explore that avenue again.

    From a quick skim google, opencv might give more options too.

  • I removed the first -r 20 and the vcf scale bit. It has created a file in <30 mins but didn't tweet it. I was outside and the ssh from phone dropped out so I couldn't see what the error msg was. I run it via Screen so the process doesn't stop if the ssh drops but I'm not sure I can get back into Screen after it closes. There's probably a setting i can change in Juice ssh to help stop it dropping in the first place.

    At home now and running the ffmpeg bit only again so will see if it gives an error.

  • but I'm not sure I can get back into Screen after it closes

    screen -RDU

    is how I generally reconnect with screen (the -U is for utf8 mode).

  • Useful, ta.

    Interestingly the fps is now 25 since I removed the first r -20, the resulting video is 12s long.

  • I've reached the conclusion the Pi Zero isn't upto this. I had 300 images from a failed attempt earlier (no tweet = no delete) and just ran the ffmpeg on the pi400. With the crf set at 1 for high quality it took just 30s to make the movie from the stills.

    I'll upgrade to a pi4 and use the zero for youtube streaming as it seems ok at that.

  • Nice little benchmarking exercise if nothing else! Hopefully googleable and useful to people out there

  • It might be ok actually... I just switched vcodec again, to mpeg4 this time, qscale:v 1, and and it is a 3 minute job for 40mb vid that looks ok on monitor.

    I think the libx264 codec is (was) the problem.

    Again bread & butter stuff no doubt for those more experienced, useful learning (and research) here.

    Slightly sad I can't justify getting a Pi4 for this now though...

  • I have a 3b+ sitting around doing nothing if you want that. Pretty sure it works, just needs an SD card.

  • That's very kind offer, I'd definitely make use of it. Thanks. There'll be beer in it for you naturally.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Raspberry π

Posted by Avatar for photoben @photoben

Actions