OSC parsing


#1

Hello, guyz!
I’m sticking with OSC data feed. According to implementation of OSC protocol and CasparCG Wiki i found how to watch needed addresses. For example /channel/1/stage/layer/1/file/time
Obviously - bytes after that address is value of parameter. Who can tell me how to interpret this value?
Is it HEX or something? Funny, but when i play in loop some media at channel 1 layer 1 this value doesn’t changed. How can it be?


#2

For each /channel/1/stage/layer/1/file/time there are two values, the first should change, the second doesn’t.
Are you sure you are getting the first and not the last one?


#3

PLAY 1-1 test loop
this command i use to start looped playback. And /channel/1/stage/layer/1/file/time doesn’t chaned


#4

There are only 6 chars after /channel/1/stage/layer/1/file/time and all of them are the same. Nothing changes. Who can explain how?


#5

Update!!! I found that after /channel/1/stage/layer/1/file/time totally 14 chars: 6 chars are the same (it is not depend of playing video) + 4 chars (seems like current time) + 4 chars (video duration. it doesn’t change, but it is different for each video). Now i need to know what means each byte of that value…


#6

So, 4 bytes (current time) and 4 bytes (total time). It seems like 1st & 2nd byte are some kind of seconds, 3rd and 4th bytes are some kind of milliseconds (or ticks) - they are run very fast. I’m confused that current time starts not from 0. The differense between two bytes of totalTime and currentTime is remaining time (obviously). Test clip is 18 sec. long (439 frames@25 fps). Maximum differense for those values is 1129. But what is the measure unit used for this? How it relates to seconds?


#7

If FFmpeg is used as decoder for playing media in CasparCG - does anybody know (developers for example)))) what kind of values it returns in OSC packets? Please share it with me))))
Thank you!


#8

It sounds like you are trying to reverse engineer osc data encoding.
There are many OSC libraries out there that can handle this for you, but if you can’t use one of them I suggest looking up the osc spec to figure out how it encodes data.
All casparcg is doing here is reporting the time in seconds (with decimal values being possible)


#9

The problem is: Caspar tells not decimal values of seconds. After address “channel/1/layer/5/file/time/“ I found 14 bytes. 1 to 6 always the same, 7 to 10 is changing (increasing), 11 to 14 is the same, but it’s different for different files. I interpret chars 7 to 8 as two-byte. Also 11 to 12 as two-byte. Convert it into integer. So I have a “total value” and “current”. But I still can’t understand why current value doesn’t start from zero. For example: current value starts from 15779. And total value is about 16844… what is this? It seems like file is 1065 units long. File is 25 sec @ 25 fps. And one thing else! Start value is differ depending of frame rate. Who can tell me how to interpret those values?
Thank you


#10

Why do you ignore this? Why would you want to do it on the byte level?


#11

Indeed try to use a lib ;).

I tried this also, one off the things is that OSC has always a multiple of 4byte’s (if i’am right) if the data is shorter the rest will be filled out. Making a parser for it aint easy.
And has been done several times in a good fashion. (why re inventing the wheel)

what code language are you working in ?


#12

I never used OSC yet. I was just asking myself, why anybody would want to parse these messages by hand. I usually progam in Visual Basic dotNET


#13

Because I’m using LiveCode and didn’t find libraries for it. Obviously I found what I need, but I need to make a final step - the help from the guys who develop the CasparCG would be very useful


#14

Ok i see Livecode indeed has no decent OSC lib.
Thats why i am moving a way from it.
but i can take a look if i have this little helper program i once made
that converts it to a other format.
this will be later as i am on a job now and the upcpming days
:wink:


#15

I find out that length of packets is multiply for 4. But I don’t need to get a universal algorithm for parsing. I need to parse a specific addresses - file/time and file/frame and file/fps. I determine the exact position of needed bytes. Main goal for me is to know how to interpret received values