Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

Maybe it's time to break that. -- Larry Wall in <199710311718.JAA19082@wall.org>


computers / comp.sys.raspberry-pi / Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES

SubjectAuthor
* Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES56d.1152
+* Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMESChris Elvidge
|`- Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES56d.1152
`- Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMESdruck

1
Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES

<1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=7858&group=comp.sys.raspberry-pi#7858

  copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-1.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 11 Nov 2023 06:33:19 +0000
Newsgroups: comp.sys.raspberry-pi
X-Mozilla-News-Host: news://news.west.earthlink.net:119
From: 56d.1152@ztq9.net (56d.1152)
Subject: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES
Organization: polymer illumination
Date: Sat, 11 Nov 2023 01:33:19 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
Message-ID: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
Lines: 144
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-04Y1lcixrd93eG8lBsdYY9WNhvQw86E5X58rqUSipn1gKSg8rJBGQsBicSLiQftg1NQwmHu6R2/yQ4S!6i47rDL/0A8OKjQa3dTQ/qCU/xAu7clgMy96PTSV0uOrplJZb1Wh2V+eGVEa24HZ9L+JJrnRSZaO!n5/MBBtZlnMz2kqZF8qG
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: 56d.1152 - Sat, 11 Nov 2023 06:33 UTC

OK, I've been pounding at this for 10+ days now.

What's NEEDED is for a Pi4 to read either rtsp
streams from security cams OR the transient
JPGs said cameras offer - and then put it into
displayable video frames.

SOME of the cams will NOT do rtsp properly - you
can sometimes see them in VLC, but Motion and
such can't capture it properly.

However, with RTSP and OpenCV, the big BIG problem
is LATENCY. I'm seeing up to like 30+ seconds. Unless
you use a couple of 'back-ends', the commands to shrink
the BUFFERS don't work - and I've not got V4L2 backend
to work.

Basics - something reads the cams, either by rtsp
or by directly downloading those JPGs. Have been
using Motion - which is a great app - but it's
really meant for faster computers. It creates a
very handy MJPEG stream on a port that OpenCV can
easily read/crop/resize/display.

However - LATENCY - severe !!! It's the fuckin'
buffering and after massive searching I've yet
to find a good/general/sane fix. And no I'm
NOT gonna re-write half the OS or Motion to
find success.

Yesterday I wrote a threaded Py app that's a sort
of "engine" which uses curl - faster than wget -
to pull those JPGs out of the cams. Added "lock"
files for WHILE it's downloading. The display
app respects those locks. It all WORKS, almost
no latency, but there's another issue ...

The issue is that the JPGs are replaced every
second, or two or three times a second depending.
Curl, and wget, only download WHAT THEY FIND.

Sometimes that's a full, real, viable, JPG.
Sometimes it's a PARTIAL JPG ... either not
finished or partially overwritten by new data.
This inserts lots of "ugly" frames, even at
relatively low-FPS rates.

My "engine" simply downloads existing JPGs from
the cams and puts them in an identically-named
files. FFMPEG - at least on the current Deb derivs -
the "overwrite" option does NOT work ... it INSISTS
on serially-numbered output JPGs, which is a crappy,
CPU-sucking, "solution" to deal with.

Pi4s have FAIR cpu - but they ain't I9s.

All that OpenCV is doing is reading the disk files,
or attempting rtsp, and displaying the cams in up
to four placed/scaled frames onscreen (btw the
placement does NOT work with Wayland).

I'm attempting to free the Pis from using MJPEG
streams created BY the faster i9 server + motion
+ apache. Was just displaying a web page of one
to four live frames via Motion. HTML plus a
little WebKit resize stuff worked fine. But, it's
DEPENDENT on the much-stronger cpu doing all
this stuff and current circumstances may mean
that stronger CPU is gonna go away. SO,

I want the P4 display units to be "independent",
with "Motion" or whatever running ON them to grab
the security cams themselves. THEN we can display.

SO - the TWO enemies - "Latency" from any use of
"Motion", or "crappy frames" using Curl.

WORKAROUNDS :

Use Chromium and PHP-html/WebKit/iframes to directly
read/scale/show the JPGs from the cams. Browsers
a bit of a pain to deal with and the WebKit
per-iframe defs are VERY hard to work with, can
take half a day to get everything "just right".
Browsers work best with MJPEG streams like
"Motion" creates ... but LATENCY creeps in
big time.

So .......... noticed that if you bring in the
JPG using a browser it's like PERFECT and very
INSTANT. Seems they can detect a "complete" JPG
and download it MUCH faster than curl/wget.

So ....... how to reproduce that "instant/perfect"
effect NOT involving browsers ??? What can be
faster than curl for downloading a JPG from a
remote http device - either as a straight-up file
or some kind of MJPEG stream ??????????

Clearly FFox/Chromium CAN do this, so there's
SOME faster/better trick.

I've spend endless hours searching on this issue,
and found NOTHING that really improves ...

So, to encapsulate, VideoCapture(xxx) is not a
good solution for rtsp/mjpeg because of the
buffering problem. 'Motion' also has a serious
latency prob on a P4. Browser/html-php solutions
can work, but are a real pain in the ass to
deal with - no handy .config files for defining
sources/crops/scaling.

And that's MY "Project Of The Week".

I'm retiring very soon now ... but I'd LIKE to
get the security cam stuff for those who need to
see live feeds work properly/independently. Sort
of my "gift" to the regular-level workers and
a continuing legacy for PIs. The new guys can
learn to cope with Linux/PIs ... my "gift"
to those Winders-centrics. IF they screw it
up they WILL get ENDLESS grief - "WHERE ARE
MY CAMERA FEEDS ??? !!!" :-)

Too much ... well, better more detail than not
enough eh ? :-)

.. . .

Oh ...recent "Motion" on Deb/Pi4 ... you HAVE
to put the poorly-documented "start_motion_daemon=yes"
into "motion.conf" ... you can leave the other
'daemon on" undefined or off. DO use systemctl
to ENABLE the daemon. I modified the systemd
file in /usr/lib/systemd/system/motion.service
to include RESTARTING on failure. DO remember
to do "systemctl daemon-reload" after that.

The alt approach is to start Motion in root crontab,
but then you can't easily start/stop/restart. For
goodness I usually restart the Motion daemon at
least twice a day using root crontab.

Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES

<uinqnk$3e8gl$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=7862&group=comp.sys.raspberry-pi#7862

  copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!rocksolid2!news.neodome.net!feeder1.feed.usenet.farm!feed.usenet.farm!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris@mshome.net (Chris Elvidge)
Newsgroups: comp.sys.raspberry-pi
Subject: Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES
Date: Sat, 11 Nov 2023 12:06:12 +0000
Organization: A noiseless patient Spider
Lines: 157
Message-ID: <uinqnk$3e8gl$1@dont-email.me>
References: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 11 Nov 2023 12:06:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="ac9f7a187a4fa3456549b5deee0b2a63";
logging-data="3613205"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+E31C+Qt2JSq42QnePD+bqCU+NRbqXXBk="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101
Thunderbird/52.2.1 Lightning/5.4
Cancel-Lock: sha1:RWudEIKMQff/85W8QGedG8NsZfw=
In-Reply-To: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
Content-Language: en-GB
 by: Chris Elvidge - Sat, 11 Nov 2023 12:06 UTC

