<p>You might have variable frame rate media. The time base looks pretty crazy for standard 24p media. I might hit it with <a href="https://mediaarea.net/en/MediaInfo" rel="nofollow noreferrer">MediaInfo</a> (note the Windows GUI includes adware, but the CLI version does not) and post the output from that.</p>

CC BY-SA 3.0
2017-04-01T19:34:17.240Z
Yes.. it seems so, I tried many transcodings and always it seems change th fps on the fly. How can I obtain a constant output ?
user3450548
CC BY-SA 3.0
2017-04-01T19:55:16.553Z
That time base is the standard that ffmpeg produces i.e .framerate x 512.
Gyan
CC BY-SA 3.0
2017-04-01T22:17:07.227Z
@Mulvya let me post the info for the last encoded file...
user3450548
CC BY-SA 3.0
2017-04-02T09:11:18.290Z
@Mulvya let me reply here so both of you can read, I did many other tests, I also tried to encode only the video in .mov with a proress codec instead of h264.. ffmpeg doesn't show duplicated frames however at the very beginning of the movie there's the black background with white text for the initial credits.. and in this part 00:00:00:03 and 00:00:00:04 are repeated 2 times in premiere leaving Premiere being always +2 frames over the total until the end :( I don't understand why, can it be something bugged about particular scenes like white text on black background?
user3450548
CC BY-SA 3.0
2017-04-24T18:54:22.147Z
@user3450548 What you would need to do is manually specify the output frame rate in your encoding tool. So for `ffmpeg` you would use `-r 24000/1001` for 23.976, and for Handbrake there's a dropdown and you would select Constant Frame Rate.
ivkowalenko
CC BY-SA 3.0
2017-04-01T19:24:13.350Z
2017-04-01T19:24:13.350Z
ivkowalenko
<p>I used this command to burn the timecode inside my video.</p>
<p>While everything looked fine, when I open my video inside Premiere it seems that my timecode doesn't match.</p>
<p><a href="https://i.sstatic.net/SRHs2.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/SRHs2.png" alt="Timecode doesn't match!" /></a></p>
<p>My fear is that the timecode processed by ffmpeg was the original of the input file but when recompressed via h264 the number of frames changed giving precedence to the h264 compression algorithms.</p>
<p>How can I fix it? Or better how I can have an output video that match exactly the duration and the frames of the original input file?</p>
<p>Sadly my input file was already an h264 mp4 stream.</p>
<p>The command I used is the following:</p>
<pre><code>ffmpeg -i &quot;file.mp4&quot; -c:v libx264 -x264-params &quot;crf=17&quot; -preset fast -c:a copy -c:s copy -copyinkf -filter_complex &quot;drawtext=fontfile=font.otf: timecode='00\:00\:00\:00':rate=24: text='': fontsize=56: fontcolor=white@0.9: borderw=3: bordercolor=black: x=50-text_w/2:y=50&quot; &quot;file2.mp4&quot;
</code></pre>
<p>The full console output is the following:</p>
<pre><code>ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000003746020] using SAR=1/1
[libx264 @ 0000000003746020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000003746020] profile High, level 4.0
[libx264 @ 0000000003746020] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -&gt; drawtext
  drawtext -&gt; Stream #0:0 (libx264)
  Stream #0:1 -&gt; #0:1 (copy)
