<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
{font-family:"MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:"\@MS Mincho";
panose-1:2 2 6 9 4 2 5 8 3 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hi All,<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I downloaded windows ffmpeg build from <a href="http://ffmpeg.zeranoe.com/builds/">http://ffmpeg.zeranoe.com/builds/</a>. The build downloaded is ffmpeg-20121009-git-f3f35f7-win32-shared.7z & ffmpeg-20121009-git-f3f35f7-win32-dev.7z.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I built “examples/demuxing.c” using Visual Studio 10 on windows. However, it’s not working. When invoked with command line: <exename> output.mp4, it’s exiting with the following errors:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>[mp4 @ 00582ea0] Encoder did not produce proper pts, making some up.<o:p></o:p></p><p class=MsoNormal>[mp4 @ 00582ea0] pts (0) < dts (1) in stream 0<o:p></o:p></p><p class=MsoNormal>Error while writing video frame<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I figured out that av_interleaved_write_frame is failing because a call to avcodec_encode_video2 is not changing AVCodecContext::coded_frames->pts. It’s always 0, and hence AVPacket.pts is 0. However the call to avcodec_encode_video2 is increasing the AVPacket.dts value from -2, -1, 0, 1. So in 4<sup>th</sup> call to av_interleaved_write_frame, AVPacket.pts < AVPacket.dts causing the issue.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I made some code changes to ensure that pts > dts, and then the file was written. However when opened in Windows Media Player Classic, the file is showing a frame rate of 12800. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I was using following. Modified STREAM_DURATION to 10.0 from 200.0.<o:p></o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#define</span><span style='font-size:9.5pt;font-family:Consolas'> STREAM_DURATION 10.0<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#define</span><span style='font-size:9.5pt;font-family:Consolas'> STREAM_FRAME_RATE 25 <span style='color:green'>/* 25 images/s */</span><o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas;color:blue'>#define</span><span style='font-size:9.5pt;font-family:Consolas'> STREAM_NB_FRAMES ((<span style='color:blue'>int</span>)(STREAM_DURATION * STREAM_FRAME_RATE))<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'>With these parameters,<span style='font-size:9.5pt;font-family:Consolas'> AVStream::codec->time_base = { num: 1, den: 25}, </span>but just after call to<span style='font-size:9.5pt;font-family:Consolas'> avformat_write_header, the AVStream::time_base = { num: 1, den: 12800 }.<o:p></o:p></span></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal style='text-autospace:none'>What’s going wrong?<span style='font-size:9.5pt;font-family:Consolas'> AVStream::time_base.den = 12800; </span>seems to be wrong data. Other than fixing some compilation errors, I did not modify anything else in examples/demuxing.c.<o:p></o:p></p><p class=MsoNormal style='text-autospace:none'><span style='font-size:9.5pt;font-family:Consolas'><o:p> </o:p></span></p><p class=MsoNormal>Regards,<o:p></o:p></p><p class=MsoNormal>Chandranath<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>