Wowza Community

Getting absolute timecode


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)


timecode = packet.getTimecode();


packet.setTimecodes(timecode, 100000+timecode);

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

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

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



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?



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.


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.