# Getting absolute timecode

**URL:** https://community.wowza.com/t/getting-absolute-timecode/34314
**Category:** Wowza Developer Dojo
**Tags:** wowza-streaming-server-java-api
**Created:** [April 2, 2012, 1:50pm UTC](https://community.wowza.com/t/getting-absolute-timecode/34314 "2012-04-02T13:50:41Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Milos\_Vulic](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@Milos\_Vulic](https://community.wowza.com/u/Milos_Vulic)
#### Post date: [April 2, 2012, 1:50pm UTC](https://community.wowza.com/t/getting-absolute-timecode/34314/1 "2012-04-02T13:50:41Z")

</div>

Hello,

I am trying to implement the module that merges a/v from the several separate files.

I have noticed that AMFPacket.getTimeCode() normally gives the values starting from 0 for each particular file. Now, I need to have absTimeCode in each of those files, which will contain timestamp describing particular date and time with millisecond precision.

Here is a short excerpt of the code:

[HTML] long timecode = 0;

while (true) {

AMFPacket packet = FLVUtils.readChunk(inStream);

if (packet == null)

break;

timecode = packet.getTimecode();

packet.setAbsTimecode(100000+timecode);

packet.setTimecodes(timecode, 100000+timecode);

[//System.out.println](https://System.out.println)("abstc: " + packet.getAbsTimecode());

FLVUtils.writeChunk(outStream, packet.getDataBuffer(), packet

.getSize(), packet.getTimecode(), (byte) packet.getType());

}

[/HTML]

Now, the problem is in the fact that FLVUtils.writeChunk writes only AMFPacket.getTimeCode value - the value related to the absolute timecode is ignored. I can see that packet.setTimecodes() sets the correct time codes and they are later correctly readable in the application. However, once the packet is written, in the subsequent read operations on the file absTimeCode is always returned as a 0.

The second question related to this problem is: can I modify absolute time code of the packets on the fly on the live streaming (e.g. updating with the server time) and have that saved in the file recorded using LiveRecord module?

Thanks,

Milos

---

<div class="post-metadata">

### Author: ![Charlie\_Good](https://sea2.discourse-cdn.com/flex002/user_avatar/community.wowza.com/charlie_good/32/383_2.png) [@Charlie\_Good](https://community.wowza.com/u/Charlie_Good)
#### Post date: [April 3, 2012, 3:19pm UTC](https://community.wowza.com/t/getting-absolute-timecode/34314/2 "2012-04-03T15:19:54Z")

</div>

You can’t really re-write live stream timcodes.

I am not sure I understand the first question. Can you explain in more detail the problem.

Charlie

---

<div class="post-metadata">

### Author: ![Ilya\_Tetin](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@Ilya\_Tetin](https://community.wowza.com/u/Ilya_Tetin)
#### Post date: [November 28, 2012, 4:29pm UTC](https://community.wowza.com/t/getting-absolute-timecode/34314/3 "2012-11-28T16:29:42Z")

</div>

Pardon my intrusion, but I believe I am facing the same problem as milosv had described.

The timecode that is written to a packet in FLVUtils.writeChunk() gets written to the packet’s **timecode** , not **absolute timecode**. Absolute timecodes are all zeroes then.

Documentation states that **timecode** is relative to the _previous_ packet, but in effect it is relative to the beginning of the file - like **absolute timecode** is supposed to be. It’s not technically a problem though, because I get all the information that I need.
