Body: <p>I have creeated a video using FFmpeg. It is a result of putting 4 videos together, tiled, using <code>-filter_complex</code> with overlays.</p>
  
  <p>Following the how-to <a href="https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos" rel="nofollow noreferrer">here</a>, I have it created as MKV.</p>
  
  <p>When playing this in VLC, the file is sometimes not seekable and sometimes the seeking acts weirdly - it displays some length, but it is only seekable up to the length of the shortest overlay. And the console logs a lot of errors on seeking, like:</p>
  
  <pre><code>VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
  [000055d320ad9630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
  libva info: VA-API version 1.1.0
  libva info: va_getDriverName() returns -1
  libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
  [00007f4358002ca0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
  libva info: VA-API version 1.1.0
  libva info: va_getDriverName() returns 0
  libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
  libva info: Found init function __vaDriverInit_1_1
  libva info: va_openDriver() returns 0
  [00007f43b0c8ccc0] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 9000000)
  [00007f43b0c8ccc0] main decoder error: Could not convert timestamp 33852223320 for FFmpeg
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0d69240] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 3000000)
  [00007f43b0d69240] main decoder error: Could not convert timestamp 33862004475 for faad
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0d69240] main decoder error: Timestamp conversion failed for 142272501: no reference clock
  [00007f43b0d69240] main decoder error: Could not convert timestamp 0 for faad
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 9000000)
  [00007f43b0c8ccc0] main decoder error: Could not convert timestamp 33884814492 for FFmpeg
  </code></pre>
  
  <p>Then I created the same video as MP4, and it works fine, except, when the shortest video quarter "ends", the resulting file stops too, and the resulting play time is not accessible (meaning, the position widget is towards the beginning rather at the end). Here are the errors thrown during playback of that MP4:</p>
  
  <pre><code>[00007f8bbc000c40] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 300 ms)
  [h264 @ 0x7f8bfce0a780] co located POCs unavailable
  [h264 @ 0x7f8bfce7e160] mmco: unref short failure
  [00007f8bbc000c40] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 755 ms)
  [h264 @ 0x7f8bfce0a780] co located POCs unavailable
  [h264 @ 0x7f8bfce19f00] mmco: unref short failure
  [h264 @ 0x7f8bfce61f80] co located POCs unavailable
  </code></pre>
  
  <p>All overlays have <code>shortest=1</code>, which should cut the resulting video at the end of the shortest.</p>
  
  <p>What is wrong, and how can I fix that? </p>
  
  <pre><code>ffmpeg version 4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  </code></pre>
  
  <p>The full command to get the video is, for instance:</p>
  
  <pre><code>ffmpeg \
   -i '/.../2014-11-21/....mp4' \
   -i '/.../2016-01/....mp4' \
  -filter_complex "nullsrc=size=960x270 [lay0];
        [0:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_1]; 
        [1:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_2]; 
        [lay0][TILE_1_1] overlay=shortest=1:x=0:y=0 [lay1]; 
        [lay1][TILE_1_2] overlay=shortest=1:x=480:y=0     "      -c:v libx264 ./tiled.mp4
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-24T04:39:41.543Z
Comments.Text: Need to see full command and its log.
Comments.UserDisplayName: Gyan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-24T17:29:56.707Z
Comments.Text: It seems that the problem is related to the different lengths. The resulting file has the reported length of the longest clip used, but stops playing right at the end of the shortest.
Comments.UserDisplayName: Ondra Žižka
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-03-24T17:37:00.447Z
Comments.Text: Remove `shortest=1` from all overlays except the first.
Comments.UserDisplayName: Gyan
Tags: <ffmpeg><mp4><filter><mkv><vlc>
Title: What's wrong with VLC seeking and/or MKV created by ffmpeg?
UserDisplayName: Ondra Žižka
ThreadText: # What's wrong with VLC seeking and/or MKV created by ffmpeg?
  
  (Asked by: username_0 on 2019-03-23)
  
  I have creeated a video using FFmpeg. It is a result of putting 4 videos together, tiled, using `-filter_complex` with overlays.
  
  Following the how-to [here](https://trac.ffmpeg.org/wiki/Create%20a%20mosaic%20out%20of%20several%20input%20videos), I have it created as MKV.
  
  When playing this in VLC, the file is sometimes not seekable and sometimes the seeking acts weirdly - it displays some length, but it is only seekable up to the length of the shortest overlay. And the console logs a lot of errors on seeking, like:
  
  ```
  VLC media player 3.0.4 Vetinari (revision 3.0.4-0-gf615db6332)
  [000055d320ad9630] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
  libva info: VA-API version 1.1.0
  libva info: va_getDriverName() returns -1
  libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
  [00007f4358002ca0] glconv_vaapi_x11 gl error: vaInitialize: unknown libva error
  libva info: VA-API version 1.1.0
  libva info: va_getDriverName() returns 0
  libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/i965_drv_video.so
  libva info: Found init function __vaDriverInit_1_1
  libva info: va_openDriver() returns 0
  [00007f43b0c8ccc0] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 9000000)
  [00007f43b0c8ccc0] main decoder error: Could not convert timestamp 33852223320 for FFmpeg
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0d69240] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 3000000)
  [00007f43b0d69240] main decoder error: Could not convert timestamp 33862004475 for faad
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0d69240] main decoder error: Timestamp conversion failed for 142272501: no reference clock
  [00007f43b0d69240] main decoder error: Could not convert timestamp 0 for faad
  [00007f43b0c8ccc0] main decoder error: buffer deadlock prevented
  [00007f43b0c8ccc0] main decoder error: Timestamp conversion failed (delay 300000, buffering 100000, bound 9000000)
  [00007f43b0c8ccc0] main decoder error: Could not convert timestamp 33884814492 for FFmpeg
  
  ```
  
  Then I created the same video as MP4, and it works fine, except, when the shortest video quarter "ends", the resulting file stops too, and the resulting play time is not accessible (meaning, the position widget is towards the beginning rather at the end). Here are the errors thrown during playback of that MP4:
  
  ```
  [00007f8bbc000c40] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 300 ms)
  [h264 @ 0x7f8bfce0a780] co located POCs unavailable
  [h264 @ 0x7f8bfce7e160] mmco: unref short failure
  [00007f8bbc000c40] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 755 ms)
  [h264 @ 0x7f8bfce0a780] co located POCs unavailable
  [h264 @ 0x7f8bfce19f00] mmco: unref short failure
  [h264 @ 0x7f8bfce61f80] co located POCs unavailable
  
  ```
  
  All overlays have `shortest=1`, which should cut the resulting video at the end of the shortest.
  
  What is wrong, and how can I fix that?
  
  ```
  ffmpeg version 4.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers
    built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
    configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg
    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100
  
  ```
  
  The full command to get the video is, for instance:
  
  ```
  ffmpeg \
   -i '/.../2014-11-21/....mp4' \
   -i '/.../2016-01/....mp4' \
  -filter_complex "nullsrc=size=960x270 [lay0];
        [0:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_1]; 
        [1:v] setpts=PTS-STARTPTS, scale=480x270 [TILE_1_2]; 
        [lay0][TILE_1_1] overlay=shortest=1:x=0:y=0 [lay1]; 
        [lay1][TILE_1_2] overlay=shortest=1:x=480:y=0     "      -c:v libx264 ./tiled.mp4
  
  ```
  
  **Tags:** ffmpeg, mp4, filter, mkv, vlc
  
  > **Comments:**
  > **username_1**: Need to see full command and its log.  
  > **username_0**: It seems that the problem is related to the different lengths. The resulting file has the reported length of the longest clip used, but stops playing right at the end of the shortest.  
  > **username_1**: Remove `shortest=1` from all overlays except the first.  
  
  ---
  
  ## 0 answers
  
  