Advertisement
Technologov

ffmpeg-git Apple Quicktime patch (timebase issue; bug #5882)

Oct 11th, 2016
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.09 KB | None | 0 0
  1. diff -uNr -U 6 ffmpeg-git-orig/libavformat/movenc.c ffmpeg-git/libavformat/movenc.c
  2. --- ffmpeg-git-orig/libavformat/movenc.c    2016-10-11 10:42:02.599749985 -0400
  3. +++ ffmpeg-git/libavformat/movenc.c 2016-10-11 10:44:28.004413547 -0400
  4. @@ -5669,22 +5669,26 @@
  5.                  track->timescale = mov->video_track_timescale;
  6.              } else {
  7.                  track->timescale = st->time_base.den;
  8.                  while(track->timescale < 10000)
  9.                      track->timescale *= 2;
  10.              }
  11. +            if (track->timescale > 100000) {
  12. +                unsigned int timescale_new = (unsigned int)((double)(st->time_base.den)
  13. +                * 1000 / (double)(st->time_base.num));
  14. +                av_log(s, AV_LOG_WARNING,
  15. +                       "WARNING codec timebase is very high. If duration is too long,\n"
  16. +                       "file may not be playable by Apple Quicktime. Auto-setting\n"
  17. +                       "a shorter timebase %u instead of %d.\n", timescale_new, track->timescale);
  18. +                track->timescale = timescale_new;
  19. +            }
  20.              if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
  21.                  av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for mov/mp4\n", st->codecpar->width, st->codecpar->height);
  22.                  ret = AVERROR(EINVAL);
  23.                  goto error;
  24.              }
  25. -            if (track->mode == MODE_MOV && track->timescale > 100000)
  26. -                av_log(s, AV_LOG_WARNING,
  27. -                       "WARNING codec timebase is very high. If duration is too long,\n"
  28. -                       "file may not be playable by quicktime. Specify a shorter timebase\n"
  29. -                       "or choose different container.\n");
  30.              if (track->mode == MODE_MOV &&
  31.                  track->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
  32.                  track->tag == MKTAG('r','a','w',' ')) {
  33.                  enum AVPixelFormat pix_fmt = track->par->format;
  34.                  if (pix_fmt == AV_PIX_FMT_NONE && track->par->bits_per_coded_sample == 1)
  35.                      pix_fmt = AV_PIX_FMT_MONOWHITE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement