[FFmpeg-user] non monotonically increasing dts to muxer in stream
Gagandeep Bawa
gagandeep.bawa at ironroad.com
Fri Sep 23 15:45:26 CEST 2011
Hi Guys,
I am getting following error when i try to convert .mov file to .mp4 in
IPhone using 0.8.4 build libraries. Please help. It seems problem in setting
dts and pts. Find below my code which i am using to write audio frames. The
output video is having less duration (8-10 sec) and in start there are some
green frames.
Console Output:
**
*Output #0, mp4, to
'/var/mobile/Applications/20A7BB04-C8E0-4357-ACF6-28BE57C72FED/Documents/FFMPeg.mp4':
*
*
Stream #0.0: Video: mpeg4, yuv420p, 426x320, q=2-31, 384 kb/s, 90k tbn,
25 tbc
Stream #0.1: Audio: aac, 44100 Hz, 1 channels, s16, 63 kb/s
2011-09-23 18:34:02.223 iFrameExtractor[3036:707] Audio-pts
...............0.000000
2011-09-23 18:34:02.227 iFrameExtractor[3036:707] Video-pts
...............0.000000
2011-09-23 18:34:02.268 iFrameExtractor[3036:707] Audio-pts
...............0.000000
2011-09-23 18:34:02.273 iFrameExtractor[3036:707] Video-pts
...............0.040000
2011-09-23 18:34:02.279 iFrameExtractor[3036:707] Audio-pts
...............0.023220
2011-09-23 18:34:02.283 iFrameExtractor[3036:707] Video-pts
...............0.040000
2011-09-23 18:34:02.286 iFrameExtractor[3036:707] Audio pts
...............0.046440
2011-09-23 18:34:02.289 iFrameExtractor[3036:707] Video pts
...............0.040000
2011-09-23 18:34:02.307 iFrameExtractor[3036:707] Audio-pts
...............0.046440
2011-09-23 18:34:02.310 iFrameExtractor[3036:707] Video-pts
...............0.080000
[mp4 @ 0x11fc400] Application provided invalid, non monotonically increasing
dts to muxer in stream 1: 2048 >= 2048
Error while writing audio frame
2011-09-23 18:34:02.327 iFrameExtractor[3036:707] Audio-pts
...............0.069660
2011-09-23 18:34:02.330 iFrameExtractor[3036:707] Video-pts
...............0.080000
2011-09-23 18:34:02.339 iFrameExtractor[3036:707] Audio pts
...............0.092880
2011-09-23 18:34:02.342 iFrameExtractor[3036:707] Video pts
...............0.080000
2011-09-23 18:34:02.356 iFrameExtractor[3036:707] Audio-pts
...............0.092880
2011-09-23 18:34:02.359 iFrameExtractor[3036:707] Video-pts
...............0.120000
[mp4 @ 0x11fc400] Application provided invalid, non monotonically increasing
dts to muxer in stream 1: 4096 >= 4096
Error while writing audio frame
2011-09-23 18:34:02.374 iFrameExtractor[3036:707] Audio-pts
...............0.116100
2011-09-23 18:34:02.377 iFrameExtractor[3036:707] Video-pts
...............0.120000
2011-09-23 18:34:02.385 iFrameExtractor[3036:707] Audio pts
...............0.139320
2011-09-23 18:34:02.388 iFrameExtractor[3036:707] Video pts
...............0.120000
2011-09-23 18:34:02.397 iFrameExtractor[3036:707] Audio-pts
...............0.139320
2011-09-23 18:34:02.401 iFrameExtractor[3036:707] Video-pts
...............0.160000
[mp4 @ 0x11fc400] Application provided invalid, non monotonically increasing
dts to muxer in stream 1: 6144 >= 6144
Error while writing audio frame
2011-09-23 18:34:02.415 iFrameExtractor[3036:707] Audio pts
...............0.162540
*
Code To Write Audio Frames :
-(bool) write_audio_frame:(AVFormatContext *)oc: (AVStream *)st{
AVPacket pkt;
av_init_packet(&pkt);
int ss,ret;
c = st->codec;
while( av_fifo_size(fifo) >= frame_bytes ) {
av_fifo_generic_read( fifo, samples, frame_bytes, NULL );
ss = avcodec_encode_audio(c, audio_outbuf, frame_bytes, samples);
if (ss > 0){
pkt.size = ss;
if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE){
pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base,
st->time_base);
//pkt.pts = av_rescale_q(packetNew.dts,
pFormatCtx->streams[audioStream]->time_base, st->time_base);
}
if(c->coded_frame && c->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index= st->index;
pkt.data= audio_outbuf;
ret = av_interleaved_write_frame(oc, &pkt);
}
else
{
ret = 0;
}
}
av_free_packet(&pkt);
if (ret != 0) {
fprintf(stderr, "Error while writing audio frame\n");
//exit(1);
}
return true;
}
--
Thanks & Regards,
Gagandeep
More information about the ffmpeg-user
mailing list