On 11/11/2023 06:33, 56d.1152 wrote:
> OK, I've been pounding at this for 10+ days now.
>
> What's NEEDED is for a Pi4 to read either rtsp
> streams from security cams OR the transient
> JPGs said cameras offer - and then put it into
> displayable video frames.
>
> SOME of the cams will NOT do rtsp properly - you
> can sometimes see them in VLC, but Motion and
> such can't capture it properly.
>
> However, with RTSP and OpenCV, the big BIG problem
> is LATENCY. I'm seeing up to like 30+ seconds. Unless
> you use a couple of 'back-ends', the commands to shrink
> the BUFFERS don't work - and I've not got V4L2 backend
> to work.
>
> Basics - something reads the cams, either by rtsp
> or by directly downloading those JPGs. Have been
> using Motion - which is a great app - but it's
> really meant for faster computers. It creates a
> very handy MJPEG stream on a port that OpenCV can
> easily read/crop/resize/display.
>
> However - LATENCY - severe !!! It's the fuckin'
> buffering and after massive searching I've yet
> to find a good/general/sane fix. And no I'm
> NOT gonna re-write half the OS or Motion to
> find success.
>
> Yesterday I wrote a threaded Py app that's a sort
> of "engine" which uses curl - faster than wget -
> to pull those JPGs out of the cams. Added "lock"
> files for WHILE it's downloading. The display
> app respects those locks. It all WORKS, almost
> no latency, but there's another issue ...
>
> The issue is that the JPGs are replaced every
> second, or two or three times a second depending.
> Curl, and wget, only download WHAT THEY FIND.
>
> Sometimes that's a full, real, viable, JPG.
> Sometimes it's a PARTIAL JPG ... either not
> finished or partially overwritten by new data.
> This inserts lots of "ugly" frames, even at
> relatively low-FPS rates.
>
> My "engine" simply downloads existing JPGs from
> the cams and puts them in an identically-named
> files. FFMPEG - at least on the current Deb derivs -
> the "overwrite" option does NOT work ... it INSISTS
> on serially-numbered output JPGs, which is a crappy,
> CPU-sucking, "solution" to deal with.
>
> Pi4s have FAIR cpu - but they ain't I9s.
>
> All that OpenCV is doing is reading the disk files,
> or attempting rtsp, and displaying the cams in up
> to four placed/scaled frames onscreen (btw the
> placement does NOT work with Wayland).
>
> I'm attempting to free the Pis from using MJPEG
> streams created BY the faster i9 server + motion
> + apache. Was just displaying a web page of one
> to four live frames via Motion. HTML plus a
> little WebKit resize stuff worked fine. But, it's
> DEPENDENT on the much-stronger cpu doing all
> this stuff and current circumstances may mean
> that stronger CPU is gonna go away. SO,
>
> I want the P4 display units to be "independent",
> with "Motion" or whatever running ON them to grab
> the security cams themselves. THEN we can display.
>
> SO - the TWO enemies - "Latency" from any use of
> "Motion", or "crappy frames" using Curl.
>
> WORKAROUNDS :
>
> Use Chromium and PHP-html/WebKit/iframes to directly
> read/scale/show the JPGs from the cams. Browsers
> a bit of a pain to deal with and the WebKit
> per-iframe defs are VERY hard to work with, can
> take half a day to get everything "just right".
> Browsers work best with MJPEG streams like
> "Motion" creates ... but LATENCY creeps in
> big time.
>
> So .......... noticed that if you bring in the
> JPG using a browser it's like PERFECT and very
> INSTANT. Seems they can detect a "complete" JPG
> and download it MUCH faster than curl/wget.
>
> So ....... how to reproduce that "instant/perfect"
> effect NOT involving browsers ??? What can be
> faster than curl for downloading a JPG from a
> remote http device - either as a straight-up file
> or some kind of MJPEG stream ??????????
>
> Clearly FFox/Chromium CAN do this, so there's
> SOME faster/better trick.
>
> I've spend endless hours searching on this issue,
> and found NOTHING that really improves ...
>
> So, to encapsulate, VideoCapture(xxx) is not a
> good solution for rtsp/mjpeg because of the
> buffering problem. 'Motion' also has a serious
> latency prob on a P4. Browser/html-php solutions
> can work, but are a real pain in the ass to
> deal with - no handy .config files for defining
> sources/crops/scaling.
>
> And that's MY "Project Of The Week".
>
> I'm retiring very soon now ... but I'd LIKE to
> get the security cam stuff for those who need to
> see live feeds work properly/independently. Sort
> of my "gift" to the regular-level workers and
> a continuing legacy for PIs. The new guys can
> learn to cope with Linux/PIs ... my "gift"
> to those Winders-centrics. IF they screw it
> up they WILL get ENDLESS grief - "WHERE ARE
> MY CAMERA FEEDS ??? !!!" :-)
>
> Too much ... well, better more detail than not
> enough eh ? :-)
>
> . . .
>
> Oh ...recent "Motion" on Deb/Pi4 ... you HAVE
> to put the poorly-documented "start_motion_daemon=yes"
> into "motion.conf" ... you can leave the other
> 'daemon on" undefined or off. DO use systemctl
> to ENABLE the daemon. I modified the systemd
> file in /usr/lib/systemd/system/motion.service
> to include RESTARTING on failure. DO remember
> to do "systemctl daemon-reload" after that.
>
> The alt approach is to start Motion in root crontab,
> but then you can't easily start/stop/restart. For
> goodness I usually restart the Motion daemon at
> least twice a day using root crontab.
>

