<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<br>
<br>
<div class="moz-cite-prefix">El 12/10/15 a las 10:31, gaurav mishra
escribió:<br>
</div>
<blockquote
cite="mid:CABTY04KxTJnP0tERMUg3xA67hJghBCwUfXnQQaz+8Jbq=CTizA@mail.gmail.com"
type="cite">
<div dir="ltr">Update -
<div>I added some code after my main while loop to flush
remaining frames from codec. </div>
<div>Also i have added one more variable while configuring my
encoder ie gop_size. these two changes have improved the
situation.</div>
<div>the lost amount of video has come down to approx 0.9 secs. </div>
<div><br>
</div>
<div><i>Question- what codec settings i have missed which are
required to make sure that input and output files are
identical. </i></div>
<div>my current encoder setting code looks like - </div>
<div><br>
</div>
<div>
<div> <font face="georgia, serif">c->codec_id
= inputStream->codec->codec_id;</font></div>
<div><font face="georgia, serif"> c->bit_rate
= inputStream->codec->bit_rate;</font></div>
<div><font face="georgia, serif"><br>
</font></div>
<div><font face="georgia, serif"> /* Resolution
must be a multiple of two. */</font></div>
<div><font face="georgia, serif"> c->width
= inputStream->codec->width;</font></div>
<div><font face="georgia, serif"> c->height
= inputStream->codec->height;</font></div>
<div><font face="georgia, serif"> c->gop_size
= inputStream->codec->gop_size;</font></div>
<div><font face="georgia, serif"> </font></div>
<div><font face="georgia, serif"> c->time_base
= inputStream->codec->time_base;</font></div>
<div><font face="georgia, serif">
out_stream->time_base = inputStream->time_base;</font></div>
<div><font face="georgia, serif">
av_stream_set_r_frame_rate(out_stream,av_stream_get_r_frame_rate(inputStream));</font></div>
<div><font face="georgia, serif"> </font></div>
<div><font face="georgia, serif"> c->pix_fmt
= AV_PIX_FMT_YUV420P;</font></div>
<div><font face="georgia, serif">
c->sample_aspect_ratio.num =
inputStream->codec->sample_aspect_ratio.num;</font></div>
<div><font face="georgia, serif">
c->sample_aspect_ratio.den =
inputStream->codec->sample_aspect_ratio.den;</font></div>
</div>
<div>
<div><font face="georgia, serif"> if
(oc->oformat->flags & AVFMT_GLOBALHEADER)</font></div>
<div><font face="georgia, serif"> c->flags
|= CODEC_FLAG_GLOBAL_HEADER;</font></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>following are line from ffmpeg -i </div>
<div><b>for input file -</b> </div>
<div>
<p class=""><span class=""><font face="georgia, serif"> Duration:
00:00:30.92, start: 0.040000, bitrate: 998 kb/s</font></span></p>
<p class=""><span class=""><font face="georgia, serif">
Stream #0:0(eng): Video: h264 (Main) (avc1 /
0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9],
996 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc (default)</font></span></p>
<p class=""><span class=""><font face="georgia, serif">
Metadata:</font></span></p>
<p class="">
</p>
<p class=""><span class=""><font face="georgia, serif">
handler_name : VideoHandler</font></span></p>
<p class=""><span class=""><br>
</span></p>
<p class=""><b>for output file - </b></p>
<p class=""><font face="georgia, serif">Duration: 00:00:30.02,
start: 0.000000, bitrate: 1022 kb/s</font></p>
<p class=""><span class=""><font face="georgia, serif">
Stream #0:0(und): Video: h264 (High) (avc1 /
0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 1019
kb/s, 25.02 fps, 25 tbr, 25k tbn, 100 tbc (default)</font></span></p>
<p class=""><span class=""><font face="georgia, serif">
Metadata:</font></span></p>
<p class=""><span class=""><font face="georgia, serif">
handler_name : VideoHandler</font></span></p>
</div>
<br>
</div>
</blockquote>
Did not check your code, but your output file has a wrong FPS
(25.02) value and a wrong start value (0.00000). <br>
<br>
</body>
</html>