summaryrefslogtreecommitdiff
path: root/libavformat/matroskaenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2014-05-18 13:49:46 +0200
committerAnton Khirnov <anton@khirnov.net>2014-05-29 08:00:57 +0200
commit81eec081afea9fc017a175581ceea7c420a0dfc3 (patch)
treecee90baacb79efbb06a7dc092bd977f961e0bcb9 /libavformat/matroskaenc.c
parenta53551cba86bb67efcb6105fdc337a36c43132bd (diff)
matroskaenc: base DefaultDuration on the framerate, not the codec timebase
This results in DefaultDuration not being written when the framerate is not known, but as this field is purely informative, this should not break any sane demuxers.
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r--libavformat/matroskaenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f2b9ee91af..0a3775daea 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -676,7 +676,8 @@ static int mkv_write_tracks(AVFormatContext *s)
switch (codec->codec_type) {
case AVMEDIA_TYPE_VIDEO:
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_VIDEO);
- put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, av_q2d(codec->time_base)*1E9);
+ if (st->avg_frame_rate.num > 0 && st->avg_frame_rate.den > 0)
+ put_ebml_uint(pb, MATROSKA_ID_TRACKDEFAULTDURATION, 1E9 / av_q2d(st->avg_frame_rate));
if (!native_id &&
ff_codec_get_tag(ff_codec_movvideo_tags, codec->codec_id) &&