<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>I am attempting to mux footage from a variety of webcams into standards based files. The footage is spread over a large number of files (all from the same camera). The files are a proprietary format containing the encoded frames that came directly from the
 camera (in most cases it is H.264, MJPEG or MPEG4 with G.711 or PCM16 audio). Audio is optional.</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">I have created a pipeline for processing the footage that comprises of a reader for the files (this reads the frames and pushes them through the pipeline), a file sync that picks a suitable file format (based on the incoming
 video and audio formats) and writes the already encoded frames into the file. I am purposely not using a transcoder to save processing time.</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">This is working well with one exception, I can't tell what the frame rate is ahead of time because I can't read the files before I process them. If I set the frame rate to what I suspect the camera will give me (i.e. 30 fps)
 then I get collisions in PTS values if the camera has been bursty or the fps is actually higher and I drop frames (which may or may not be key frames).</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">I have tried setting the time_base of the video stream to 1/1000 and calculating the frame pts based on the millisecond timestamp. This works in theory but in
</span>practice the only player that can handle playing this back successfully is Media Player Classic and all the files report a frame rate of 1000 (which is understandable).</p>
<p><br>
</p>
<p>I am currently alternating between .mkv, .mp4 and .avi depending on the incoming codecs. .mp4 for h.264 or MPEG4 only, avi for h.264, MJEPG or MPEG4 with PCM audio and mkv as a fallback for all other cases.</p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">1. </span><span style="font-size: 12pt;">Is there any way to achieve this?</span></p>
<p>2. Is there a particular container type that will enable me to achieve this?</p>
<p>3. Would I have any more success if I transcoded the frames to a guaranteed particular video and audio codecs?</p>
<p>4. Is there another way to achieve a variable frame rate?</p>
<p><br>
</p>
<p>Thanks for your help,</p>
<p>Robert</p>
<p><br>
</p>
</div>
</body>
</html>