Encoding with variable frame rate in ffmpeg -
till doing of encoding using fixed frame (programmatically) using ffmpeg. need support variable frame rate. started commenting portion of code setting frame rate. not working. function failing @ avcodec_open2. please suggest me how go supporting variable frame rate. came know not codec support variable frame rate. codecs used when encoding variable frame rate. please suggest.
thanks pradeep
i realize post pretty old, hope being able folks having same problem (i did)...
use fps filter or framerate filter. being ffpmeg n00b well, there's no guarantee 100% correctness, @ least worked me:
i created filtergraph in filtering_video.c example. filters argument of avfilter_graph_parse_ptr, specified fps=fps=30:round=near, example. fed frames filtergraph whenever got some, calculating pts as
float fps = (float)( codeccontext->time_base.num ) / codeccontext->time_base.den; this->frame->pts = (__int64)( ( timestamp - timestamp0 ) / fps ); where timestamp frame's time in seconds , timestamp0 time of first frame being recorded. both floating point values , result custom built timer. when you're using library providing timestamps captured frames (such directshow), should of course use those.
Comments
Post a Comment