[Libav-user] Overlay filter outputs sequence of frames with non-strictly-monotonic PTS.
Hristo Ivanov
hivanov.ffmailing at gmail.com
Fri Jun 15 15:46:25 EEST 2018
Hi.
I am capturing the video of two IP cameras(RTSP), decoding the two inputs
and using a filter which looks like this:
[in0]scale=1280:720[aux0];[in1]scale=320:180[aux1];[aux0][aux1]overlay=main_w-overlay_w:main_h-overlay_h[out0]
Then I encode the output of the filter to libx264 and finally mux it to mp4.
Most if the time everything works great, but sometimes the filter outputs
frames that have a non monotonically increasing PTS. A frame with non
monotonically increasing PTS is encoded correctly but the resulting packet
causes the av_interleaved_write_frame() function to return error. This is
the error message:
[libx264 @ 000001bfc548e340] non-strictly-monotonic PTS
[mp4 @ 000001bfc4aa57c0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 9392384 >= 9392384
My current fix for this problem is to ignore(do not encode) the frames with
a PTS lower/equal than the previous one. Something like this:
if (frame->frame->pts <= this->lastPts) {
return;
}
this->lastPts = frame->frame->pts;
int ret;
ret = avcodec_send_frame(this->codec_ctx, frame->frame);
My questions:
Is it normal for a filter to output frames with non monotonically
increasing PTS?
Is there a better approach to overcome this problem than the one I am
currently using?
Thanks.
The full code is way too long to be included in this mail. Here is
the AV_LOG_VERBOSE:
SDP:
v=0
o=- 0 0 IN IP4 10.1.1.22
s=LIVE VIEW
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 35
a=rtpmap:35 H264/90000
a=control:video
a=recvonly
a=fmtp:35
packetization-mode=1;profile-level-id=4d001f;sprop-parameter-sets=Z00AH5pmAoAt2AtQUBBQIA==,aO48gA==
m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000/1
a=control:audio
a=recvonly
[udp @ 000001bfc4aabd40] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[udp @ 000001bfc4abc000] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[rtsp @ 000001bfc4a9f040] setting jitter buffer size to 500
[udp @ 000001bfc4accc80] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[udp @ 000001bfc4adcf40] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[rtsp @ 000001bfc4a9f040] setting jitter buffer size to 500
[h264 @ 000001bfc4aa8440] Reinit context to 1280x720, pix_fmt: yuv420p
[rtsp @ 000001bfc4aa0a00] SDP:
v=0
o=- 0 0 IN IP4 10.1.1.23
s=LIVE VIEW
c=IN IP4 0.0.0.0
t=0 0
a=control:*
m=video 0 RTP/AVP 35
a=rtpmap:35 H264/90000
a=control:video
a=recvonly
a=fmtp:35
packetization-mode=1;profile-level-id=4d0028;sprop-parameter-sets=Z00AKI2NKAoAt2AgEA==,aO48gA==
m=audio 0 RTP/AVP 0
a=rtpmap:0 PCMU/8000/1
a=control:audio
a=recvonly
[udp @ 000001bfc4b4eb00] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[udp @ 000001bfc55c1180] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[rtsp @ 000001bfc4aa0a00] setting jitter buffer size to 500
[udp @ 000001bfc5485580] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[udp @ 000001bfc5485680] 'circular_buffer_size' option was set but it is
not supported on this build (pthread support is required)
[rtsp @ 000001bfc4aa0a00] setting jitter buffer size to 500
[h264 @ 000001bfc55b07c0] Reinit context to 1280x720, pix_fmt: yuv420p
[Parsed_scale_0 @ 000001bfc4b3af80] w:1280 h:720 flags:'bilinear' interl:0
[Parsed_scale_1 @ 000001bfc590de80] w:320 h:180 flags:'bilinear' interl:0
[videoFilter input 0 @ 000001bfc508ef00] w:1280 h:720 pixfmt:yuv420p
tb:1/60 fr:0/1 sar:1/1 sws_param:
[videoFilter input 1 @ 000001bfc4a9ef00] w:1280 h:720 pixfmt:yuv420p
tb:1/60 fr:0/1 sar:1/1 sws_param:
[Parsed_scale_0 @ 000001bfc4b3af80] w:1280 h:720 fmt:yuv420p sar:1/1 ->
w:1280 h:720 fmt:yuv420p sar:1/1 flags:0x2
[Parsed_scale_1 @ 000001bfc590de80] w:1280 h:720 fmt:yuv420p sar:1/1 ->
w:320 h:180 fmt:yuva420p sar:1/1 flags:0x2
[Parsed_overlay_2 @ 000001bfc4f49e40] main w:1280 h:720 fmt:yuv420p overlay
w:320 h:180 fmt:yuva420p
[Parsed_overlay_2 @ 000001bfc4f49e40] [framesync @ 000001bfc508e968]
Selected 1/60 time base
[Parsed_overlay_2 @ 000001bfc4f49e40] [framesync @ 000001bfc508e968] Sync
level 2
[libx264 @ 000001bfc548e340] using SAR=1/1
[libx264 @ 000001bfc548e340] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001bfc548e340] profile Constrained Baseline, level 3.2
[libx264 @ 000001bfc548e340] 264 - core 155 r2901 7d0ff22 - H.264/MPEG-4
AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html -
options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=0
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
keyint_min=25 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=5000
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
[h264 @ 000001bfc4b3b140] Reinit context to 1280x720, pix_fmt: yuv420p
[h264 @ 000001bfc56356c0] Reinit context to 1280x720, pix_fmt: yuv420p
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[rtsp @ 000001bfc4a9f040] jitter buffer full
[rtsp @ 000001bfc4a9f040] RTP: missed 1 packets
[libx264 @ 000001bfc548e340] non-strictly-monotonic PTS
[mp4 @ 000001bfc4aa57c0] Application provided invalid, non monotonically
increasing dts to muxer in stream 0: 9392384 >= 9392384
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180615/9df3acc3/attachment.html>
More information about the Libav-user
mailing list