From 4359c656015087540f950b846757d803466056e0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Wed, 21 Sep 2016 10:56:09 -0400 Subject: [PATCH] better debugging of timebase --- src/zm_ffmpeg.cpp | 3 +-- src/zm_videostore.cpp | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index adc0047bf..e73badba8 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -437,8 +437,7 @@ void zm_dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) Debug(1, "[0x%x]", st->id); if (lang) Debug(1, "(%s)", lang->value); - av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", st->codec_info_nb_frames, - st->time_base.num, st->time_base.den); + Debug(1, ", %d, %d/%d", st->codec_info_nb_frames, st->time_base.num, st->time_base.den); Debug(1, ": %s", buf); if (st->sample_aspect_ratio.num && // default diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index c73842d83..24ce0370c 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -357,17 +357,27 @@ if ( 1 ) { Debug(3, "opkt.pts = undef"); opkt.pts = AV_NOPTS_VALUE; } -} //Scale the DTS of the outgoing packet to be the correct time base if(ipkt->dts == AV_NOPTS_VALUE) { if ( ! startDts ) startDts = input_video_stream->cur_dts; opkt.dts = av_rescale_q(input_video_stream->cur_dts-startDts, AV_TIME_BASE_Q, video_stream->time_base); - Debug(3, "opkt.dts = %d from input_video_stream->cur_dts(%d) - startDts(%d), video_stream->time-base(%d)", opkt.dts, input_video_stream->cur_dts, startDts, video_stream->time_base ); + Debug(3, "opkt.dts = %d from input_video_stream->cur_dts(%d) - startDts(%d), input time based(%d/%d) video_stream->time-base(%d/%d)", + opkt.dts, input_video_stream->cur_dts, startDts, + input_video_stream->time_base.num, + input_video_stream->time_base.den + video_stream->time_base.num, + video_stream->time_base.den + ); } else { if ( ! startDts ) startDts = ipkt->dts; opkt.dts = av_rescale_q(ipkt->dts - startDts, input_video_stream->time_base, video_stream->time_base); - Debug(3, "opkt.dts = %d from ipkt->dts(%d) - startDts(%d), video_stream->time-base(%d)", opkt.dts, ipkt->dts, startDts, video_stream->time_base ); + Debug(3, "opkt.dts = %d from ipkt->dts(%d) - startDts(%d), input time base (%d/%d) video_stream->time-base(%d/%d)", opkt.dts, ipkt->dts, startDts, + input_video_stream->time_base.num, + input_video_stream->time_base.den + video_stream->time_base.num, + video_stream->time_base.den + ); } if ( opkt.dts > opkt.pts ) { Warning("opkt.dts(%d) must be <= opkt.pts(%d). Decompression must happen before presentation.", opkt.dts, opkt.pts ); @@ -396,7 +406,7 @@ Debug(3, "video and RAWPICTURE"); opkt.size = sizeof(AVPicture); opkt.flags |= AV_PKT_FLAG_KEY; } else { -Debug(3, "Not video and RAWPICTURE"); +Debug(4, "Not video and RAWPICTURE"); } //memcpy(&safepkt, &opkt, sizeof(AVPacket));