mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
27.87k stars 2.87k forks source link

MPV jumps to 10 seconds before the end, if video stream is a single image #12269

Open SunSerega opened 1 year ago

SunSerega commented 1 year ago

Maybe related to #2498

Important Information

https://youtu.be/3kCw8jYnQrk

  1. I start mpv without options, the same way it would if I double-click the file in Explorer. You can see that trying to seek by clicking or pressing the left or down arrow doesn't work, it always jumps to 10 seconds before the end of the audio stream.
  2. I start mpv with --start=1. Now it doesn't even load the video stream. It only does after I try to seek.

The output from that demonstration video:

G:\0Music\3Sort\Hinkik>"C:\Program Files\MPV\mpv.com" --version
mpv 0.35.0-579-gca4192e2 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Sun Jul 23 01:30:52 2023
libplacebo version: v6.292.0-13-gf53badb-dirty
FFmpeg version: N-111598-gb2ceed406
FFmpeg library versions:
   libavutil       58.14.100
   libavcodec      60.22.100
   libavformat     60.10.100
   libswscale      7.3.100
   libavfilter     9.8.102
   libswresample   4.11.100

G:\0Music\3Sort\Hinkik>ffprobe -i "[20210118] Time Leaper.mkv"
ffprobe version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[matroska,webm @ 000001a158467200] Could not find codec parameters for stream 1 (Video: h264, none(tv, unknown/bt709/unknown, progressive), 1500x849): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from '[20210118] Time Leaper.mkv':
  Metadata:
    COMPATIBLE_BRANDS: isomiso2avc1mp41
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 512
    ENCODER         : Lavf60.10.100
  Duration: 00:04:00.61, start: 0.000000, bitrate: 116 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc.
      VENDOR_ID       : [0][0][0][0]
      ENCODER         : Lavc60.22.100 libvorbis
      DURATION        : 00:04:00.608000000
  Stream #0:1: Video: h264, none(tv, unknown/bt709/unknown, progressive), 1500x849, SAR 1:1 DAR 500:283, 25 fps, 25 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc60.22.100 libx264
      DURATION        : 00:00:00.043000000

If I start mpv.com:

G:\0Music\3Sort\Hinkik>"C:\Program Files\MPV\mpv.com" --start=1 "[20210118] Time Leaper.mkv"
 (+) Video --vid=1 (h264 1500x849 25.000fps)
 (+) Audio --aid=1 (*) (vorbis 2ch 44100Hz)
[mkv] Discarding potentially broken or useless index.
AO: [wasapi] 48000Hz stereo 2ch float
AV: 00:00:04 / 00:04:00 (2%) A-V:  0.000

Exiting... (Quit)

Sample files

[20210118] Time Leaper.zip

Reproduction steps

I made that MKV video by taking an audio stream from an MP4 file and a PNG file. I didn't give ffmpeg any options, other than -i and -map. Can also upload those original MP4 and PNG, if you need them.

Log file

mpv.log

llyyr commented 1 year ago

Your file is broken, even ffplay can't seek through it. [20210118] Time Leaper.mkv: error while seeking.

From what I understand you want to add album art to audio files?

Traneptora commented 1 year ago

The file is broken, and is reported as such with ffmpeg -i. How did you even create it, and with what version of FFmpeg?

christoph-heinrich commented 1 year ago

