<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
        {font-family:Calibri}
@font-face
        {font-family:Tahoma}
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif"}
span.EmailStyle17
        {font-family:"Calibri","sans-serif";
        color:windowtext}
span.BalloonTextChar
        {font-family:"Tahoma","sans-serif"}
.MsoChpDefault
        {font-family:"Calibri","sans-serif"}
@page WordSection1
        {margin:72.0pt 72.0pt 72.0pt 72.0pt}
div.WordSection1
        {}
-->
</style>
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Hello,</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I’ve been working with multicat recently and noticed some problems when concatenating input chunks of video streams, produced also by multicat, back into the original stream and also found what might be the reason for the problem. Please
 review the explanation bellow and give your comments.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">First of all several one minute chunks were produced with the following command:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-size:10.0pt; font-family:"Courier New"">multicat –u –U –r 1620000000 @<i>multicast_IP output_dir</i></span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Then linux command <span style="font-family:"Courier New"">cat</span> was used to rebuild the original stream.</p>
<p class="MsoNormal">When played back the stream, at the position in time of each join the video was scrambled for very short period (about a second) and then moved on correctly.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I troubleshoot the problem and found that time stamp was not correctly calculated when creating a new file, i.e. function GetDirFile, for a fraction of a second, was returning wrong file name referencing the time in the past. For this reason
 output stream for really short period of time was alternately written back and forth into two files.</p>
<p class="MsoNormal">Afterwards everything was back to normal until next file creation.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">What I did to remedy the situation was casting the constant 27/1000 to uint64_t type in the function _<i>wall</i>_Date:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Line:</p>
<p class="MsoNormal">return ((uint64_t)ts.tv_sec * (uint64_t)27000000) + (uint64_t)(ts.tv_nsec * 27 / 1000);</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">was changed to:</p>
<p class="MsoNormal">return ((uint64_t)ts.tv_sec * (uint64_t)27000000 + (uint64_t)(ts.tv_nsec) * (uint64_t)0.027 );</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">It might be that some arithmetic error occurred due to different types.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">With this modification we had smooth transition in the output video stream.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Please note that I tried to concatenate the chunks with the multicat command itself, but the output stream was not usable, i.e it was scrambled in some time sequences and time duration was significantly shortened.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">System configuration:</p>
<p class="MsoNormal">OS: Ubuntu 13.10</p>
<p class="MsoNormal">Multicat release: multicat-2.0</p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
ONE Telecommunications Services Limited Liability Company Skopje<br>
<br>
This e-mail (including any attachments) is confidential and may be protected by legal privilege. If you are not the intended recipient, you should not copy it, re-transmit it, use it or disclose its contents, but should return it to the sender immediately and
 delete your copy from your system. Any unauthorized use or dissemination of this message in whole or in part is strictly prohibited. Please note that e-mails are susceptible to change. ONE Limited Liability Company Skopje shall not be liable for the improper
 or incomplete transmission of the information contained in this communication nor for any delay in its receipt or damage to your system.<br>
</font>
</body>
</html>