LUMIX GX80 UDP Streaming

Find quick help here to get you started with Hollywood
plouf
Posts: 462
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: LUMIX GX80 UDP Streaming

Post by plouf »

the code there works as long as line

Code: Select all

For y=1 To 8192
the momnent you change it with

Code: Select all

For y=1 To 8193
it does not

i try with following

Code: Select all

af = CreateUDPObject(Nil, 12345)
DebugPrint(GetLocalPort(af, #NETWORKUDP))

InstallEventHandler({onreceiveudpdata = Function(msg)

	DebugPrint("received")
	data$,ip$,port = ReceiveUDPData(af,4096)
	data2$ ,ip$,port = ReceiveUDPData(af,4096)
	data$=data$..data2$
	data2$ ,ip$,port = ReceiveUDPData(af,4096)
	data$=data$..data2$
	DebugPrint("size is "..StrStr(StrLen(data$)))
	DebugPrint("data "..data$)
	
	EndFunction})

Repeat
	WaitEvent
Forever
but fails in first line as mentiom
using the follwing client test code (see i send 10000 bytes)

Code: Select all

CreateUDPObject(1)
For i=1 To 5
	For y=1 To 10000
		data$ = data$.. ByteChr(i)
	Next 
Next 



InstallEventHandler({onkeyup = Function(msg)

	;SendUDPData(1, msg.key, "127.0.0.1", 12345)
	SendUDPData(1,data$, "127.0.0.1", 12345)
	
EndFunction})

Repeat
	WaitEvent
Forever
anyway.. can provide the correct way ?
thanx
Christos
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUMIX GX80 UDP Streaming

Post by airsoftsoftwair »

Thanks, I see the problem now. The problem is that UDP packets must always be read in full by a single call to ReceiveUDPData(). It's not possible to read them sequentially. That's why you can't read a 50000 byte packet using several calls to ReceiveUDPData(). The consequence is that Hollywood can't handle UDP packets bigger than 8kb at all because that's the maximum ReceiveUDPData() can handle.

I don't really understand why you need to read larger packets. Usually, UDP uses very small packet sizes because of its nature as an unreliable protocol. Is there any reason why you want to use larger packets than 8kb?
plouf
Posts: 462
Joined: Sun Feb 04, 2018 11:51 pm
Location: Athens,Greece

Re: LUMIX GX80 UDP Streaming

Post by plouf »

The topic here us about lumix
This vamera sends a whole frame per packet and if you see the thread we notice that this is the reason why he received part of image
Christos
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUMIX GX80 UDP Streaming

Post by airsoftsoftwair »

Really? UDP is limited to 64kb per packet. That's hardly enough for a whole camera image...
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: LUMIX GX80 UDP Streaming

Post by sinisrus »

These are 640x480 images. That may be enough (may be) ?
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUMIX GX80 UDP Streaming

Post by airsoftsoftwair »

sinisrus wrote: Fri Oct 30, 2020 8:07 am These are 640x480 images. That may be enough (may be) ?
May be enough, may not be enough. Anyway, UDP requires data transfer using a fixed packet size. Have you tried to find out the packet size used by the camera?
sinisrus
Posts: 347
Joined: Tue Apr 21, 2015 5:43 pm

Re: LUMIX GX80 UDP Streaming

Post by sinisrus »

On this link:
https://www.personal-view.com/talks/dis ... -video-/p1

a 144 bytes "header" (with a few changing bytes, and a lot of repeating patterns in the different occurences of these headers / separators)
ff d8 ...... ff d9 : a jpg file
a 144 bytes "header"
ff d8 ...... ff d9 : another jpg file
and so on
User avatar
airsoftsoftwair
Posts: 5425
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: LUMIX GX80 UDP Streaming

Post by airsoftsoftwair »

Yes, looks like the camera sends an MJPEG stream. But this page doesn't mention the UDP packet size used by the camera...
SamuraiCrow
Posts: 475
Joined: Fri May 15, 2015 5:15 pm
Location: Waterville, Minnesota USA

Re: LUMIX GX80 UDP Streaming

Post by SamuraiCrow »

If you read farther into that link, you'd find the post was edited to indicate the size of the header varies. Maybe the packet length really is supposed to be 8k.

Maybe this article from WikiPedia will help you decode the header properly.
I'm on registered MorphOS using FlowStudio.
Post Reply