Your sample plays fine for me, but fast seeking always goes to the beginning of the file (which isn't surprising, as that is the only keyframe).

P.S. Thanks for reminding me of that gem of a song.

SunSerega commented 1 year ago

How did you even create it, and with what version of FFmpeg?

I described it above. You can see the version in the output.

As I said, I can also give you the inputs I used. I can well imagine ffmpeg doing something really dumb here. But the fact is also that the file plays normally, it only fails to seek.

SunSerega commented 1 year ago

I was sure github would not allow me to upload something so big... But it did:

[20210118] Time Leaper.zip

G:\0Music\3Sort\Hinkik>ffmpeg -i "[20210118] Time Leaper.mp4" -i "[20210118] Time Leaper.png" -map 0:1 -map 1:0 0.mkv
ffmpeg version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '[20210118] Time Leaper.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.10.100
  Duration: 00:04:00.61, start: 0.000000, bitrate: 507 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1080 [SAR 1:1 DAR 1:1], 373 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Input #1, png_pipe, from '[20210118] Time Leaper.png':
  Duration: N/A, bitrate: N/A
  Stream #1:0: Video: png, rgb24(pc, gbr/bt709/unknown), 1500x849 [SAR 2835:2835 DAR 500:283], 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:1 -> #0:0 (aac (native) -> vorbis (libvorbis))
  Stream #1:0 -> #0:1 (png (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 000002a74f4713c0] using SAR=1/1
[libx264 @ 000002a74f4713c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000002a74f4713c0] profile High 4:4:4 Predictive, level 3.2, 4:4:4, 8-bit
[libx264 @ 000002a74f4713c0] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - 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=4 threads=18 lookahead_threads=3 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=25 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 '0.mkv':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.10.100
  Stream #0:0(und): Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, stereo, fltp (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.22.100 libvorbis
  Stream #0:1: Video: h264 (H264 / 0x34363248), yuv444p(tv, unknown/bt709/unknown, progressive), 1500x849 [SAR 1:1 DAR 500:283], q=2-31, 25 fps, 1k tbn
    Metadata:
      encoder         : Lavc60.22.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
[matroska @ 000002a74f428680] Starting new cluster due to timestamp 105.6kbits/s speed=53.6x
[out#0/matroska @ 000002a74f428540] video:49kB audio:3295kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 2.585787%
frame=    1 fps=0.2 q=28.0 Lsize=    3430kB time=00:04:00.58 bitrate= 116.8kbits/s speed=53.2x
[libx264 @ 000002a74f4713c0] frame I:1     Avg QP:27.03  size: 49085
[libx264 @ 000002a74f4713c0] mb I  I16..4:  8.3% 63.4% 28.3%
[libx264 @ 000002a74f4713c0] 8x8 transform intra:63.4%
[libx264 @ 000002a74f4713c0] coded y,u,v intra: 54.6% 20.0% 8.6%
[libx264 @ 000002a74f4713c0] i16 v,h,dc,p: 25% 23% 18% 33%
[libx264 @ 000002a74f4713c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 18% 19%  7%  7%  7%  8%  6%  8%
[libx264 @ 000002a74f4713c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 28% 21% 13%  7%  8%  6%  8%  5%  4%
[libx264 @ 000002a74f4713c0] kb/s:9817.00

G:\0Music\3Sort\Hinkik>ffprobe -i 0.mkv
ffprobe version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2007-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[matroska,webm @ 000002053ca0a680] Could not find codec parameters for stream 1 (Video: h264, none(tv, unknown/bt709/unknown, progressive), 1500x849): unspecified pixel format
Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options
Input #0, matroska,webm, from '0.mkv':
  Metadata:
    COMPATIBLE_BRANDS: isomiso2avc1mp41
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 512
    ENCODER         : Lavf60.10.100
  Duration: 00:04:00.61, start: 0.000000, bitrate: 116 kb/s
  Stream #0:0: Audio: vorbis, 44100 Hz, stereo, fltp (default)
    Metadata:
      HANDLER_NAME    : ISO Media file produced by Google Inc.
      VENDOR_ID       : [0][0][0][0]
      ENCODER         : Lavc60.22.100 libvorbis
      DURATION        : 00:04:00.608000000
  Stream #0:1: Video: h264, none(tv, unknown/bt709/unknown, progressive), 1500x849, SAR 1:1 DAR 500:283, 25 fps, 25 tbr, 1k tbn
    Metadata:
      ENCODER         : Lavc60.22.100 libx264
      DURATION        : 00:00:00.043000000
SunSerega commented 1 year ago

From what I understand you want to add album art to audio files?

Something like that. In this case, the YT video had a very truncated image. Also, YT created a huge number of keyframes, so it ended up being, like, 5 times as heavy as it needed to be. So I downloaded the original art to replace it with.

llyyr commented 1 year ago

You can't just insert a png as the video track. You have to use the id3 tag for this if you use an audio format, or create a video track

ffmpeg -loop 1 -framerate 1 -i $album_art -i $audio -c:v libx264 -tune stillimage -c:a copy $out

SunSerega commented 1 year ago

With this command, the processing never ends. It makes an infinite video after the audio track finishes. And it weighs a whole lot more.

Can you please also explain in more detail why my approach shouldn't work? I mean, ffmpeg can read images and treat them as 1-frame-long videos. And it is common for video and audio tracks to have slightly different lengths.

When playing such a video - it already works fine. When the video stream ends and the audio continues - mpv just shows the same last frame of video. I think it would make the most sense to also show the last available frame when seeking past the end of the video stream.

llyyr commented 1 year ago

With this command, the processing never ends. It makes an infinite video after the audio track finishes. And it weighs a whole lot more.

add -shortest

And it is common for video and audio tracks to have slightly different lengths.

Correct, mpv will use the video presentation time if available though. Your file will playback and seek just fine with --no-video.

Can you please also explain in more detail why my approach shouldn't work?

Because you can't seek through it, as you've found out. The video track only has one frame, we already have id3 tags for this use case.

SunSerega commented 1 year ago

add -shortest

G:\0Music\3Sort\Hinkik>ffmpeg -loop 1 -framerate 1 -i "[20210118] Time Leaper.png" -i "[20210118] Time Leaper.mp4" -c:v libx264 -tune stillimage -c:a copy -shortest 0.mkv
ffmpeg version 2023-07-19-git-efa6cec759-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      58. 14.100 / 58. 14.100
  libavcodec     60. 22.100 / 60. 22.100
  libavformat    60. 10.100 / 60. 10.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
Input #0, png_pipe, from '[20210118] Time Leaper.png':
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: png, rgb24(pc, gbr/bt709/unknown), 1500x849 [SAR 2835:2835 DAR 500:283], 1 fps, 1 tbr, 1 tbn
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '[20210118] Time Leaper.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf59.10.100
  Duration: 00:04:00.61, start: 0.000000, bitrate: 507 kb/s
  Stream #1:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1080x1080 [SAR 1:1 DAR 1:1], 373 kb/s, 25 fps, 25 tbr, 12800 tbn (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
  Stream #1:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> h264 (libx264))
  Stream #1:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libx264 @ 000001d2a6e01440] using SAR=1/1
[libx264 @ 000001d2a6e01440] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 000001d2a6e01440] profile High 4:4:4 Predictive, level 3.2, 4:4:4, 8-bit
[libx264 @ 000001d2a6e01440] 264 - core 164 r3107 a8b68eb - H.264/MPEG-4 AVC codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:-3:-3 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=2.00:0.70 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=18 lookahead_threads=3 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=1 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.20
Output #0, matroska, to '0.mkv':
  Metadata:
    encoder         : Lavf60.10.100
  Stream #0:0: Video: h264 (H264 / 0x34363248), yuv444p(tv, unknown/bt709/unknown, progressive), 1500x849 [SAR 1:1 DAR 500:283], q=2-31, 1 fps, 1k tbn
    Metadata:
      encoder         : Lavc60.22.100 libx264
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(und): Audio: aac (LC) ([255][0][0][0] / 0x00FF), 44100 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      handler_name    : ISO Media file produced by Google Inc.
      vendor_id       : [0][0][0][0]
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestampd=N/A
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestamp=  68.7kbits/s speed=  93x
    Last message repeated 36 times
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestamp= 169.4kbits/s speed=85.3x
    Last message repeated 40 times
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestamp= 164.7kbits/s speed=84.2x
    Last message repeated 38 times
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestamp= 164.7kbits/s speed=82.4x
    Last message repeated 42 times
[matroska @ 000001d2a6ebeb00] Starting new cluster due to timestamp= 160.6kbits/s speed=83.3x
    Last message repeated 19 times
[out#0/matroska @ 000001d2a6ebea00] video:1642kB audio:3760kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.472996%
frame=  237 fps= 59 q=-1.0 Lsize=    5482kB time=00:04:58.00 bitrate= 150.7kbits/s speed=74.5x
[libx264 @ 000001d2a6e01440] frame I:2     Avg QP: 4.06  size:724036
[libx264 @ 000001d2a6e01440] frame P:76    Avg QP: 4.97  size: 14864
[libx264 @ 000001d2a6e01440] frame B:223   Avg QP:11.79  size:   444
[libx264 @ 000001d2a6e01440] consecutive B-frames:  1.0%  0.7%  0.0% 98.3%
[libx264 @ 000001d2a6e01440] mb I  I16..4: 16.8% 15.0% 68.2%
[libx264 @ 000001d2a6e01440] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4: 30.0%  0.1%  0.9%  0.0%  0.0%    skip:69.1%
[libx264 @ 000001d2a6e01440] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 10.1%  0.0%  0.0%  direct: 0.0%  skip:89.9%  L0:68.0% L1:32.0% BI: 0.0%
[libx264 @ 000001d2a6e01440] 8x8 transform intra:15.0% inter:49.8%
[libx264 @ 000001d2a6e01440] coded y,u,v intra: 98.6% 89.2% 69.0% inter: 3.9% 1.1% 0.9%
[libx264 @ 000001d2a6e01440] i16 v,h,dc,p:  7%  6% 62% 24%
[libx264 @ 000001d2a6e01440] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 15% 28%  6%  7%  7%  8%  7% 10%
[libx264 @ 000001d2a6e01440] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 12% 19%  9% 10%  9% 10%  8% 10%
[libx264 @ 000001d2a6e01440] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 000001d2a6e01440] ref P L0: 72.4%  0.0% 27.3%  0.2%
[libx264 @ 000001d2a6e01440] ref B L0: 55.1% 44.7%  0.2%
[libx264 @ 000001d2a6e01440] ref B L1: 99.0%  1.0%
[libx264 @ 000001d2a6e01440] kb/s:71.14

0.zip

Now the audio is broken after seeking. The first 41 seconds just don't play. But only after seeking, it still works fine if I just play it without any changes. Also, it's twice as big as a single key frame one... But oh well.

seek just fine with --no-video

True, but then I have no video. I would just make an audio-only file if that's what I wanted.

mpv will use the video presentation time if available

Well, I would still prefer it to use the longest stream, cause that's how it plays when I don't do seeking... But is there a way to at least at least force it to use audio time? Can't fine anything like that here. I can probably hack together a middleman program to check this with ffprobe and pass the right stream id to mpv. Thought I'm sure if mpv were to do it natively - it would be much faster.


Also, none of this explains why in the original sample MKV seeking jumps to 10 seconds before the end, instead of the beginning of the video, as it does for @christoph-heinrich. Is that a separate issue? Should I separate it?