[FFmpeg-user] Record N RTSP frames and average into 1 jpg? In a loop?

Steven Kan steven at kan.org
Sun Jul 9 01:37:34 EEST 2023


Hi David,

Thanks for the response. The key problem (AFAICT) is that neither the grow light nor the Wyze cam has any interface to modify the frequency.

I believe the Wyze cam runs at 20 fps, unadjustable, and I’m guessing the LEDs are flickering at our U.S. AC line frequency of 60 Hz.

Fortunately they’re very slightly asynchronous, so the black bands “crawl” with a frequency of about 1/32 Hz.

But your idea about separating the power is a good one. I have a 12 V Jump-N-Carry in the garage and a 12 V/120 V inverter that I can try when I get back into town. If the inverter output is sufficiently different from 60 Hz it might improve things.

But if not, I’m back to my original problem of averaging frames. 

> On Jul 8, 2023, at 3:25 PM, David Bernat <david.bernat at gmail.com> wrote:
> 
> Hi Steven, Flashbacks to earlier EE undergraduate days here. I would like
> to ask you a few questions about what you need the answer for to best get
> at your answer, if I can.
> Firstly, the synchronization is presumably because you are running the LEDs
> and Camera off the same power source.
> The scrolling black bands arise because the read-out rate of the CCD is
> near the flicker rate of the LED, and because the read of the CCD takes
> time some of the pixels are read
> out while the flicker is black. The simplest solution, in the EE context,
> and best solution for all sort of circumstances, is simply to disconnect
> the power sources or slow the camera rate.
> As for the black bands themselves, the phase of the black bands, how long
> they take to scroll, can be tuned with the CCD read-out rate.
> Using tmixing is essentially achieving the same goal, but the black bands
> will persist somewhere or the tmixing will need to be as long as the period
> itself, at which point you have a slow
> effective frame rate. Having this information, or at least refreshing
> myself, is what you want to do still to optimize for N using a bash script
> and personal observation?
> In which case, you need a bash script to run a for loop to perform the code
> you have above? DB
> 
> On Sat, Jul 8, 2023 at 4:13 PM Steven Kan <steven at kan.org> wrote:
> 
>> I am attempting to capture a time-lapse of corn seeds germinating under an
>> LED grow-light, using a Wyze Cam v3 with the beta RTSP firmware.
>> 
>> The problem is that the LEDs are coincidentally synced with the camera,
>> resulting in this egregious banding:
>> 
>> https://www.kan.org/pictures/CornSeedlingstmix500.jpg
>> 
>> It has a period of ~32 seconds at 20 fps.
>> 
>> https://www.youtube.com/watch?v=3weqY5wTntY
>> 
>> I can fix this by tmix-ing N frames:
>> 
>> ffmpeg -i CornCam.mp4 -vf tmix=frames=500:weights="1" -vcodec
>> h264_videotoolbox out.mp4
>> 
>> and this is a screencap of one frame from out.mp4:
>> 
>> https://www.kan.org/pictures/CornSeedlingsBanding.jpg
>> 
>> but I want to optimize for N, because if I average in more than the
>> optimal number of frames, I’ll be un-doing some of the blending effect.
>> 
>> So I’d like to put this in a bash loop to:
>> 
>> 1) Record N frames from RTSP
>> 2) tmix N frames into exactly 1 jpg output
>> 3) Save as N.jpg
>> 4) Increment N from ~400 to ~500
>> 
>> Then I can scan through all my results and see what value of N looks best,
>> and then set up my time lapse for the next 10 days.
>> 
>> Thanks!
>> 
>> --
>> Steven "Rocket Man" Kan                          #```````
>> mailto:steven at kan.org                            #  ```````
>> http://www.kan.org                               #    ```````
>> aim://stevenkan@me.com                           #      ```````
>>                                                 #        ```````
>>                                    ~       ~      . \_ at _/  ```````
>>                            ^_@         o            . V      ```````
>>                          `-'  -         \_ at _   ~      .       ######
>>                                           V \       ~   .     ######
>>                                    ~                      .   #H2O##
>>                                ~                            . #POLO#
>> Blood, sweat, and chlorine                          ~    ~     ######
>> 
>> 
>> _______________________________________________
>> ffmpeg-user mailing list
>> ffmpeg-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>> 
>> To unsubscribe, visit link above, or email
>> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>> 
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list