Answers.Body: <p>2 Things:<br>
  1. why do you only convert the <code>0</code> stream? you could just do <code>-c:v libx264</code> (instead of <code>-codec:v:0 libx264</code>)<br>
  2. you could try to use the <code>shortest</code> statement in your <code>overlay</code>-statement. Like this <code>[0:v][0:s:0]overlay=shortest[v1]</code>, </p>
  
  <p>See here for more:<br>
  <a href="https://ffmpeg.org/ffmpeg-filters.html#overlay-1" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#overlay-1</a><br>
  <a href="https://ffmpeg.org/ffmpeg-filters.html#framesync" rel="nofollow noreferrer">https://ffmpeg.org/ffmpeg-filters.html#framesync</a></p>
  
  <p>You could also try reencoding your transcoded video without filters and see if you get errors or if the time is fixed after that.</p>
  
  <p>Greetings</p>
  
  <p>(This is posted as an answer and not a comment, because I can't comment)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-02T02:54:11.600Z
Answers.Text: Shortest solved it. I set it to shortest=1. But I am not sure why shortest fixes it.
Answers.UserDisplayName: Michael
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-02T11:56:29.627Z
Answers.Text: Probably one your videos is extremely long, or the overlay filter has issues with overlaying the subtitle stream and keeping the timestamps intact. Eitherway usually in an overlay you don't want to run one stream, while the other already ended. The shortest flag just tells the filter to stop when the first stream ends and discard the remainder of the other streams.
Answers.UserDisplayName: Pingger Shikkoken
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-05-31T11:37:53.870Z
Answers.LastActivityDate: 2020-05-31T11:37:53.870Z
Answers.UserDisplayName: Pingger Shikkoken
Body: <p>I am converting a video using the following:</p>
  
  <pre><code>$ ffmpeg -y -analyzeduration 2147483647 -probesize 2147483647 -i /home/michael/Desktop/transcodingtemp/output.mkv -max_interleave_delta 0 -filter_complex "[0:v][0:s:0]overlay[v1];[v1]scale=w=-2:h=720:flags=gauss[v2]" -max_muxing_queue_size 1024 -map "[v2]" -map 0:1? -map 0:2? -map 0:3? -map 0:4? -max_muxing_queue_size 9999 -codec:v:0 libx264 -crf 23 -c:a aac -b:a 320k -sn /home/michael/Desktop/transcodingtemp/output.mkv_transcoded.mkv
  ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
    configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  Input #0, matroska,webm, from '/home/michael/Desktop/transcodingtemp/output.mkv':
    Metadata:
      ENCODER         : Lavf58.29.100
    Duration: 00:05:00.11, start: 0.000000, bitrate: 3243 kb/s
      Chapter #0:0: start 0.000000, end 159.493000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 159.493000, end 300.000000
      Metadata:
        title           : Chapter 02
      Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
      Metadata:
        BPS-eng         : 1368113
        DURATION-eng    : 01:38:24.941000000
        NUMBER_OF_FRAMES-eng: 141577
        NUMBER_OF_BYTES-eng: 1009828723
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        ENCODER         : Lavc57.107.100 h264_vaapi
        DURATION        : 00:05:00.112000000
      Stream #0:1(jpn): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
      Metadata:
        BPS-eng         : 310439
        DURATION-eng    : 01:38:24.938000000
        NUMBER_OF_FRAMES-eng: 276794
        NUMBER_OF_BYTES-eng: 229141045
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        ENCODER         : Lavc57.107.100 aac
        DURATION        : 00:05:00.010000000
      Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080 (default)
      Metadata:
        title           : English Sub (Translated from Japanese)
        BPS-eng         : 17619
        DURATION-eng    : 01:35:43.029000000
        NUMBER_OF_FRAMES-eng: 2298
        NUMBER_OF_BYTES-eng: 12648785
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        DURATION        : 00:04:54.440000000
  Stream mapping:
    Stream #0:0 (h264) -&gt; overlay:main (graph 0)
    Stream #0:2 (pgssub) -&gt; overlay:overlay (graph 0)
    scale (graph 0) -&gt; Stream #0:0 (libx264)
    Stream #0:1 -&gt; #0:1 (aac (native) -&gt; aac (native))
  Press [q] to stop, [?] for help
  [matroska,webm @ 0x5571480cfb80] sub2video: using 1920x1080 canvas
  [libx264 @ 0x5571480fdf40] using SAR=1/1
  [libx264 @ 0x5571480fdf40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  [libx264 @ 0x5571480fdf40] profile High, level 3.1
  [libx264 @ 0x5571480fdf40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 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=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=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=2 keyint=250 keyint_min=23 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 '/home/michael/Desktop/transcodingtemp/output.mkv_transcoded.mkv':
    Metadata:
      encoder         : Lavf58.29.100
      Chapter #0:0: start 0.000000, end 159.493000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 159.493000, end 300.000000
      Metadata:
        title           : Chapter 02
      Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default)
      Metadata:
        encoder         : Lavc58.54.100 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
      Stream #0:1(jpn): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1, fltp, 320 kb/s (default)
      Metadata:
        BPS-eng         : 310439
        DURATION-eng    : 01:38:24.938000000
        NUMBER_OF_FRAMES-eng: 276794
        NUMBER_OF_BYTES-eng: 229141045
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        DURATION        : 00:05:00.010000000
        encoder         : Lavc58.54.100 aac
  [matroska @ 0x5571480fc080] Starting new cluster due to timestampte=1026.8kbits/s speed=2.92x    
      Last message repeated 1 times
  frame= 7075 fps= 69 q=-1.0 Lsize=   38040kB time=00:05:00.01 bitrate=1038.7kbits/s speed=2.91x    
  video:26400kB audio:11493kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.388885%
  [libx264 @ 0x5571480fdf40] frame I:57    Avg QP:14.50  size: 67869
  [libx264 @ 0x5571480fdf40] frame P:1978  Avg QP:18.64  size:  8377
  [libx264 @ 0x5571480fdf40] frame B:5040  Avg QP:24.34  size:  1308
  [libx264 @ 0x5571480fdf40] consecutive B-frames:  3.2%  3.8%  5.1% 87.9%
  [libx264 @ 0x5571480fdf40] mb I  I16..4: 32.8% 45.8% 21.5%
  [libx264 @ 0x5571480fdf40] mb P  I16..4:  2.5%  5.9%  0.9%  P16..4: 16.6%  7.0%  4.4%  0.0%  0.0%    skip:62.7%
  [libx264 @ 0x5571480fdf40] mb B  I16..4:  0.2%  0.3%  0.1%  B16..8: 14.6%  1.0%  0.1%  direct: 0.7%  skip:83.0%  L0:42.8% L1:52.9% BI: 4.4%
  [libx264 @ 0x5571480fdf40] 8x8 transform intra:58.7% inter:71.8%
  [libx264 @ 0x5571480fdf40] coded y,uvDC,uvAC intra: 36.5% 56.5% 28.2% inter: 3.8% 5.5% 0.4%
  [libx264 @ 0x5571480fdf40] i16 v,h,dc,p: 46% 30%  5% 20%
  [libx264 @ 0x5571480fdf40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 25%  4%  6%  5%  6%  4%  4%
  [libx264 @ 0x5571480fdf40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 23% 16%  5%  7%  7%  7%  5%  5%
  [libx264 @ 0x5571480fdf40] i8c dc,h,v,p: 52% 23% 19%  6%
  [libx264 @ 0x5571480fdf40] Weighted P-Frames: Y:9.3% UV:5.3%
  [libx264 @ 0x5571480fdf40] ref P L0: 71.0% 14.0% 11.2%  3.7%  0.1%
  [libx264 @ 0x5571480fdf40] ref B L0: 91.6%  6.8%  1.6%
  [libx264 @ 0x5571480fdf40] ref B L1: 96.6%  3.4%
  [libx264 @ 0x5571480fdf40] kb/s:0.03
  [aac @ 0x55714810e580] Qavg: 3812.204
  </code></pre>
  
  <p>The problem is that when I check the video, I get on VLC an incorrect max time 1197 hours. I know the problem is caused by the overlay (filter_complex) but don't know why. I also tried just "-filter_complex "[0:v][0:s:0]overlay[v1]" but even produces the same result.</p>
  
Tags: <ffmpeg>
Title: ffmpeg conversions lead to incorrect time on vlc
UserDisplayName: Michael
ThreadText: # ffmpeg conversions lead to incorrect time on vlc
  
  (Asked by: username_0 on 2020-05-30)
  
  I am converting a video using the following:
  
  ```
  $ ffmpeg -y -analyzeduration 2147483647 -probesize 2147483647 -i /home/username_0/Desktop/transcodingtemp/output.mkv -max_interleave_delta 0 -filter_complex "[0:v][0:s:0]overlay[v1];[v1]scale=w=-2:h=720:flags=gauss[v2]" -max_muxing_queue_size 1024 -map "[v2]" -map 0:1? -map 0:2? -map 0:3? -map 0:4? -max_muxing_queue_size 9999 -codec:v:0 libx264 -crf 23 -c:a aac -b:a 320k -sn /home/username_0/Desktop/transcodingtemp/output.mkv_transcoded.mkv
  ffmpeg version 4.2.2-1ubuntu1 Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 9 (Ubuntu 9.3.0-3ubuntu1)
    configuration: --prefix=/usr --extra-version=1ubuntu1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
    libavutil      56. 31.100 / 56. 31.100
    libavcodec     58. 54.100 / 58. 54.100
    libavformat    58. 29.100 / 58. 29.100
    libavdevice    58.  8.100 / 58.  8.100
    libavfilter     7. 57.100 /  7. 57.100
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  5.100 /  5.  5.100
    libswresample   3.  5.100 /  3.  5.100
    libpostproc    55.  5.100 / 55.  5.100
  Input #0, matroska,webm, from '/home/username_0/Desktop/transcodingtemp/output.mkv':
    Metadata:
      ENCODER         : Lavf58.29.100
    Duration: 00:05:00.11, start: 0.000000, bitrate: 3243 kb/s
      Chapter #0:0: start 0.000000, end 159.493000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 159.493000, end 300.000000
      Metadata:
        title           : Chapter 02
      Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
      Metadata:
        BPS-eng         : 1368113
        DURATION-eng    : 01:38:24.941000000
        NUMBER_OF_FRAMES-eng: 141577
        NUMBER_OF_BYTES-eng: 1009828723
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        ENCODER         : Lavc57.107.100 h264_vaapi
        DURATION        : 00:05:00.112000000
      Stream #0:1(jpn): Audio: aac (LC), 48000 Hz, 5.1, fltp (default)
      Metadata:
        BPS-eng         : 310439
        DURATION-eng    : 01:38:24.938000000
        NUMBER_OF_FRAMES-eng: 276794
        NUMBER_OF_BYTES-eng: 229141045
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        ENCODER         : Lavc57.107.100 aac
        DURATION        : 00:05:00.010000000
      Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080 (default)
      Metadata:
        title           : English Sub (Translated from Japanese)
        BPS-eng         : 17619
        DURATION-eng    : 01:35:43.029000000
        NUMBER_OF_FRAMES-eng: 2298
        NUMBER_OF_BYTES-eng: 12648785
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        DURATION        : 00:04:54.440000000
  Stream mapping:
    Stream #0:0 (h264) -> overlay:main (graph 0)
    Stream #0:2 (pgssub) -> overlay:overlay (graph 0)
    scale (graph 0) -> Stream #0:0 (libx264)
    Stream #0:1 -> #0:1 (aac (native) -> aac (native))
  Press [q] to stop, [?] for help
  [matroska,webm @ 0x5571480cfb80] sub2video: using 1920x1080 canvas
  [libx264 @ 0x5571480fdf40] using SAR=1/1
  [libx264 @ 0x5571480fdf40] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
  [libx264 @ 0x5571480fdf40] profile High, level 3.1
  [libx264 @ 0x5571480fdf40] 264 - core 155 r2917 0a84d98 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 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=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=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=2 keyint=250 keyint_min=23 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 '/home/username_0/Desktop/transcodingtemp/output.mkv_transcoded.mkv':
    Metadata:
      encoder         : Lavf58.29.100
      Chapter #0:0: start 0.000000, end 159.493000
      Metadata:
        title           : Chapter 01
      Chapter #0:1: start 159.493000, end 300.000000
      Metadata:
        title           : Chapter 02
      Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 23.98 fps, 1k tbn, 23.98 tbc (default)
      Metadata:
        encoder         : Lavc58.54.100 libx264
      Side data:
        cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
      Stream #0:1(jpn): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 48000 Hz, 5.1, fltp, 320 kb/s (default)
      Metadata:
        BPS-eng         : 310439
        DURATION-eng    : 01:38:24.938000000
        NUMBER_OF_FRAMES-eng: 276794
        NUMBER_OF_BYTES-eng: 229141045
        _STATISTICS_WRITING_APP-eng: mkvmerge v34.0.0 ('Sight and Seen') 64-bit
        _STATISTICS_WRITING_DATE_UTC-eng: 2019-06-07 05:38:49
        _STATISTICS_TAGS-eng: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
        DURATION        : 00:05:00.010000000
        encoder         : Lavc58.54.100 aac
  [matroska @ 0x5571480fc080] Starting new cluster due to timestampte=1026.8kbits/s speed=2.92x    
      Last message repeated 1 times
  frame= 7075 fps= 69 q=-1.0 Lsize=   38040kB time=00:05:00.01 bitrate=1038.7kbits/s speed=2.91x    
  video:26400kB audio:11493kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.388885%
  [libx264 @ 0x5571480fdf40] frame I:57    Avg QP:14.50  size: 67869
  [libx264 @ 0x5571480fdf40] frame P:1978  Avg QP:18.64  size:  8377
  [libx264 @ 0x5571480fdf40] frame B:5040  Avg QP:24.34  size:  1308
  [libx264 @ 0x5571480fdf40] consecutive B-frames:  3.2%  3.8%  5.1% 87.9%
  [libx264 @ 0x5571480fdf40] mb I  I16..4: 32.8% 45.8% 21.5%
  [libx264 @ 0x5571480fdf40] mb P  I16..4:  2.5%  5.9%  0.9%  P16..4: 16.6%  7.0%  4.4%  0.0%  0.0%    skip:62.7%
  [libx264 @ 0x5571480fdf40] mb B  I16..4:  0.2%  0.3%  0.1%  B16..8: 14.6%  1.0%  0.1%  direct: 0.7%  skip:83.0%  L0:42.8% L1:52.9% BI: 4.4%
  [libx264 @ 0x5571480fdf40] 8x8 transform intra:58.7% inter:71.8%
  [libx264 @ 0x5571480fdf40] coded y,uvDC,uvAC intra: 36.5% 56.5% 28.2% inter: 3.8% 5.5% 0.4%
  [libx264 @ 0x5571480fdf40] i16 v,h,dc,p: 46% 30%  5% 20%
  [libx264 @ 0x5571480fdf40] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 19% 25%  4%  6%  5%  6%  4%  4%
  [libx264 @ 0x5571480fdf40] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 23% 16%  5%  7%  7%  7%  5%  5%
  [libx264 @ 0x5571480fdf40] i8c dc,h,v,p: 52% 23% 19%  6%
  [libx264 @ 0x5571480fdf40] Weighted P-Frames: Y:9.3% UV:5.3%
  [libx264 @ 0x5571480fdf40] ref P L0: 71.0% 14.0% 11.2%  3.7%  0.1%
  [libx264 @ 0x5571480fdf40] ref B L0: 91.6%  6.8%  1.6%
  [libx264 @ 0x5571480fdf40] ref B L1: 96.6%  3.4%
  [libx264 @ 0x5571480fdf40] kb/s:0.03
  [aac @ 0x55714810e580] Qavg: 3812.204
  
  ```
  
  The problem is that when I check the video, I get on VLC an incorrect max time 1197 hours. I know the problem is caused by the overlay (filter\_complex) but don't know why. I also tried just "-filter\_complex "[0:v][0:s:0]overlay[v1]" but even produces the same result.
  
  **Tags:** ffmpeg
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2020-05-31. Score: 1 | Accepted answer
  
  2 Things:  
  1. why do you only convert the `0` stream? you could just do `-c:v libx264` (instead of `-codec:v:0 libx264`)  
  2. you could try to use the `shortest` statement in your `overlay`-statement. Like this `[0:v][0:s:0]overlay=shortest[v1]`,
  
  See here for more:  
  <https://ffmpeg.org/ffmpeg-filters.html#overlay-1>  
  <https://ffmpeg.org/ffmpeg-filters.html#framesync>
  
  You could also try reencoding your transcoded video without filters and see if you get errors or if the time is fixed after that.
  
  Greetings
  
  (This is posted as an answer and not a comment, because I can't comment)
  
  > **Comments:**
  > **username_0**: Shortest solved it. I set it to shortest=1. But I am not sure why shortest fixes it.  
  > **username_1**: Probably one your videos is extremely long, or the overlay filter has issues with overlaying the subtitle stream and keeping the timestamps intact. Eitherway usually in an overlay you don't want to run one stream, while the other already ended. The shortest flag just tells the filter to stop when the first stream ends and discard the remainder of the other streams.  
  
  ---
  
  