[FFmpeg-devel] [PATCH v2] lavf/movenc: suggest video_track_timescale for invalid timescale

Nicolas George george at nsup.org
Wed Oct 12 10:03:39 EEST 2016


Le decadi 20 vendémiaire, an CCXXV, Josh de Kock a écrit :
> Fixes ticket #5882. While it doesn't automatically set the timescale
> for the user as that would destroy data without prompt, it will tell
> the user how they could set the timescale (as this is mostly likely
> what they want).
> 
> Signed-off-by: Josh de Kock <josh at itanimul.li>
> ---
> 
> >Would it be useful to print the max duration?
>  I'm not entirely sure, open to suggestions though.
> 
>  libavformat/movenc.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index d7c7158..6bada25 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -5677,11 +5677,16 @@ static int mov_write_header(AVFormatContext *s)
>                  ret = AVERROR(EINVAL);
>                  goto error;
>              }
> -            if (track->mode == MODE_MOV && track->timescale > 100000)
> +            if (track->mode == MODE_MOV && track->timescale > 100000) {
> +                /* NOTE: forcing setting the suggested timescale manually means ffmpeg won't destroy
> +                 * timestamps without explicit instruction. */
> +                unsigned int suggested = (unsigned int)av_rescale(st->time_base.den, 1000, st->time_base.num);
>                  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");

> +                       "or choose different container. Using -video_track_timescale %d\n"

Nit: the leading dash is specific to the command-line tools. At the library
level, the option is named just "video_track_timescale".

> +                       "may fix this issue.\n", suggested);
> +            }
>              if (track->mode == MODE_MOV &&
>                  track->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
>                  track->tag == MKTAG('r','a','w',' ')) {

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20161012/0b800130/attachment.sig>


More information about the ffmpeg-devel mailing list