#634 closed defect (fixed)
non monotonically increasing dts with v4l2
Reported by: | wim | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | git-master | Keywords: | av_interleaved_write_frame v4l2 |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
errors when encoding webcam to video file
When using .avi container:
wim@wim-ubuntu:~/croncap$ ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -vcodec libx264 -preset medium -vprofile baseline blah.avi
ffmpeg version git-2011-11-03-988f585, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 3 2011 20:03:33 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 23. 0 / 51. 23. 0
libavcodec 53. 27. 0 / 53. 27. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[video4linux2,v4l2 @ 0x1f188c0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 422744.730718, bitrate: 18432 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 18432 kb/s, 15 tbr, 1000k tbn, 15 tbc
Incompatible pixel format 'yuyv422' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0x1f1d060] w:320 h:240 pixfmt:yuyv422 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x1f1d4e0] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x1f1dcc0] w:320 h:240 fmt:yuyv422 -> w:320 h:240 fmt:yuv420p flags:0x4
[libx264 @ 0x1f19dc0] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x1f19dc0] profile Constrained Baseline, level 1.2
Output #0, avi, to 'blah.avi':
Metadata:
ISFT : Lavf53.18.0
Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 320x240, q=-1--1, 15 tbn, 15 tbc
Stream mapping:
Press [q] to stop, ? for help
non-strictly-monotonic PTS.0 size= 1008450kB time=38:51:05.60 bitrate= 59.1kbits/s
non-strictly-monotonic PTS.0 size= 1008451kB time=38:51:06.13 bitrate= 59.1kbits/s
non-strictly-monotonic PTS.0 size= 1008451kB time=38:51:06.66 bitrate= 59.1kbits/s
non-strictly-monotonic PTS.0 size= 1008452kB time=38:51:07.20 bitrate= 59.1kbits/s
[libx264 @ 0x1f19dc0] non-strictly-monotonic PTS
non-strictly-monotonic PTS.0 size= 1008452kB time=38:51:07.73 bitrate= 59.1kbits/s
non-strictly-monotonic PTS.0 size= 1008453kB time=38:51:08.26 bitrate= 59.1kbits/s
non-strictly-monotonic PTS.0 size= 1008453kB time=38:51:08.80 bitrate= 59.1kbits/s
[avi @ 0x1f19600] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 2098034 >= 2098034
av_interleaved_write_frame(): Invalid argument
When using .mkv container:
wim@wim-ubuntu:~/croncap$ ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -vcodec libx264 -preset medium -vprofile baseline eggs.mkv
ffmpeg version git-2011-11-03-988f585, Copyright (c) 2000-2011 the FFmpeg developers
built on Nov 3 2011 20:03:33 with gcc 4.6.1
configuration: --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-libvpx
libavutil 51. 23. 0 / 51. 23. 0
libavcodec 53. 27. 0 / 53. 27. 0
libavformat 53. 18. 0 / 53. 18. 0
libavdevice 53. 4. 0 / 53. 4. 0
libavfilter 2. 45. 3 / 2. 45. 3
libswscale 2. 1. 0 / 2. 1. 0
libpostproc 51. 2. 0 / 51. 2. 0
[video4linux2,v4l2 @ 0x164a8c0] Estimating duration from bitrate, this may be inaccurate
Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 2250.662157, bitrate: 18432 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 320x240, 18432 kb/s, 15 tbr, 1000k tbn, 15 tbc
Incompatible pixel format 'yuyv422' for codec 'libx264', auto-selecting format 'yuv420p'
[buffer @ 0x164a7e0] w:320 h:240 pixfmt:yuyv422 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x164f720] auto-inserting filter 'auto-inserted scale 0' between the filter 'src' and the filter 'out'
[scale @ 0x164ff80] w:320 h:240 fmt:yuyv422 -> w:320 h:240 fmt:yuv420p flags:0x4
[libx264 @ 0x164bf60] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
[libx264 @ 0x164bf60] profile Constrained Baseline, level 1.2
[libx264 @ 0x164bf60] 264 - core 119 r2106 07efeb4 - H.264/MPEG-4 AVC codec - Copyleft 2003-2011 - http://www.videolan.org/x264.html - options: cabac=0 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=15 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'eggs.mkv':
Metadata:
encoder : Lavf53.18.0
Stream #0:0: Video: h264, yuv420p, 320x240, q=-1--1, 1k tbn, 15 tbc
Stream mapping:
Press [q] to stop, ? for help
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:38.66 bitrate= 46.6kbits/s
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:39.20 bitrate= 46.6kbits/s
[libx264 @ 0x164bf60] non-strictly-monotonic PTS
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:39.73 bitrate= 46.6kbits/s
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:40.26 bitrate= 46.6kbits/s
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:40.80 bitrate= 46.6kbits/s
[libx264 @ 0x164bf60] non-strictly-monotonic PTS
non-strictly-monotonic PTS.0 size= 796312kB time=38:50:41.33 bitrate= 46.6kbits/s
[matroska @ 0x164b600] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 139841733 >= 139841733
av_interleaved_write_frame(): Invalid argument
Attachments (2)
Change History (16)
comment:1 by , 13 years ago
Keywords: | av_interleaved_write_frame added |
---|---|
Version: | unspecified → git-master |
comment:3 by , 13 years ago
mpeg1video, mpeg2video, mpeg4, msmpeg4, msmpeg4v2, mjpeg, ljpeg, jpegls, ffv1, ffvhuff, flv, snow, svq1, wmv1, wmv2 come to mind (I probably forgot some), but simply omitting "-vcodec libx264 -preset medium -vprofile baseline" is sufficient to let FFmpeg automatically choose a codec suitable for avi (mpeg4 asp).
by , 13 years ago
comment:4 by , 13 years ago
I tried it with omitting the stuff, and ffmpeg chooses
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46)
giving a similar error like:
Error, Invalid timestamp=2098226, last=2098226
Video encoding failed
You can see the rest in the screencap attached above.
comment:5 by , 13 years ago
Keywords: | v4l2 added |
---|
Did your recording really run for more than a day?
Please always post complete, uncut console output as text, please do not attach screen-shots instead (there are cases when this is useful, but they are very rare).
follow-up: 7 comment:6 by , 13 years ago
Yes, the recording duration is correct. It is recording to ext4 filesystem and plenty of space on disk.
I posted the screenshot because the console output as text might be misleading in this case (see the coloured error line over-writing on the usual ffmpeg stderr chat in black)
comment:7 by , 13 years ago
Replying to wim:
I posted the screenshot because the console output as text might be misleading in this case (see the coloured error line over-writing on the usual ffmpeg stderr chat in black)
It cannot be misleading, at least not in this case.
comment:8 by , 13 years ago
Status: | new → open |
---|
I was able to trigger a similar error by running an encode for >26 hours.
$ ffmpeg -async 1 -f v4l2 -i /dev/video1 -f alsa -i hw:2 -s 64x64 out.avi ffmpeg version N-35411-g28a11a6, Copyright (c) 2000-2011 the FFmpeg developers built on Dec 3 2011 14:27:33 with gcc 4.5.3 configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc libavutil 51. 29. 1 / 51. 29. 1 libavcodec 53. 40. 0 / 53. 40. 0 libavformat 53. 24. 0 / 53. 24. 0 libavdevice 53. 4. 0 / 53. 4. 0 libavfilter 2. 50. 0 / 2. 50. 0 libswscale 2. 1. 0 / 2. 1. 0 [video4linux2,v4l2 @ 0x139f7e0] Estimating duration from bitrate, this may be inaccurate Input #0, video4linux2,v4l2, from '/dev/video1': Duration: N/A, start: 1322924421.201907, bitrate: 132710 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 768x576, 132710 kb/s, 25 tbr, 1000k tbn, 25 tbc [alsa @ 0x139a040] Estimating duration from bitrate, this may be inaccurate Input #1, alsa, from 'hw:2': Duration: N/A, start: 1322924421.195346, bitrate: N/A Stream #1:0: Audio: pcm_s16le, 32000 Hz, 2 channels, s16, 1024 kb/s File 'out.avi' already exists. Overwrite ? [y/N] y w:768 h:576 pixfmt:yuv420p tb:1/1000000 sar:0/1 sws_param: [scale @ 0x13a4e00] w:768 h:576 fmt:yuv420p -> w:64 h:64 fmt:yuv420p flags:0x4 Incompatible sample format 's16' for codec 'ac3', auto-selecting format 'flt' [ac3 @ 0x13a4220] channel_layout not specified [ac3 @ 0x13a4220] No channel layout specified. The encoder will guess the layout, but it might be incorrect. Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf53.24.0 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 64x64, q=2-31, 200 kb/s, 25 tbn, 25 tbc Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 32000 Hz, stereo, flt, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (rawvideo -> mpeg4) Stream #1:0 -> #0:1 (pcm_s16le -> ac3) Press [q] to stop, [?] for help [alsa @ 0x139a040] ALSA buffer xrun. ALSA buffer xrun.= 25 q=2.0 size= 3314018kB time=26:37:07.29 bitrate= 283.3kbits/s dup=0 drop=453 Error, Invalid timestamp=2399562, last=2399562me=26:39:42.40 bitrate= 283.3kbits/s dup=0 drop=453 Video encoding failed
comment:9 by , 13 years ago
I second this issue.
I'm using ffmpeg+ffserver to transfer RTSP stream to FLV stream, played in Flash player.
ffmpeg -rtsp_transport tcp -i rtsp://ipaddress:554 -vcodec copy -an http://127.0.0.1:8010/feed1.ffm
I heard there is higher chance when using -vcodec copy to remux the stream into FLV stream.
by , 13 years ago
comment:10 by , 13 years ago
I attached a complete log file in the above, which is the output of the following command
ffmpeg -rtsp_transport tcp -i rtsp://10.8.0.2:554 -vcodec copy -an -r 10 http://127.0.0.1:8010/feed1.ffm -loglevel debug 2> debug.txt
Hopefully, someone can look into this.
comment:11 by , 12 years ago
Summary: | non monotonically increasing dts → non monotonically increasing dts with v4l2 |
---|
comment:12 by , 12 years ago
Could somebody still reproduce this by running for example:
ffmpeg -f v4l2 -video_size 320x240 -framerate 10 -i /dev/video0 out.avi
with current git head?
comment:13 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | open → closed |
Appears to work fine now.
$ ffmpeg -f v4l2 -video_size 64x48 -framerate 10 -i /dev/video0 out.avi ffmpeg version N-51435-g24cfe91 Copyright (c) 2000-2013 the FFmpeg developers built on Mar 29 2013 06:11:26 with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --disable-indev=jack libavutil 52. 22.101 / 52. 22.101 libavcodec 55. 2.100 / 55. 2.100 libavformat 55. 0.100 / 55. 0.100 libavdevice 55. 0.100 / 55. 0.100 libavfilter 3. 48.105 / 3. 48.105 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 [video4linux2,v4l2 @ 0x2e3d140] The driver does not allow to change time per frame [video4linux2,v4l2 @ 0x2e3d140] Estimating duration from bitrate, this may be inaccurate Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 1364536659.669939, bitrate: 921 kb/s Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 64x48, 921 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc [mpeg4 @ 0x2e3f120] too many threads/slices (4), reducing to 3 Output #0, avi, to 'out.avi': Metadata: ISFT : Lavf55.0.100 Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 64x48, q=2-31, 200 kb/s, 25 tbn, 25 tbc Stream mapping: Stream #0:0 -> #0:0 (rawvideo -> mpeg4) Press [q] to stop, [?] for help frame=7269585 fps= 25 q=2.0 Lsize= 7188621kB time=80:46:23.80 bitrate= 202.5kbits/s video:7054192kB audio:0kB subtitle:0 global headers:0kB muxing overhead 1.905667%
Is an external library required to reproduce this problem (is the problem also reproducible without -vcodec libx264)?