On Sun, 26 Feb 2012, Justin Ruggles wrote:

---
libavformat/movenc.c |    2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e2781ac..5d9b2d7 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2215,7 +2215,7 @@ static int mov_write_tfhd_tag(AVIOContext *pb, MOVTrack 
*track,
    if (flags & MOV_TFHD_BASE_DATA_OFFSET)
        avio_wb64(pb, moof_offset);
    if (flags & MOV_TFHD_DEFAULT_DURATION) {
-        track->default_duration = track->audio_vbr ? track->enc->frame_size : 
1;
+        track->default_duration = track->audio_vbr ? 
get_cluster_duration(track, 0) : 1;
        avio_wb32(pb, track->default_duration);
    }
    if (flags & MOV_TFHD_DEFAULT_SIZE) {
--
1.7.1

You could remove the audio_vbr?: stuff altogether - the default duration 1 for other formats is no better than the duration of the first packet either. For CFR with a time base identical to the frame rate, it normally is 1, but for other time base setups, the duration can be something else than 1, and then the first packet duration is a better guess.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to