[Libav-user] Loosing Video Frames

Gonzalo ggarra13 at gmail.com
Tue Oct 13 01:51:44 CEST 2015



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).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20151012/46a28cc9/attachment.html>


More information about the Libav-user mailing list