Press [q] to stop, [?] for help
frame= 2105 fps= 36 q=-1.0 Lsize=   41555kB time=00:01:27.58 bitrate=3886.8kbits/s dup=2 drop=0 speed=1.49x
video:38775kB audio:2719kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.145290%
[libx264 @ 0000000003746020] frame I:11    Avg QP: 7.99  size: 70608
[libx264 @ 0000000003746020] frame P:761   Avg QP:13.37  size: 28331
[libx264 @ 0000000003746020] frame B:1333  Avg QP:14.85  size: 13030
[libx264 @ 0000000003746020] consecutive B-frames:  2.0% 40.1%  1.9% 56.1%
[libx264 @ 0000000003746020] mb I  I16..4: 49.6% 36.9% 13.5%
[libx264 @ 0000000003746020] mb P  I16..4:  9.6% 15.5%  2.1%  P16..4: 20.5%  7.4%  3.1%  0.0%  0.0%    skip:41.8%
[libx264 @ 0000000003746020] mb B  I16..4:  2.5%  3.7%  0.4%  B16..8: 17.6%  7.0%  0.8%  direct: 7.7%  skip:60.4%  L0:50.5% L1:44.4% BI: 5.1%
[libx264 @ 0000000003746020] 8x8 transform intra:56.0% inter:56.8%
[libx264 @ 0000000003746020] coded y,uvDC,uvAC intra: 37.2% 61.9% 19.6% inter: 6.6% 19.9% 0.8%
[libx264 @ 0000000003746020] i16 v,h,dc,p: 51% 24% 14% 10%
[libx264 @ 0000000003746020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 18% 29%  3%  3%  3%  2%  3%  3%
[libx264 @ 0000000003746020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 23% 15%  4%  4%  4%  3%  4%  3%
[libx264 @ 0000000003746020] i8c dc,h,v,p: 45% 18% 29%  7%
[libx264 @ 0000000003746020] Weighted P-Frames: Y:5.8% UV:3.0%
[libx264 @ 0000000003746020] ref P L0: 77.3% 22.7%
[libx264 @ 0000000003746020] ref B L0: 87.0% 13.0%
[libx264 @ 0000000003746020] ref B L1: 97.2%  2.8%
[libx264 @ 0000000003746020] kb/s:3621.54
</code></pre>
<p>I re-ran it to obtain the output and closed it after some seconds with [q] option ;)</p>
<p><strong>EDIT:</strong> ran again keeping the video only!</p>
<pre><code>ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 000000000315f7c0] using SAR=1/1
[libx264 @ 000000000315f7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 000000000315f7c0] profile High, level 4.0
[libx264 @ 000000000315f7c0] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (h264) -&gt; drawtext
  drawtext -&gt; Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  843 fps= 36 q=-1.0 Lsize=   10386kB time=00:00:35.00 bitrate=2430.9kbits/s dup=2 drop=0 speed= 1.5x
