[FFmpeg-cvslog] matroskaenc: base DefaultDuration on the framerate, not the codec timebase
Anton Khirnov
git at videolan.org
Thu May 29 13:05:26 CEST 2014
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun May 18 13:49:46 2014 +0200| [81eec081afea9fc017a175581ceea7c420a0dfc3] | committer: Anton Khirnov
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.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=81eec081afea9fc017a175581ceea7c420a0dfc3
---
libavformat/matroskaenc.c | 3 ++-
tests/ref/lavf/mkv | 4 ++--
tests/ref/seek/lavf-mkv | 44 ++++++++++++++++++++++----------------------
3 files changed, 26 insertions(+), 25 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index f2b9ee9..0a3775d 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) &&
diff --git a/tests/ref/lavf/mkv b/tests/ref/lavf/mkv
index a75873a..6762e44 100644
--- a/tests/ref/lavf/mkv
+++ b/tests/ref/lavf/mkv
@@ -1,3 +1,3 @@
-48237728e90d74a12d0fe9ae51d23759 *./tests/data/lavf/lavf.mkv
-320389 ./tests/data/lavf/lavf.mkv
+f424aea501255b846f579e1231a99f57 *./tests/data/lavf/lavf.mkv
+320381 ./tests/data/lavf/lavf.mkv
./tests/data/lavf/lavf.mkv CRC=0xbe7d3cda
diff --git a/tests/ref/seek/lavf-mkv b/tests/ref/seek/lavf-mkv
index d0a441d..99d1b48 100644
--- a/tests/ref/seek/lavf-mkv
+++ b/tests/ref/seek/lavf-mkv
@@ -1,53 +1,53 @@
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st:-1 flags:0 ts:-1.000000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st:-1 flags:1 ts: 1.894167
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:0 ts: 0.788000
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 ts:-0.317000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:0 ts: 2.577000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.471000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st:-1 flags:0 ts: 0.365002
-ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st:-1 flags:1 ts:-0.740831
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 0 flags:0 ts: 2.153000
ret:-EOF
ret: 0 st: 0 flags:1 ts: 1.048000
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 1 flags:0 ts:-0.058000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:1 ts: 2.836000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st:-1 flags:0 ts: 1.730004
ret:-EOF
ret: 0 st:-1 flags:1 ts: 0.624171
-ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st: 0 flags:0 ts:-0.482000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 0 flags:1 ts: 2.413000
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 1 flags:0 ts: 1.307000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 0.201000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st:-1 flags:0 ts:-0.904994
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st:-1 flags:1 ts: 1.989173
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:0 ts: 0.883000
-ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292277 size: 27834
+ret: 0 st: 0 flags:1 dts: 0.971000 pts: 0.971000 pos: 292269 size: 27834
ret: 0 st: 0 flags:1 ts:-0.222000
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
ret: 0 st: 1 flags:0 ts: 2.672000
ret:-EOF
ret: 0 st: 1 flags:1 ts: 1.566000
-ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320118 size: 209
+ret: 0 st: 1 flags:1 dts: 0.982000 pts: 0.982000 pos: 320110 size: 209
ret: 0 st:-1 flags:0 ts: 0.460008
-ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146830 size: 27925
+ret: 0 st: 0 flags:1 dts: 0.491000 pts: 0.491000 pos: 146822 size: 27925
ret: 0 st:-1 flags:1 ts:-0.645825
-ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 639 size: 208
+ret: 0 st: 1 flags:1 dts:-0.011000 pts:-0.011000 pos: 631 size: 208
More information about the ffmpeg-cvslog
mailing list