I've got a Raspberry Pi Model B Rev 2 with both a Pi camera and a USB
camera, Buster (10.13), lighttpd 1.4.53 and Motion 4.1.1 saving
motion-detected .avis and displaying live feeds. Note: no wifi, ethernet
only. It has worked like this for several years.
However trying with Bullseye/Bookworm turned out to be too complicated
to be worth upgrading.

--
Chris Elvidge, England
THIS IS NOT A CLUE...OR IS IT?

Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES

<LCGdnXkZpYRZi834nZ2dnZfqnPudnZ2d@earthlink.com>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=7863&group=comp.sys.raspberry-pi#7863

  copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!border-1.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 12 Nov 2023 00:05:24 +0000
Subject: Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES
Newsgroups: comp.sys.raspberry-pi
References: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
<uinqnk$3e8gl$1@dont-email.me>
From: 56d.1152@ztq9.net (56d.1152)
Organization: polymer illumination
Date: Sat, 11 Nov 2023 19:04:45 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.13.0
MIME-Version: 1.0
In-Reply-To: <uinqnk$3e8gl$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 8bit
Message-ID: <LCGdnXkZpYRZi834nZ2dnZfqnPudnZ2d@earthlink.com>
Lines: 191
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 99.101.150.97
X-Trace: sv3-rY5fNtXXeZfA+IW8IiaZa07EbwvxLOfRtmm8qBmyz7QZNlsgulXEwQ5yBWVoEtLq6T6Pr5omB8bdn3X!w9TETwxDAVFBSW1lnbARXxzABy0DW9rpNcNy7rRCK0+1xBlPlUiLhgMCqVBNoxtutKyAnz54zrXz!MhBY5P7KJZ9p5O8O51pH
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
X-Received-Bytes: 8827
 by: 56d.1152 - Sun, 12 Nov 2023 00:04 UTC

