diff options
author | Marton Balint <cus@passwd.hu> | 2016-08-08 19:24:18 -0400 |
---|---|---|
committer | Diego Biurrun <diego@biurrun.de> | 2016-11-17 09:21:23 +0100 |
commit | bcefafa226dcda23d4d9af9601d19389cb918a5b (patch) | |
tree | 5a8c04c61019b3ae38c59e2e7c941972edb3037a | |
parent | 481ff3cf018811ba3235f1c236e970f32a6300b9 (diff) | |
download | ffmpeg-bcefafa226dcda23d4d9af9601d19389cb918a5b.tar.gz |
avisynth: Fix setting stream timebase
Stream timebase should be set using avpriv_set_pts_info, otherwise
avctx->pkt_timebase is not correct, leading to A/V desync.
Signed-off-by: Marton Balint <cus@passwd.hu>
Reviewed-by: Stephen Hutchinson <qyot27@gmail.com>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
-rw-r--r-- | libavformat/avisynth.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/libavformat/avisynth.c b/libavformat/avisynth.c index 7d5b139ade..0e1365bf87 100644 --- a/libavformat/avisynth.c +++ b/libavformat/avisynth.c @@ -237,13 +237,12 @@ static int avisynth_create_stream_video(AVFormatContext *s, AVStream *st) st->codecpar->width = avs->vi->width; st->codecpar->height = avs->vi->height; - st->time_base = (AVRational) { avs->vi->fps_denominator, - avs->vi->fps_numerator }; st->avg_frame_rate = (AVRational) { avs->vi->fps_numerator, avs->vi->fps_denominator }; st->start_time = 0; st->duration = avs->vi->num_frames; st->nb_frames = avs->vi->num_frames; + avpriv_set_pts_info(st, 32, avs->vi->fps_denominator, avs->vi->fps_numerator); switch (avs->vi->pixel_type) { #ifdef USING_AVISYNTH @@ -311,9 +310,8 @@ static int avisynth_create_stream_audio(AVFormatContext *s, AVStream *st) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->sample_rate = avs->vi->audio_samples_per_second; st->codecpar->channels = avs->vi->nchannels; - st->time_base = (AVRational) { 1, - avs->vi->audio_samples_per_second }; - st->duration = avs->vi->num_audio_samples; + st->duration = avs->vi->num_audio_samples; + avpriv_set_pts_info(st, 64, 1, avs->vi->audio_samples_per_second); switch (avs->vi->sample_type) { case AVS_SAMPLE_INT8: |