[FFmpeg-trac] #428(avformat:new): avisynth generate wrong audio pts

FFmpeg trac at avcodec.org
Sat Sep 3 16:16:47 CEST 2011


#428: avisynth generate wrong audio pts
----------------------+--------------------------
 Reporter:  chinshou  |        Type:  defect
   Status:  new       |    Priority:  normal
Component:  avformat  |     Version:  unspecified
 Keywords:            |  Blocked By:
 Blocking:            |  Reproduced:  0
 Analyzed:  0         |
----------------------+--------------------------
 I just found avisynth.c generate very large audio pts.

 we can use ffplay to play following avs

 a0=DirectShowSource("1.avi")
 v1=ImageSource("1.jpg", start=0, end = 14900,
 fps=30).BilinearResize(320,240)
 video=FlipVertical(v1)
 audio=(a0)
 AudioDubEx(video,audio)

 From the ffplay console log

 18178.97 A-V:18166.132 s:0.0 aq=  314KB vq= 8552KB sq=    0B f=0/0   /0

 I noticed that audio pts was very large than video pts.It seems we should
 remove following code from avisynth_read_packet function

   pkt->pts = stream->read;<-------------remove this line

 and correct pts should be

   pkt->pts = avs->streams[stream_id].read /
 avs->streams[stream_id].chunck_samples;


 static int avisynth_read_packet(AVFormatContext *s, AVPacket *pkt)
 {
 ...
   if (av_new_packet(pkt, stream->chunck_size))
     return AVERROR(EIO);
   pkt->stream_index = stream_id;
   pkt->pts = avs->streams[stream_id].read /
 avs->streams[stream_id].chunck_samples;

   res = AVIStreamRead(stream->handle, stream->read,
 stream->chunck_samples, pkt->data, stream->chunck_size, &read_size, NULL);

   pkt->pts = stream->read;<-------------remove this line
   pkt->size = read_size;

   stream->read += stream->chunck_samples;

 ...
 }

 best regards
 chinshou

-- 
Ticket URL: <http://avcodec.org/trac/ffmpeg/ticket/428>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list