For most formats, it is done before reading packets, but for formats without global headers, new streams are added afterwards. Ensure that a time base is set even if no decoder was found. Useful for parsers. Signed-off-by: Nicolas George <nicolas.george@normalesup.org> --- libavformat/utils.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavformat/utils.c b/libavformat/utils.c index 0f13304..903ada3 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2947,6 +2947,14 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options) compute_chapters_end(ic); + for(i = 0; i < ic->nb_streams; i++) { + st = ic->streams[i]; + if ((st->codec->codec_type == AVMEDIA_TYPE_VIDEO || + st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) && + !st->codec->time_base.num) + st->codec->time_base = st->time_base; + } + find_stream_info_err: for (i=0; i < ic->nb_streams; i++) { if (ic->streams[i]->codec) -- 1.7.10.4