video:10375kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103293%
[libx264 @ 000000000315f7c0] frame I:4     Avg QP: 5.49  size: 41664
[libx264 @ 000000000315f7c0] frame P:285   Avg QP:12.19  size: 19489
[libx264 @ 000000000315f7c0] frame B:554   Avg QP:13.02  size:  8849
[libx264 @ 000000000315f7c0] consecutive B-frames:  2.6% 28.7%  1.8% 66.9%
[libx264 @ 000000000315f7c0] mb I  I16..4: 65.5% 27.6%  6.9%
[libx264 @ 000000000315f7c0] mb P  I16..4:  9.0% 11.3%  1.3%  P16..4: 15.5%  5.1%  2.2%  0.0%  0.0%    skip:55.6%
[libx264 @ 000000000315f7c0] mb B  I16..4:  2.4%  2.2%  0.1%  B16..8: 11.6%  4.9%  0.6%  direct: 7.1%  skip:71.0%  L0:50.3% L1:45.1% BI: 4.6%
[libx264 @ 000000000315f7c0] 8x8 transform intra:49.4% inter:53.5%
[libx264 @ 000000000315f7c0] coded y,uvDC,uvAC intra: 26.0% 54.6% 16.0% inter: 4.1% 16.1% 0.6%
[libx264 @ 000000000315f7c0] i16 v,h,dc,p: 52% 26% 14%  8%
[libx264 @ 000000000315f7c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 38%  1%  1%  1%  2%  1%  2%
[libx264 @ 000000000315f7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 28% 20%  2%  3%  3%  3%  2%  2%
[libx264 @ 000000000315f7c0] i8c dc,h,v,p: 49% 19% 26%  7%
[libx264 @ 000000000315f7c0] Weighted P-Frames: Y:15.4% UV:8.1%
[libx264 @ 000000000315f7c0] ref P L0: 71.5% 28.5%
[libx264 @ 000000000315f7c0] ref B L0: 84.7% 15.3%
[libx264 @ 000000000315f7c0] ref B L1: 96.2%  3.8%
[libx264 @ 000000000315f7c0] kb/s:2419.57
</code></pre>
<p>This is the media info I obtained:</p>
<blockquote>
<p>Video<br />
ID                          : 1<br />
Format                      : AVC<br />
Format/Info                 : Advanced Video Codec<br />
Format profile              : High@L4<br />
Format settings, CABAC      : Yes<br />
Format settings, ReFrames   : 2 frames<br />
Codec ID                    : avc1<br />
Codec ID/Info               : Advanced Video Coding<br />
Duration                    : 50s 0ms<br />
Bit rate                    : 2 991 Kbps<br />
Width                       : 1 920 pixels<br />
Height                      : 1 080 pixels<br />
Display aspect ratio        : 16:9<br />
<strong>Frame rate mode             : Variable</strong><br />
<strong>Frame rate                  : 23.976 (23976/1000) fps</strong><br />
<strong>Minimum frame rate          : 12.000 fps</strong><br />
<strong>Maximum frame rate          : 24.000 fps</strong><br />
Color space                 : YUV<br />
Chroma subsampling          : 4:2:0<br />
Bit depth                   : 8 bits<br />
Scan type                   : Progressive<br />
Bits/(Pixel*Frame)          : 0.060<br />
Stream size                 : 17.8 MiB (100%)<br />
Writing library             : x264 core 148 r2708 86b7198<br />
Encoding settings           : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00</p>
</blockquote>

CC BY-SA 3.0
2017-03-30T19:05:42.287Z
The console output shows only two duplicated frames. But the output is only 1m27s whereas the source is 51m. So, if there are dropped frames further, this console output won't reveal that. Does Premiere at the 1m27s mark show a 2 frame difference?
Gyan
CC BY-SA 3.0
2017-03-31T07:35:36.740Z
@Mulvya sorry I realized that I created a wrong sequence in Premiere with a fps of 23.297 instead 24.. If I create a sequence of 24 fps indeed i have 2 frames off only. How can I get rid of this 2 or more duplicate frames? Is my command good or I have to write it in a better way to have not duplicate or dropped frames for the future encodings ? thanks
user3450548
CC BY-SA 3.0
2017-03-31T07:41:44.873Z
Disable the audio and subtitles and encode. Then mux the encoded video with the original audio/subs into a new MP4.
Gyan
CC BY-SA 3.0
2017-03-31T09:56:34.347Z
@Mulvya do you think that the problem is a matter of matching with audio and subs? :O I could try..
user3450548
CC BY-SA 3.0
2017-04-01T10:08:30.357Z
@Mulvya ok I did it, keeping only the video, however as you can see in console the 2 dup frames are still there :\
user3450548
CC BY-SA 3.0
2017-04-01T11:11:12.027Z
Use `-vsync 0`.
Gyan
CC BY-SA 3.0
2017-04-01T19:26:41.060Z
@Mulvya i added vsync 0 and now it doesn't sign duped frames however the time is always off of about 2 frames in the comparison between the timecode and adobe premiere
user3450548
CC BY-SA 3.0
2017-04-01T19:53:34.573Z
Wait a minute. It might be this [bug](https://superuser.com/q/1119072/114058).
Gyan
CC BY-SA 3.0
2017-04-01T22:10:54.013Z
@Mulvya Fine but disabling B and P frames doesn't just make everything huge? :O
user3450548
CC BY-SA 3.0
2017-04-02T06:29:23.883Z
None of the options I suggested there disable P-frames. And B-frames aren't disabled, just limited. Or you could just live with the missing 2 frames :)
Gyan
<ffmpeg><video><premiere><timecode>
ffmpeg timecode added does not match the ones I can read in Premiere
user3450548
# ffmpeg timecode added does not match the ones I can read in Premiere

(Asked by: username_0 on 2017-03-30)

I used this command to burn the timecode inside my video.
While everything looked fine, when I open my video inside Premiere it seems that my timecode doesn't match.

My fear is that the timecode processed by ffmpeg was the original of the input file but when recompressed via h264 the number of frames changed giving precedence to the h264 compression algorithms.
How can I fix it? Or better how I can have an output video that match exactly the duration and the frames of the original input file?
Sadly my input file was already an h264 mp4 stream.
The command I used is the following:
ffmpeg -i "file.mp4" -c:v libx264 -x264-params "crf=17" -preset fast -c:a copy -c:s copy -copyinkf -filter_complex "drawtext=fontfile=font.otf: timecode='00\:00\:00\:00':rate=24: text='': fontsize=56: fontcolor=white@0.9: borderw=3: bordercolor=black: x=50-text_w/2:y=50" "file2.mp4"

The full console output is the following:
ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 0000000003746020] using SAR=1/1
[libx264 @ 0000000003746020] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000003746020] profile High, level 4.0
[libx264 @ 0000000003746020] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 (h264) -> drawtext
  drawtext -> Stream #0:0 (libx264)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 2105 fps= 36 q=-1.0 Lsize=   41555kB time=00:01:27.58 bitrate=3886.8kbits/s dup=2 drop=0 speed=1.49x
video:38775kB audio:2719kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.145290%
[libx264 @ 0000000003746020] frame I:11    Avg QP: 7.99  size: 70608
[libx264 @ 0000000003746020] frame P:761   Avg QP:13.37  size: 28331
[libx264 @ 0000000003746020] frame B:1333  Avg QP:14.85  size: 13030
[libx264 @ 0000000003746020] consecutive B-frames:  2.0% 40.1%  1.9% 56.1%
[libx264 @ 0000000003746020] mb I  I16..4: 49.6% 36.9% 13.5%
[libx264 @ 0000000003746020] mb P  I16..4:  9.6% 15.5%  2.1%  P16..4: 20.5%  7.4%  3.1%  0.0%  0.0%    skip:41.8%
[libx264 @ 0000000003746020] mb B  I16..4:  2.5%  3.7%  0.4%  B16..8: 17.6%  7.0%  0.8%  direct: 7.7%  skip:60.4%  L0:50.5% L1:44.4% BI: 5.1%
[libx264 @ 0000000003746020] 8x8 transform intra:56.0% inter:56.8%
[libx264 @ 0000000003746020] coded y,uvDC,uvAC intra: 37.2% 61.9% 19.6% inter: 6.6% 19.9% 0.8%
[libx264 @ 0000000003746020] i16 v,h,dc,p: 51% 24% 14% 10%
[libx264 @ 0000000003746020] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 18% 29%  3%  3%  3%  2%  3%  3%
[libx264 @ 0000000003746020] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 39% 23% 15%  4%  4%  4%  3%  4%  3%
[libx264 @ 0000000003746020] i8c dc,h,v,p: 45% 18% 29%  7%
[libx264 @ 0000000003746020] Weighted P-Frames: Y:5.8% UV:3.0%
[libx264 @ 0000000003746020] ref P L0: 77.3% 22.7%
[libx264 @ 0000000003746020] ref B L0: 87.0% 13.0%
[libx264 @ 0000000003746020] ref B L1: 97.2%  2.8%
[libx264 @ 0000000003746020] kb/s:3621.54

I re-ran it to obtain the output and closed it after some seconds with [q] option ;)
EDIT: ran again keeping the video only!
ffmpeg version N-82500-g52da3f6 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --arch=x86_64 --target-os=mingw32 --cross-prefix=/root/opt/ffmpeg-cross-compile/sandbox/cross_compilers/mingw-w64-x86_64/bin/x86_64-w64-mingw32- --pkg-config=pkg-config --disable-w32t
hreads --enable-libsoxr --enable-fontconfig --enable-libass --enable-libbluray --enable-iconv --enable-libtwolame --extra-cflags=-DLIBTWOLAME_STATIC --enable-libzvbi --enable-libcaca --enable-libmodpl
ug --extra-libs=-lstdc++ --extra-libs=-lpng --enable-decklink --extra-libs=-loleaut32 --enable-libmp3lame --enable-version3 --enable-zlib --enable-librtmp --enable-libvorbis --enable-libtheora --enabl
e-libspeex --enable-libopenjpeg --enable-gnutls --enable-libgsm --enable-libfreetype --enable-libopus --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --ena
ble-libschroedinger --enable-libvpx --enable-libilbc --enable-libwavpack --enable-libwebp --enable-libgme --enable-dxva2 --enable-avisynth --enable-gray --enable-libopenh264 --enable-netcdf --enable-l
ibflite --enable-lzma --enable-libsnappy --enable-libzimg --enable-gpl --enable-libx264 --enable-libx265 --enable-frei0r --enable-filter=frei0r --enable-librubberband --enable-libvidstab --enable-libx
avs --enable-libxvid --enable-libmfx --extra-libs=-lpsapi --extra-libs=-lspeexdsp --extra-cflags='-mtune=core2' --extra-cflags=-O3 --enable-static --disable-shared --prefix=/root/opt/ffmpeg-cross-comp
ile/sandbox/cross_compilers/mingw-w64-x86_64/x86_64-w64-mingw32 --enable-nonfree --enable-libfdk-aac --enable-runtime-cpudetect
  libavutil      55. 40.100 / 55. 40.100
  libavcodec     57. 66.103 / 57. 66.103
  libavformat    57. 57.100 / 57. 57.100
  libavdevice    57.  2.100 / 57.  2.100
  libavfilter     6. 67.100 /  6. 67.100
  libswscale      4.  3.101 /  4.  3.101
  libswresample   2.  4.100 /  2.  4.100
  libpostproc    54.  2.100 / 54.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
  Duration: 00:51:27.38, start: 0.000000, bitrate: 3246 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 2988 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[libx264 @ 000000000315f7c0] using SAR=1/1