On 11/11/23 7:06 AM, Chris Elvidge wrote:
> On 11/11/2023 06:33, 56d.1152 wrote:
>> OK, I've been pounding at this for 10+ days now.
>>
>> What's NEEDED is for a Pi4 to read either rtsp
>> streams from security cams OR the transient
>> JPGs said cameras offer - and then put it into
>> displayable video frames.
>>
>> SOME of the cams will NOT do rtsp properly - you
>> can sometimes see them in VLC, but Motion and
>> such can't capture it properly.
>>
>> However, with RTSP and OpenCV, the big BIG problem
>> is LATENCY. I'm seeing up to like 30+ seconds. Unless
>> you use a couple of 'back-ends', the commands to shrink
>> the BUFFERS don't work - and I've not got V4L2 backend
>> to work.
>>
>> Basics - something reads the cams, either by rtsp
>> or by directly downloading those JPGs. Have been
>> using Motion - which is a great app - but it's
>> really meant for faster computers. It creates a
>> very handy MJPEG stream on a port that OpenCV can
>> easily read/crop/resize/display.
>>
>> However - LATENCY - severe !!! It's the fuckin'
>> buffering and after massive searching I've yet
>> to find a good/general/sane fix. And no I'm
>> NOT gonna re-write half the OS or Motion to
>> find success.
>>
>> Yesterday I wrote a threaded Py app that's a sort
>> of "engine" which uses curl - faster than wget -
>> to pull those JPGs out of the cams. Added "lock"
>> files for WHILE it's downloading. The display
>> app respects those locks. It all WORKS, almost
>> no latency, but there's another issue ...
>>
>> The issue is that the JPGs are replaced every
>> second, or two or three times a second depending.
>> Curl, and wget, only download WHAT THEY FIND.
>>
>> Sometimes that's a full, real, viable, JPG.
>> Sometimes it's a PARTIAL JPG ... either not
>> finished or partially overwritten by new data.
>> This inserts lots of "ugly" frames, even at
>> relatively low-FPS rates.
>>
>> My "engine" simply downloads existing JPGs from
>> the cams and puts them in an identically-named
>> files. FFMPEG - at least on the current Deb derivs -
>> the "overwrite" option does NOT work ... it INSISTS
>> on serially-numbered output JPGs, which is a crappy,
>> CPU-sucking, "solution" to deal with.
>>
>> Pi4s have FAIR cpu - but they ain't I9s.
>>
>> All that OpenCV is doing is reading the disk files,
>> or attempting rtsp, and displaying the cams in up
>> to four placed/scaled frames onscreen (btw the
>> placement does NOT work with Wayland).
>>
>> I'm attempting to free the Pis from using MJPEG
>> streams created BY the faster i9 server + motion
>> + apache. Was just displaying a web page of one
>> to four live frames via Motion. HTML plus a
>> little WebKit resize stuff worked fine. But, it's
>> DEPENDENT on the much-stronger cpu doing all
>> this stuff and current circumstances may mean
>> that stronger CPU is gonna go away. SO,
>>
>> I want the P4 display units to be "independent",
>> with "Motion" or whatever running ON them to grab
>> the security cams themselves. THEN we can display.
>>
>> SO - the TWO enemies - "Latency" from any use of
>> "Motion", or "crappy frames" using Curl.
>>
>> WORKAROUNDS :
>>
>> Use Chromium and PHP-html/WebKit/iframes to directly
>> read/scale/show the JPGs from the cams. Browsers
>> a bit of a pain to deal with and the WebKit
>> per-iframe defs are VERY hard to work with, can
>> take half a day to get everything "just right".
>> Browsers work best with MJPEG streams like
>> "Motion" creates ... but LATENCY creeps in
>> big time.
>>
>> So .......... noticed that if you bring in the
>> JPG using a browser it's like PERFECT and very
>> INSTANT. Seems they can detect a "complete" JPG
>> and download it MUCH faster than curl/wget.
>>
>> So ....... how to reproduce that "instant/perfect"
>> effect NOT involving browsers ??? What can be
>> faster than curl for downloading a JPG from a
>> remote http device - either as a straight-up file
>> or some kind of MJPEG stream ??????????
>>
>> Clearly FFox/Chromium CAN do this, so there's
>> SOME faster/better trick.
>>
>> I've spend endless hours searching on this issue,
>> and found NOTHING that really improves ...
>>
>> So, to encapsulate, VideoCapture(xxx) is not a
>> good solution for rtsp/mjpeg because of the
>> buffering problem. 'Motion' also has a serious
>> latency prob on a P4. Browser/html-php solutions
>> can work, but are a real pain in the ass to
>> deal with - no handy .config files for defining
>> sources/crops/scaling.
>>
>> And that's MY "Project Of The Week".
>>
>> I'm retiring very soon now ... but I'd LIKE to
>> get the security cam stuff for those who need to
>> see live feeds work properly/independently. Sort
>> of my "gift" to the regular-level workers and
>> a continuing legacy for PIs. The new guys can
>> learn to cope with Linux/PIs ... my "gift"
>> to those Winders-centrics. IF they screw it
>> up they WILL get ENDLESS grief - "WHERE ARE
>> MY CAMERA FEEDS ??? !!!"   :-)
>>
>> Too much ... well, better more detail than not
>> enough eh ?  :-)
>>
>> . . .
>>
>> Oh ...recent "Motion" on Deb/Pi4 ... you HAVE
>> to put the poorly-documented "start_motion_daemon=yes"
>> into "motion.conf" ... you can leave the other
>> 'daemon on" undefined or off. DO use systemctl
>> to ENABLE the daemon. I modified the systemd
>> file in /usr/lib/systemd/system/motion.service
>> to include RESTARTING on failure. DO remember
>> to do "systemctl daemon-reload" after that.
>>
>> The alt approach is to start Motion in root crontab,
>> but then you can't easily start/stop/restart. For
>> goodness I usually restart the Motion daemon at
>> least twice a day using root crontab.
>>
>
> I've got a Raspberry Pi Model B Rev 2 with both a Pi camera and a USB
> camera, Buster (10.13), lighttpd 1.4.53 and Motion 4.1.1 saving
> motion-detected .avis and displaying live feeds. Note: no wifi, ethernet
> only. It has worked like this for several years.
> However trying with Bullseye/Bookworm turned out to be too complicated
> to be worth upgrading.

