# OSC parsing

**URL:** <https://casparcgforum.org/t/osc-parsing/773>\
**Category:** General\
**Created:** [September 14, 2018, 5:15pm UTC](https://casparcgforum.org/t/osc-parsing/773 "2018-09-14T17:15:22Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 14, 2018, 5:15pm UTC](https://casparcgforum.org/t/osc-parsing/773/1 "2018-09-14T17:15:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rrebuffo](https://casparcgforum.org/user_avatar/casparcgforum.org/rrebuffo/32/165_2.png) [@rrebuffo](https://casparcgforum.org/u/rrebuffo)\
**Post date:** [September 14, 2018, 5:34pm UTC](https://casparcgforum.org/t/osc-parsing/773/2 "2018-09-14T17:34:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 14, 2018, 5:47pm UTC](https://casparcgforum.org/t/osc-parsing/773/3 "2018-09-14T17:47:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 14, 2018, 5:55pm UTC](https://casparcgforum.org/t/osc-parsing/773/4 "2018-09-14T17:55:11Z")

</div>

> [@rrebuffo](#):
>
> there are two values, the first should change, the second doesn’t.

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?

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 14, 2018, 10:20pm UTC](https://casparcgforum.org/t/osc-parsing/773/5 "2018-09-14T22:20:29Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 15, 2018, 10:27am UTC](https://casparcgforum.org/t/osc-parsing/773/6 "2018-09-15T10:27:27Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 15, 2018, 11:18am UTC](https://casparcgforum.org/t/osc-parsing/773/7 "2018-09-15T11:18:10Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Julusian](https://casparcgforum.org/user_avatar/casparcgforum.org/julusian/32/12_2.png) [@Julusian](https://casparcgforum.org/u/Julusian)\
**Post date:** [September 19, 2018, 9:32am UTC](https://casparcgforum.org/t/osc-parsing/773/8 "2018-09-19T09:32:12Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 24, 2018, 3:11pm UTC](https://casparcgforum.org/t/osc-parsing/773/9 "2018-09-24T15:11:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [September 24, 2018, 3:21pm UTC](https://casparcgforum.org/t/osc-parsing/773/10 "2018-09-24T15:21:52Z")

</div>

> [@Julusian](#):
>
> 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)

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

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [September 24, 2018, 3:30pm UTC](https://casparcgforum.org/t/osc-parsing/773/11 "2018-09-24T15:30:38Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [September 24, 2018, 3:32pm UTC](https://casparcgforum.org/t/osc-parsing/773/12 "2018-09-24T15:32:58Z")

</div>

> [@Maurice78](#):
>
> what code language are you working in ?

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

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 24, 2018, 4:12pm UTC](https://casparcgforum.org/t/osc-parsing/773/13 "2018-09-24T16:12:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [September 24, 2018, 4:19pm UTC](https://casparcgforum.org/t/osc-parsing/773/14 "2018-09-24T16:19:58Z")

</div>

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  
😉

---

<div class="post-metadata">

**Author:** ![ultravibeman](https://casparcgforum.org/user_avatar/casparcgforum.org/ultravibeman/32/1308_2.png) [@ultravibeman](https://casparcgforum.org/u/ultravibeman)\
**Post date:** [September 24, 2018, 6:48pm UTC](https://casparcgforum.org/t/osc-parsing/773/15 "2018-09-24T18:48:15Z")

</div>

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
