hoyon / mpv-mpris

MPRIS plugin for mpv
MIT License
608 stars 35 forks source link

ffmpeg/demuxer warning after embedded cover art support #98

Closed llyyr closed 1 year ago

llyyr commented 1 year ago

You see this warning for various other codecs as well, not just PGS subtitles.

[ffmpeg/demuxer] matroska,webm: Could not find codec parameters for stream 4 (Subtitle: hdmv_pgs_subtitle (pgssub)): unspecified size
[ffmpeg/demuxer] Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options

This is due to 2f9c126c8332c6d2f9af2fdb453e0aec8f7585d5

hoyon commented 1 year ago

@llyyr do you have a sample file you can share which has this issue?

llyyr commented 1 year ago

https://github.com/hoyon/mpv-mpris/assets/6298234/b0b77a4c-e47e-4876-bb6a-37eb84f9e73f

This file is mp4 due to github limitation, but it's actually a mkv. Please rename it although it's unnecessary most likely since ffmpeg should still probe it as a mkv.

The first two subtitle tracks are pgs, this issue can be reproduced with mpv --no-config --scripts=mpris.so out.mp4

hoyon commented 1 year ago

The issue seems to be caused by this line https://github.com/hoyon/mpv-mpris/blob/master/mpris.c#L289.

The same warning is appears if you just load your file using ffmpeg like ffmpeg -i ~/Downloads/video.mkv

I removed the line in question which removes the warning and the album art feature seems to still work anyway with the files I've tested.

@gnojus do you know why the call to avformat_find_stream_info is needed or is fine to get rid of it to fix this warning?

gnojus commented 1 year ago

The docs are a bit unclear to me:

     /**
     * Average framerate
     *
     * - demuxing: May be set by libavformat when creating the stream or in
     *             avformat_find_stream_info().
     * - muxing: May be set by the caller before avformat_write_header().
     */
    AVRational avg_frame_rate;

    /**
     * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet
     * will contain the attached picture.
     *
     * decoding: set by libavformat, must not be modified by the caller.
     * encoding: unused
     */
    AVPacket attached_pic;

Sounds like attached_pic is not set by avformat_find_stream_info, so it's probably safe to remove the call. And yes, it does seem to work without it.