Yes , the fps and start value doesnt match with the input video. I am setting up fps of output stream to match inputstream's fps but it has no effect . av_stream_set_r_frame_rate(out_stream,av_stream_get_r_ frame_rate(inputStream));
PS - I am now able to recover all the frames. earlier i was not flushing the encoder for delayed frames. I was flushing only the decoder. On Tue, Oct 13, 2015 at 5:21 AM, Gonzalo <[email protected]> wrote: > > > El 12/10/15 a las 10:31, gaurav mishra escribió: > > Update - > I added some code after my main while loop to flush remaining frames from > codec. > Also i have added one more variable while configuring my encoder ie > gop_size. these two changes have improved the situation. > the lost amount of video has come down to approx 0.9 secs. > > *Question- what codec settings i have missed which are required to make > sure that input and output files are identical. * > my current encoder setting code looks like - > > c->codec_id = inputStream->codec->codec_id; > c->bit_rate = inputStream->codec->bit_rate; > > /* Resolution must be a multiple of two. */ > c->width = inputStream->codec->width; > c->height = inputStream->codec->height; > c->gop_size = inputStream->codec->gop_size; > > c->time_base = inputStream->codec->time_base; > out_stream->time_base = inputStream->time_base; > > av_stream_set_r_frame_rate(out_stream,av_stream_get_r_frame_rate(inputStream)); > > c->pix_fmt = AV_PIX_FMT_YUV420P; > c->sample_aspect_ratio.num = > inputStream->codec->sample_aspect_ratio.num; > c->sample_aspect_ratio.den = > inputStream->codec->sample_aspect_ratio.den; > if (oc->oformat->flags & AVFMT_GLOBALHEADER) > c->flags |= CODEC_FLAG_GLOBAL_HEADER; > > > following are line from ffmpeg -i > *for input file -* > > Duration: 00:00:30.92, start: 0.040000, bitrate: 998 kb/s > > 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) > > Metadata: > > handler_name : VideoHandler > > > *for output file - * > > Duration: 00:00:30.02, start: 0.000000, bitrate: 1022 kb/s > > 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) > > Metadata: > > handler_name : VideoHandler > > Did not check your code, but your output file has a wrong FPS (25.02) > value and a wrong start value (0.00000). > > > _______________________________________________ > Libav-user mailing list > [email protected] > http://ffmpeg.org/mailman/listinfo/libav-user > >
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
