[FFmpeg-trac] #737(avfilter:new): dropframe timecode error in drawtext filter

FFmpeg trac at avcodec.org
Sat Dec 24 15:36:49 CET 2011


#737: dropframe timecode error in drawtext filter
------------------------------------+------------------------------------
             Reporter:  dericed     |                    Owner:
                 Type:  defect      |                   Status:  new
             Priority:  normal      |                Component:  avfilter
              Version:  git-master  |               Resolution:
             Keywords:  drawtext    |               Blocked By:
             Blocking:              |  Reproduced by developer:  0
Analyzed by developer:  0           |
------------------------------------+------------------------------------

Comment (by dericed):

 This happens with any codec. Here's a new output with -vcodec mpeg4.
 I set timecode to 00:03:59;27 and rate to 30000/1001

 In the output the timecode drawn start at 00:03:59;21  (six frames less
 than the requested timecode, the discrepancies occur at where the drop
 frames should occur so starting at 00:02:59;27 makes an output that is 4
 frames off, etc).

 So the drawn timecode is (frame by frame):
 00:03:59;21
 00:03:59;22
 00:03:59;23
 00:03:59;24
 00:03:59;25
 00:03:59;26
 00:03:59;27
 00:03:59;28
 00:03:59;29
 00:04:00;00 (invalid 30000/1001 dropframe value)
 00:04:00;01 (invalid 30000/1001 dropframe value)
 00:04:00;02
 00:04:00;03
 ...

 I presume that the input timecode is converted to a frame number based on
 if it were non-drop frame (thus the drawn timecode is less then the
 requested starting value) and then the timecode increments per frame still
 using non-drop frame so invalid timecode values are drawn and the
 discrepancy grows 2 frames every 9 minutes out of 10.

 {{{
 ffmpeg started on 2011-12-24 at 09:30:02
 Report written to "ffmpeg-20111224-093002.log"
 Command line:
 ffmpeg -y -report -i out.mov -vf "drawtext=fontfile=/Library/Fonts/Courier
 New.ttf:x=10:y=20:fontsize=32:boxcolor=black at 0.5:box=1:rate=30000/1001:timecode='00\\:03\\:59\\;27'"
 -r 30000/1001 -vcodec mpeg4 out3.mov
 ffmpeg version N-32449-g0d4a774, Copyright (c) 2000-2011 the FFmpeg
 developers
   built on Dec 23 2011 21:10:13 with gcc 4.2.1 (Apple Inc. build 5666)
 (dot 3)
   configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD --enable-shared
 --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables
 --enable-libopenjpeg --cc=/usr/bin/gcc-4.2 --enable-libx264 --enable-
 libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis
 --enable-libvpx --enable-libxvid --enable-libfreetype
   libavutil      51. 32.100 / 51. 32.100
   libavcodec     53. 47.100 / 53. 47.100
   libavformat    53. 28.100 / 53. 28.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 53.100 /  2. 53.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0.  5.100 /  0.  5.100
   libpostproc    51.  2.100 / 51.  2.100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff081026e00] Format mov,mp4,m4a,3gp,3g2,mj2
 probed with size=2048 and score=100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff081026e00] ISO: File Type Major Brand: qt
 [v210 @ 0x7ff08102f400] err{or,}_recognition separate: 1; 1
 [v210 @ 0x7ff08102f400] err{or,}_recognition combined: 1; 10001
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7ff081026e00] All info found

 Seems stream 0 codec frame rate differs from container frame rate:
 24000.00 (24000/1) -> 23.98 (24000/1001)
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'out.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 512
     compatible_brands: qt
     creation_time   : 2011-12-09 19:20:19
     encoder         : Lavf53.25.0
   Duration: 00:00:05.00, start: 0.000000, bitrate: 46354 kb/s
     Stream #0:0(eng), 1, 1/24000: Video: v210 (v210 / 0x30313276),
 yuv422p10le, 356x236, 46353 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 24k tbc
     Metadata:
       creation_time   : 2011-12-09 19:20:19
       handler_name    : DataHandler
 Incompatible pixel format 'yuv422p10le' for codec 'mpeg4', auto-selecting
 format 'yuv420p'
 [buffer @ 0x1018153c0] w:356 h:236 pixfmt:yuv422p10le tb:1/1000000 sar:0/1
 sws_param:
 [drawtext @ 0x101816680] loss of precision in default of basetime
 [drawtext @ 0x101816680] Setting value '/Library/Fonts/Courier New.ttf'
 for key 'fontfile'
 [drawtext @ 0x101816680] Setting value '10' for key 'x'
 [drawtext @ 0x101816680] Setting value '20' for key 'y'
 [drawtext @ 0x101816680] Setting value '32' for key 'fontsize'
 [drawtext @ 0x101816680] Setting value 'black at 0.5' for key 'boxcolor'
 [drawtext @ 0x101816680] Setting value '1' for key 'box'
 [drawtext @ 0x101816680] Setting value '30000/1001' for key 'rate'
 [drawtext @ 0x101816680] Setting value '00:03:59;27' for key 'timecode'
 [drawtext @ 0x1018165c0] auto-inserting filter 'auto-inserted scale 0'
 between the filter 'src' and the filter 'Parsed_drawtext_0'
 [scale @ 0x1018198a0] w:356 h:236 fmt:yuv422p10le -> w:356 h:236
 fmt:yuv420p flags:0x4
 [mpeg4 @ 0x7ff08102d000] err{or,}_recognition separate: 1; 1
 [mpeg4 @ 0x7ff08102d000] err{or,}_recognition combined: 1; 10001
 [mpeg4 @ 0x7ff08102d000] intra_quant_bias = 0 inter_quant_bias = -64
 [mpeg4 @ 0x7ff08102d000] Unsupported bit depth: 0
 [v210 @ 0x7ff08102f400] err{or,}_recognition separate: 1; 10001
 [v210 @ 0x7ff08102f400] err{or,}_recognition combined: 1; 10001
 Output #0, mov, to 'out3.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 512
     compatible_brands: qt
     creation_time   : 2011-12-09 19:20:19
     encoder         : Lavf53.28.100
     Stream #0:0(eng), 0, 1/30000: Video: mpeg4 (mp4v / 0x7634706D),
 yuv420p, 356x236, q=2-31, 200 kb/s, 30k tbn, 29.97 tbc
     Metadata:
       creation_time   : 2011-12-09 19:20:19
       handler_name    : DataHandler
 Stream mapping:
   Stream #0:0 -> #0:0 (v210 -> mpeg4)
 Press [q] to stop, [?] for help
 [drawtext @ 0x1018165c0] n:0 t:0.000000 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:1 t:0.041708 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:2 t:0.083417 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:3 t:0.125125 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:4 t:0.166833 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:5 t:0.208542 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:6 t:0.250250 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:7 t:0.291958 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:8 t:0.333667 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:9 t:0.375375 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:10 t:0.417083 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:11 t:0.458792 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:12 t:0.500500 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:13 t:0.542208 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:14 t:0.583917 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:15 t:0.625625 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:16 t:0.667333 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:17 t:0.709042 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:18 t:0.750750 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:19 t:0.792458 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:20 t:0.834167 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:21 t:0.875875 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:22 t:0.917583 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:23 t:0.959292 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:24 t:1.001000 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:25 t:1.042708 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:26 t:1.084417 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:27 t:1.126125 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:28 t:1.167833 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:29 t:1.209542 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:30 t:1.251250 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:31 t:1.292958 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:32 t:1.334667 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:33 t:1.376375 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:34 t:1.418083 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:35 t:1.459792 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:36 t:1.501500 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:37 t:1.543208 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:38 t:1.584917 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:39 t:1.626625 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:40 t:1.668333 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:41 t:1.710042 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:42 t:1.751750 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:43 t:1.793458 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:44 t:1.835167 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:45 t:1.876875 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:46 t:1.918583 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:47 t:1.960292 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:48 t:2.002000 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:49 t:2.043708 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:50 t:2.085417 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:51 t:2.127125 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:52 t:2.168833 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:53 t:2.210542 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:54 t:2.252250 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:55 t:2.293958 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:56 t:2.335667 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:57 t:2.377375 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:58 t:2.419083 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:59 t:2.460792 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:60 t:2.502500 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:61 t:2.544208 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:62 t:2.585917 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:63 t:2.627625 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:64 t:2.669333 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:65 t:2.711042 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:66 t:2.752750 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:67 t:2.794458 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:68 t:2.836167 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:69 t:2.877875 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:70 t:2.919583 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:71 t:2.961292 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:72 t:3.003000 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:73 t:3.044708 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:74 t:3.086417 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:75 t:3.128125 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:76 t:3.169833 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:77 t:3.211542 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:78 t:3.253250 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:79 t:3.294958 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:80 t:3.336667 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:81 t:3.378375 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:82 t:3.420083 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:83 t:3.461792 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:84 t:3.503500 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:85 t:3.545208 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:86 t:3.586917 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:87 t:3.628625 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:88 t:3.670333 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:89 t:3.712042 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:90 t:3.753750 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:91 t:3.795458 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:92 t:3.837167 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:93 t:3.878875 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:94 t:3.920583 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:95 t:3.962292 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:96 t:4.004000 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:97 t:4.045708 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:98 t:4.087417 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:99 t:4.129125 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:100 t:4.170833 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:101 t:4.212542 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:102 t:4.254250 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:103 t:4.295958 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:104 t:4.337667 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:105 t:4.379375 text_w:209 text_h:23 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:106 t:4.421083 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:107 t:4.462792 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:108 t:4.504500 text_w:209 text_h:23 x:10 y:20
 [drawtext @ 0x1018165c0] n:109 t:4.546208 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:110 t:4.587917 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:111 t:4.629625 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:112 t:4.671333 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:113 t:4.713042 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:114 t:4.754750 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:115 t:4.796458 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:116 t:4.838167 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:117 t:4.879875 text_w:209 text_h:24 x:10 y:20
 *** 1 dup!
 [drawtext @ 0x1018165c0] n:118 t:4.921583 text_w:209 text_h:24 x:10 y:20
 [drawtext @ 0x1018165c0] n:119 t:4.963292 text_w:209 text_h:23 x:10 y:20
 frame=  150 fps=  0 q=7.9 Lsize=     286kB time=00:00:05.00 bitrate=
 467.6kbits/s dup=30 drop=0
 video:284kB audio:0kB global headers:0kB muxing overhead 0.492299%

 }}}

-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/737#comment:3>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list