[libx264 @ 000000000315f7c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 000000000315f7c0] profile High, level 4.0
[libx264 @ 000000000315f7c0] 264 - core 148 r2708 86b7198 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=
hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookah
ead=30 rc=crf mbtree=1 crf=17.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'file2.mp4':
  Metadata:
    major_brand     : iso5
    minor_version   : 512
    compatible_brands: iso6mp41
    encoder         : Lavf57.57.100
    Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      encoder         : Lavc57.66.103 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 (h264) -> drawtext
  drawtext -> Stream #0:0 (libx264)
Press [q] to stop, [?] for help
frame=  843 fps= 36 q=-1.0 Lsize=   10386kB time=00:00:35.00 bitrate=2430.9kbits/s dup=2 drop=0 speed= 1.5x
video:10375kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.103293%
[libx264 @ 000000000315f7c0] frame I:4     Avg QP: 5.49  size: 41664
[libx264 @ 000000000315f7c0] frame P:285   Avg QP:12.19  size: 19489
[libx264 @ 000000000315f7c0] frame B:554   Avg QP:13.02  size:  8849
[libx264 @ 000000000315f7c0] consecutive B-frames:  2.6% 28.7%  1.8% 66.9%
[libx264 @ 000000000315f7c0] mb I  I16..4: 65.5% 27.6%  6.9%
[libx264 @ 000000000315f7c0] mb P  I16..4:  9.0% 11.3%  1.3%  P16..4: 15.5%  5.1%  2.2%  0.0%  0.0%    skip:55.6%
[libx264 @ 000000000315f7c0] mb B  I16..4:  2.4%  2.2%  0.1%  B16..8: 11.6%  4.9%  0.6%  direct: 7.1%  skip:71.0%  L0:50.3% L1:45.1% BI: 4.6%
[libx264 @ 000000000315f7c0] 8x8 transform intra:49.4% inter:53.5%
[libx264 @ 000000000315f7c0] coded y,uvDC,uvAC intra: 26.0% 54.6% 16.0% inter: 4.1% 16.1% 0.6%
[libx264 @ 000000000315f7c0] i16 v,h,dc,p: 52% 26% 14%  8%
[libx264 @ 000000000315f7c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 22% 38%  1%  1%  1%  2%  1%  2%
[libx264 @ 000000000315f7c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 28% 20%  2%  3%  3%  3%  2%  2%
[libx264 @ 000000000315f7c0] i8c dc,h,v,p: 49% 19% 26%  7%
[libx264 @ 000000000315f7c0] Weighted P-Frames: Y:15.4% UV:8.1%
[libx264 @ 000000000315f7c0] ref P L0: 71.5% 28.5%
[libx264 @ 000000000315f7c0] ref B L0: 84.7% 15.3%
[libx264 @ 000000000315f7c0] ref B L1: 96.2%  3.8%
[libx264 @ 000000000315f7c0] kb/s:2419.57

This is the media info I obtained:

Video
ID                          : 1
Format                      : AVC
Format/Info                 : Advanced Video Codec
Format profile              : High@L4
Format settings, CABAC      : Yes
Format settings, ReFrames   : 2 frames
Codec ID                    : avc1
Codec ID/Info               : Advanced Video Coding
Duration                    : 50s 0ms
Bit rate                    : 2 991 Kbps
Width                       : 1 920 pixels
Height                      : 1 080 pixels
Display aspect ratio        : 16:9
Frame rate mode             : Variable
Frame rate                  : 23.976 (23976/1000) fps
Minimum frame rate          : 12.000 fps
Maximum frame rate          : 24.000 fps
Color space                 : YUV
Chroma subsampling          : 4:2:0
Bit depth                   : 8 bits
Scan type                   : Progressive
Bits/(Pixel*Frame)          : 0.060
Stream size                 : 17.8 MiB (100%)
Writing library             : x264 core 148 r2708 86b7198
Encoding settings           : cabac=1 / ref=2 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=1 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=crf / mbtree=1 / crf=17.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

**Tags:** ffmpeg, video, premiere, timecode

> **Comments:**
> **username_1**: The console output shows only two duplicated frames. But the output is only 1m27s whereas the source is 51m. So, if there are dropped frames further, this console output won't reveal that. Does Premiere at the 1m27s mark show a 2 frame difference?  
> **username_0**: @Mulvya sorry I realized that I created a wrong sequence in Premiere with a fps of 23.297 instead 24.. If I create a sequence of 24 fps indeed i have 2 frames off only. How can I get rid of this 2 or more duplicate frames? Is my command good or I have to write it in a better way to have not duplicate or dropped frames for the future encodings ? thanks  
> **username_1**: Disable the audio and subtitles and encode. Then mux the encoded video with the original audio/subs into a new MP4.  
> **username_0**: @Mulvya do you think that the problem is a matter of matching with audio and subs? :O I could try..  
> **username_0**: @Mulvya ok I did it, keeping only the video, however as you can see in console the 2 dup frames are still there :\  
> **username_1**: Use `-vsync 0`.  
> **username_0**: @Mulvya i added vsync 0 and now it doesn't sign duped frames however the time is always off of about 2 frames in the comparison between the timecode and adobe premiere  
> **username_1**: Wait a minute. It might be this [bug](https://superuser.com/q/1119072/114058).  
> **username_0**: @Mulvya Fine but disabling B and P frames doesn't just make everything huge? :O  
> **username_1**: None of the options I suggested there disable P-frames. And B-frames aren't disabled, just limited. Or you could just live with the missing 2 frames :)  

---

## 1 answers

### Answer by username_2 on 2017-04-01. Score: 2

You might have variable frame rate media. The time base looks pretty crazy for standard 24p media. I might hit it with [MediaInfo](https://mediaarea.net/en/MediaInfo) (note the Windows GUI includes adware, but the CLI version does not) and post the output from that.

> **Comments:**
> **username_0**: Yes.. it seems so, I tried many transcodings and always it seems change th fps on the fly. How can I obtain a constant output ?  
> **username_1**: That time base is the standard that ffmpeg produces i.e .framerate x 512.  
> **username_0**: @Mulvya let me post the info for the last encoded file...  
> **username_0**: @Mulvya let me reply here so both of you can read, I did many other tests, I also tried to encode only the video in .mov with a proress codec instead of h264.. ffmpeg doesn't show duplicated frames however at the very beginning of the movie there's the black background with white text for the initial credits.. and in this part 00:00:00:03 and 00:00:00:04 are repeated 2 times in premiere leaving Premiere being always +2 frames over the total until the end :( I don't understand why, can it be something bugged about particular scenes like white text on black background?  
> **username_2**: @username_0 What you would need to do is manually specify the output frame rate in your encoding tool. So for `ffmpeg` you would use `-r 24000/1001` for 23.976, and for Handbrake there's a dropdown and you would select Constant Frame Rate.  

---

