<div dir="ltr">I am muxing video using ffmpeg 2.1.3 with libavcodec 55.39.101 (forced to that version because is the one available in google-chrome PNACL port project). all my frames seems to have bad the time. they try to be rendered all at once at the beggining of the video when playing it.<br><br>I am setting the stream time base to 1/25, but just after calling avformat_write_header, it has the value of -18082736/1. in each frame, when I print the stream time_base it says 1/12800, while the time_base of codec is always ok (1/25).<br><br>console log before and after av_format_write_header:<br><br>before avformat_write_header stream time_base: 1/25<br>after avformat_write_header ret 0 stream time_base: -18082736/1<br><br>the code (abreviated to keep the post short, all calls in the original version had error checking):<br><br>AVCodecContext *codecContext;<br>AVCodec * codec = avcodec_find_encoder(codec_id);  <br>myOutputStream->stream = avformat_new_stream(outputFormatContext, *codec);<br>myOutputStream->stream->id = outputFormatContext->nb_streams-1;<br>codecContext = myOutputStream->stream->codec;<br>codecContext->codec_id = codec_id;<br>codecContext->bit_rate = 400000;<br>codecContext->width    = width;<br>codecContext->height   = height;<br>myOutputStream->stream->time_base = (AVRational){ 1, 25 };<br>codecContext->time_base       = myOutputStream->stream->time_base;<br>codecContext->gop_size      = 12; <br>codecContext->pix_fmt       = AV_PIX_FMT_YUV420P;<br>AVDictionary *opt = NULL;<br>av_dict_copy(&opt, opt_arg, 0);<br>ret = avcodec_open2(codecContext, codec, &opt);<br>av_dict_free(&opt);<br>myOutputStream->frame = alloc_picture(codecContext->pix_fmt, codecContext->width, codecContext->height);<br>  myOutputStream->tmp_frame = alloc_picture(AV_PIX_FMT_YUV420P, codecContext->width, codecContext->height);<br><br>//before: printing g_outputContext->stream time_base here<br>ret = avformat_write_header(g_outputContext, &opt);<br>//after: printing g_outputContext->stream time_base here<br><br><br>(note: I also posted this question in stackoverflow: <a href="http://stackoverflow.com/questions/29850246/ffmpeg-avformat-write-header-changing-my-stream-time-base">http://stackoverflow.com/questions/29850246/ffmpeg-avformat-write-header-changing-my-stream-time-base</a>)<br><div><div><br><br clear="all"><div><div class="gmail_signature"><div dir="ltr">Cesar  Pachón<br>-------------------------------------------------------------<br><a href="http://www.cesarpachon.com" target="_blank">www.cesarpachon.com</a>, just a digital hermit<br><br></div></div></div>
</div></div></div>