[FFmpeg-devel] [PATCH] Apple Quicktime fix
Josh de Kock
josh at itanimul.li
Tue Oct 11 21:29:10 EEST 2016
On 11/10/2016 18:24, Alexey Eromenko wrote:
> ---
> libavformat/movenc.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 8b4aa5f..0e2fc55 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5666,16 +5666,20 @@ static int mov_write_header(AVFormatContext *s)
> while(track->timescale < 10000)
> track->timescale *= 2;
> }
> + if (track->timescale > 100000 && (!mov->video_track_timescale)) {
As I said before, having this as 'default' behaviour would interfere
with large, but correct timescales. This should only be a suggestion to
the user.
> + unsigned int timescale_new = (unsigned int)((double)(st->time_base.den)
> + * 1000 / (double)(st->time_base.num));
You surely don't need all these casts.
> + av_log(s, AV_LOG_WARNING,
> + "WARNING codec timebase is very high. If duration is too long,\n"
> + "file may not be playable by Apple Quicktime. Auto-setting\n"
> + "a shorter timebase %u instead of %d.\n", timescale_new, track->timescale);
> + track->timescale = timescale_new;
> + }
> 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);
> ret = AVERROR(EINVAL);
> goto error;
> }
> - if (track->mode == MODE_MOV && track->timescale > 100000)
> - av_log(s, AV_LOG_WARNING,
> - "WARNING codec timebase is very high. If duration is too long,\n"
> - "file may not be playable by quicktime. Specify a shorter timebase\n"
> - "or choose different container.\n");
Keep the logic in the same place please.
> if (track->mode == MODE_MOV &&
> track->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
> track->tag == MKTAG('r','a','w',' ')) {
>
--
Josh
More information about the ffmpeg-devel
mailing list