Extend range of video_track_timescale flag value to -1 to indicate video stream timescale should be used for track timebase. Add debug message if video_track_timescale is not specified and the video stream timescale is clamped to greater than 10000.
Signed-off-by: vectronic <hello.vectro...@gmail.com> --- libavformat/movenc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 32e8109268..bcc0ab4377 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -92,7 +92,7 @@ static const AVOption options[] = { { "min_frag_duration", "Minimum fragment duration", offsetof(MOVMuxContext, min_fragment_duration), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, { "frag_size", "Maximum fragment size", offsetof(MOVMuxContext, max_fragment_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, { "ism_lookahead", "Number of lookahead entries for ISM files", offsetof(MOVMuxContext, ism_lookahead), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, - { "video_track_timescale", "set timescale of all video tracks", offsetof(MOVMuxContext, video_track_timescale), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, + { "video_track_timescale", "set timescale of all video tracks, -1 to use existing stream timescale", offsetof(MOVMuxContext, video_track_timescale), AV_OPT_TYPE_INT, {.i64 = 0}, -1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, { "brand", "Override major brand", offsetof(MOVMuxContext, major_brand), AV_OPT_TYPE_STRING, {.str = NULL}, .flags = AV_OPT_FLAG_ENCODING_PARAM }, { "use_editlist", "use edit list", offsetof(MOVMuxContext, use_editlist), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM}, { "fragment_index", "Fragment number of the next fragment", offsetof(MOVMuxContext, fragments), AV_OPT_TYPE_INT, {.i64 = 1}, 1, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM}, @@ -6454,14 +6454,19 @@ static int mov_init(AVFormatContext *s) } track->height = track->tag >> 24 == 'n' ? 486 : 576; } - if (mov->video_track_timescale) { + if (mov->video_track_timescale > 0) { track->timescale = mov->video_track_timescale; if (mov->mode == MODE_ISM && mov->video_track_timescale != 10000000) av_log(s, AV_LOG_WARNING, "Warning: some tools, like mp4split, assume a timescale of 10000000 for ISMV.\n"); } else { track->timescale = st->time_base.den; + if (mov->video_track_timescale != -1) { while(track->timescale < 10000) track->timescale *= 2; + if (track->timescale != st->time_base.den) + av_log(s, AV_LOG_DEBUG, "Stream timescale was low (%d), the track timescale has been forced to %d.\n" + "Specify -video_track_timescale -1 to prevent this.\n", st->time_base.den, track->timescale); + } } if (st->codecpar->width > 65535 || st->codecpar->height > 65535) { av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height); -- 2.24.2 (Apple Git-127) _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".