Opened 10 years ago

#3324 new defect

AVTimecode framerate is int not AVRational - causes desync

Reported by: jnvsor Owned by:
Priority: normal Component: avutil
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
AVTimecode framerate is int not float. To stop desync in NTSC videos 30 and 60fps are adjusted (by av_timecode_adjust_ntsc_framenum2) to 29.97 and 59.94 respectively.

This in turn causes desync when you actually do want 30 or 60fps.

Potential solution:
AVTimecode already has an AVRational alongside the int, but most of the functions use the int. Switch them to AVRational and you can get rid of av_timecode_adjust_ntsc_framenum2 altogether

How to reproduce:

$ ffmpeg -f lavfi -r 30 -t 30:00 -i "color=c=#000000" -filter_complex "[0]scale=730:120,drawtext=fontcolor=#FFFFFF:fontsize=150:fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSansMono.ttf:timecode='00\:00\:00\;00':rate=29.5:x=-270[out]" -map "[out]" -c:v png -pix_fmt rgba %06d.png
ffmpeg version N-59884-gfd334b9 Copyright (c) 2000-2014 the FFmpeg developers
  built on Jan 18 2014 02:17:50 with gcc 4.8 (Debian 4.8.2-12)
  configuration: --arch=amd64 --enable-pthreads --enable-libopencv --enable-librtmp --enable-libopenjpeg --enable-libopus --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-vaapi --enable-runtime-cpudetect --enable-libvorbis --enable-zlib --enable-swscale --enable-libcdio --enable-bzlib --enable-libdc1394 --enable-frei0r --enable-gnutls --enable-libgsm --enable-libmp3lame --enable-libpulse --enable-vdpau --enable-libvpx --enable-gpl --enable-x11grab --enable-libx264 --enable-libfreetype
  libavutil      52. 62.100 / 52. 62.100
  libavcodec     55. 48.101 / 55. 48.101
  libavformat    55. 23.103 / 55. 23.103
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     4.  1.100 /  4.  1.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, lavfi, from 'color=c=#000000':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to '%06d.png':
  Metadata:
    encoder         : Lavf55.23.103
    Stream #0:0: Video: png, rgba, 730x120 [SAR 16:73 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 30 tbc
Stream mapping:
  Stream #0:0 (rawvideo) -> scale
  drawtext -> Stream #0:0 (png)
Press [q] to stop, [?] for help
frame=54000 fps=713 q=0.0 Lsize=N/A time=00:30:00.00 bitrate=N/A    
video:547899kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.000004%
# Frame 54000 should now be 29:59;29, instead it's 30:01;23 (1 frame desync per 1000)

Change History (0)

Note: See TracTickets for help on using tickets.