I made a Pi2b doing just that the other day
(and using BookWorm). It can handle ONE webcam,
despite being old tech. Going thru motion.conf,
you can sometimes find little tweaks to speed
it up. In any case, the mjpeg stream can be
seen in a browser. Still some latency, but not
too awful.

But I'm trying to use Python stuff to do the
display - tried PIL and then OpenCV. This is
where the latency issue mostly resides.

cv2.VideoCapture(http://<stream:port) opens
the stream perfectly well, but then is where
the buffering starts and it can't handily
be negated. The authors made some decision
and that was to buffer a lot so no frames would
be lost.

Looking at 'top', the py pgm is NOT using up a
lot of CPU - it's Motion, but even that's not
too bad on a P4.

OpenCV can also directly read rtsp - but again
you get a long string of stuff in the buffer
even when the cams are like one or two FPS.

Hence my work yesterday to only use OpenCV for
sizing/display purposes and grab my cam frames
using curl threads. All OpenCV sees is what
looks like a static jpg file on disk and loads
it - no buffers.

But curl, as said, has it's problems too.

Might have to go back to a browser ... not
desired though.

Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES

<uiu7ga$sv88$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/computers/article-flat.php?id=7903&group=comp.sys.raspberry-pi#7903

  copy link   Newsgroups: comp.sys.raspberry-pi
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: news@druck.org.uk (druck)
Newsgroups: comp.sys.raspberry-pi
Subject: Re: Pi4 And MJPEG Streams/Display - LATENCY -vs- CORRUPT FRAMES
Date: Mon, 13 Nov 2023 22:20:57 +0000
Organization: A noiseless patient Spider
Lines: 9
Message-ID: <uiu7ga$sv88$1@dont-email.me>
References: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 13 Nov 2023 22:20:58 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="3cfae008c6a9e2430054ea751d1037a7";
logging-data="949512"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/OOeyWoOGDrEItNM9RuCbt"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:Mx0E61sj7HGbHpvg/QPmQCQv7G0=
X-Antivirus: Avast (VPS 231110-8, 10/11/2023), Outbound message
In-Reply-To: <1Aednbh3asOyvdL4nZ2dnZfqnPWdnZ2d@earthlink.com>
Content-Language: en-GB
X-Antivirus-Status: Clean
 by: druck - Mon, 13 Nov 2023 22:20 UTC

On 11/11/2023 06:33, 56d.1152 wrote:
> Yesterday I wrote a threaded Py app that's a sort
> of "engine" which uses curl - faster than wget -
> to pull those JPGs out of the cams.

Use the Python requests module, it's faster than calling wget or curl.

---druck

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor