You are not logged in.

#1 2023-08-03 22:17:57

grobber
Member
Registered: 2018-02-09
Posts: 29

[SOLVED] mpv has trouble opening mp4s after recent update

I have an up to date mpv installation at the time of this writing, with

mpv --version

producing

mpv 0.36.0 Copyright © 2000-2023 mpv/MPlayer/mplayer2 projects
 built on Sun Jul 23 05:49:29 2023
libplacebo version: v5.264.1
FFmpeg version: n6.0
FFmpeg library versions:
   libavutil       58.2.100
   libavcodec      60.3.100
   libavformat     60.3.100
   libswscale      7.1.100
   libavfilter     9.3.100
   libswresample   4.10.100

I usually download public-domain mp3 files from Librivox and, in order to have a window open when playing with mpv, I add a background image with

ffmpeg -i <image> -i <file.mp3> -c:v libx264 -tune stillimage -c:a copy <file.mp4>

mpv used to play these just fine (though it would lag when searching for longer files), but now even attempting to open one (e.g. this one) will hang for minutes before eventually opening.

I'll take any suggestions:

- other means of converting mp3s to mp4s, better-suited for mpv in whatever ways I don't quite understand;

- somehow playing the mp3s directly without conversion to mp4, so long as I see a window (so that I have a timer on my screen, can see the playlist upon pressing a key, etc.);

- anything else that comes to mind.

In other words, I'm not wedded to my current "solution" (which no longer works anyway..).

Last edited by grobber (2023-08-05 20:15:48)

Offline

#2 2023-08-03 22:34:54

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [SOLVED] mpv has trouble opening mp4s after recent update

grobber wrote:

- somehow playing the mp3s directly without conversion to mp4, so long as I see a window (so that I have a timer on my screen, can see the playlist upon pressing a key, etc.);

Try the force-window option?

Offline

#3 2023-08-03 22:43:29

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Raynman wrote:

Try the force-window option?

Thanks! I've just learned of that; this is both funny and sad, because I'd have to re-process my entire collection, but if it works, it works.

It'd also be good to know what was wrong with the mp4s processed as described, if only out of curiosity.

Offline

#4 2023-08-04 01:43:58

dakota
Member
Registered: 2016-05-20
Posts: 282

Re: [SOLVED] mpv has trouble opening mp4s after recent update

What sort of error message do you get when you try to play .mp3 with mpv? (Or the converted .mp3 => .mp4 file)

FWIW, I can play .mp3 files with mpv without any trouble. I can also play the converted .mp4 file that you linked to without any trouble...

$ mpv 19480809_059\ -\ The\ Thing\ on\ the\ Fourble\ Board.mp3 
[ffmpeg/demuxer] mp3: Estimating duration from bitrate, this may be inaccurate
 (+) Audio --aid=1 (mp3 1ch 44100Hz)
File tags:
 Artist: Cooper, Wyllis
 Album: Quiet, Please
 Comment: www.otrplotspot.com
 Genre: Audio Drama
 Title: Thing on the Fourble Board, The
 Track: 059
AO: [alsa] 48000Hz mono 1ch float
(Paused) A: 00:00:30 / 00:23:25 (2%)
$ mpv williamanenglishman_01_00\ 30\ 33.mp4 
 (+) Video --vid=1 (*) (h264 474x474 25.000fps)
 (+) Audio --aid=1 (*) (mp3 1ch 22050Hz)
libEGL warning: failed to get driver name for fd -1

libEGL warning: MESA-LOADER: failed to retrieve device information

libEGL warning: failed to get driver name for fd -1

AO: [alsa] 48000Hz mono 1ch float
VO: [gpu] 474x474 yuv420p
(Paused) AV: 00:00:13 / 00:30:33 (1%)

Cheers,

Edit - fixed spelling errors

Last edited by dakota (2023-08-05 01:03:30)


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#5 2023-08-04 02:48:48

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

dakota wrote:

What sort of error message do you get when you try to play .mp3 with mpv? (Or the converted .mp3 => .mp4 file)

No error at all: it actually plays the file *eventually* (I hadn't realized this when initially posting), but for a single file it takes maybe a minute or so to open, and if I add a directory full of these converted ones (same procedure, same background picture added to the mp3 to create the mp4) it hangs for quite some time, several minutes, before eventually starting playback. If I just ask mpv to play the file I linked I get this:

(+) Video --vid=1 (*) (h264 474x474 25.000fps)
(+) Audio --aid=1 (*) (mp3 1ch 22050Hz)
AO: [pulse] 22050Hz mono 1ch float

followed by a long wait and eventually playback. Also: vlc will open the mp4 I linked straight away, but *without* the background image. vlc will give this in the console I start it in:

[00007fa3b4c0c200] main decoder error: buffer deadlock prevented

I don't know if the issue is related though; vlc is rather chatty by default..

Offline

#6 2023-08-04 06:30:07

seth
Member
Registered: 2012-09-03
Posts: 51,881

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Just put a nice image into the relative path of the mp3 and name it "cover.jpg"

ffmpeg -loglevel error -i "<cover.jpg>" -i "<tune.mp3>" -map_metadata 1 -map 0 -map 1 -acodec copy mp3withcoverart.mp3

"Warning": doesn't replace but adds cover art.

As for your immediate problem

libEGL warning: failed to get driver name for fd -1

libEGL warning: MESA-LOADER: failed to retrieve device information

libEGL warning: failed to get driver name for fd -1
eglinfo | head -256
glxinfo -B
loginctl session-status # mostly whether this is wayland or X11

Last edited by seth (2023-08-04 06:31:24)

Online

#7 2023-08-04 06:38:56

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 68

Re: [SOLVED] mpv has trouble opening mp4s after recent update

I have problems with mpv since the glibc 2.38 update. Maybe it is related.
In my case it starts working normally, but after a couple of minutes the demuxer thread (can see the thread with htop) has high cpu usage and the cache takes forever to fill enough to watch.
I rolled back to 2023/08/02 (before glibc 2.38) using Arch Linux Archive and this problem disappeared.

Offline

#8 2023-08-04 12:52:31

kevku
Member
From: Estonia
Registered: 2009-11-21
Posts: 73

Re: [SOLVED] mpv has trouble opening mp4s after recent update

here when watching a stream after 2 minutes endless start-stop stuttering

Offline

#9 2023-08-04 20:01:41

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

OK, so for my original goal of having these files play with a window, we have two working options now (for which, thank you!):

Raynman wrote:

Try the force-window option?

This works fine.

seth wrote:

Just put a nice image into the relative path of the mp3 and name it "cover.jpg"

ffmpeg -loglevel error -i "<cover.jpg>" -i "<tune.mp3>" -map_metadata 1 -map 0 -map 1 -acodec copy mp3withcoverart.mp3

"Warning": doesn't replace but adds cover art.

As does this: I have checked just now that if I use *this* method of processing the mp3s (instead of converting to mp4), then I get a playable mp3 with art, no issues.

I gather we still do not know what the issue was with the original mp4, or to what extent it's at my end only? Others are reporting issues with mpv more generally, and this does not seem to apply to me (the OP):

seth wrote:
eglinfo | head -256
glxinfo -B
loginctl session-status # mostly whether this is wayland or X11

I was not the one reporting the libEGL warnings. As for X11/Wayland: I use i3 which I initiate with `startx`, so no display manager. Per this discussion, the suggested `loginctl` command will fail to resolve between X11 and Wayland then, because

loginctl show-session <session> -p Type

simply shows 'Type=tty'. I am sure I am on X11, because I have $DISPLAY set, but not $WAYLAND_DISPLAY (the same Unix Stackexchange discussion suggests this as the means to test).

Offline

#10 2023-08-04 20:54:43

seth
Member
Registered: 2012-09-03
Posts: 51,881

Re: [SOLVED] mpv has trouble opening mp4s after recent update

I was not the one reporting the libEGL warnings.

Ah, sorry.
Does mpv print anything for the bogus files (notably while not playing them)?

Online

#11 2023-08-04 20:59:09

seth
Member
Registered: 2012-09-03
Posts: 51,881

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Online

#12 2023-08-05 01:02:56

dakota
Member
Registered: 2016-05-20
Posts: 282

Re: [SOLVED] mpv has trouble opening mp4s after recent update

seth wrote:

Sorry for the noise. I was merely showing the output for an mpv installation that plays both .mp3 and .mp4 files without any problems.


"Before Enlightenment chop wood, carry water. After Enlightenment chop wood, carry water." -- Zen proverb

Offline

#13 2023-08-05 02:09:47

Toolybird
Member
Registered: 2017-09-30
Posts: 72

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Offline

#14 2023-08-05 10:41:10

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

seth wrote:

I was not the one reporting the libEGL warnings.

Ah, sorry.
Does mpv print anything for the bogus files (notably while not playing them)?

Sadly, no: during the non-playback stage it is 100% quiet. The full chain of events is:

- I run the command (`mpv <whatever mp4, created as described in my initial post from an mp3 by adding an image>`);

- I immediately get

(+) Video --vid=1 (*) (h264 474x474 25.000fps)
(+) Audio --aid=1 (*) (mp3 2ch 22050Hz)
AO: [pulse] 22050Hz mono 1ch float
VO: [gpu] 474x474 yuv420p

in the console (as expected), and a hang for a while (the UNexpected part);

- eventually the video starts playing, minutes later (a 13-minute video opened after 2 minutes or so), with no further messages, as if nothing had happened (and it plays the video portion too, i.e. that image I added).

So all I can see is the lag. There are no errors or warnings or complaints of any kind whatsoever.

Offline

#15 2023-08-05 12:54:52

seth
Member
Registered: 2012-09-03
Posts: 51,881

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Do you also have high CPU usage during the stall?

Online

#16 2023-08-05 14:36:47

eduardo.eae
Member
From: Reconquista - Argentina
Registered: 2010-01-24
Posts: 68

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Post your mpv.conf. Maybe some cache option makes this problem worse.

Last edited by eduardo.eae (2023-08-05 14:37:27)

Offline

#17 2023-08-05 19:15:52

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

seth wrote:

Do you also have high CPU usage during the stall?

Yes; during the "quiet", non-playback phase I get a CPU spike. Also: it makes a difference how long the video is. A 5-minute video starts playing after only about 10 seconds or so (so big difference; I had like a 2-minute lag for a 13-minute video).

eduardo.eae wrote:

Post your mpv.conf. Maybe some cache option makes this problem worse.

Don't have one (an mpv.conf file), as far as I can tell. I know for a fact I have never created one myself, and am sure none of the locations mentioned in the manual are valid for me (i.e. I don't have files in any of those spots). Specifically, I

- don't have a /usr/local/etc/mpv/ or a ~/.mpv/ at all;

- have searched ~/.{cache,config,local} for mpv.conf and come up empty.

Offline

#18 2023-08-05 19:24:34

seth
Member
Registered: 2012-09-03
Posts: 51,881

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Quite possibly the glibc posix_memalign regression then as well.
(Though turning mp3 to mp4 to get a video window for a podcast isn't the most elegant approach either wink

Online

#19 2023-08-05 19:45:57

lopster
Member
Registered: 2021-10-11
Posts: 8

Re: [SOLVED] mpv has trouble opening mp4s after recent update

Use this at your own risk.

Here's an easy binary patch that seems to work around the posix_memalign regression issue for the arch glibc 2.38-2 build when using mpv:

Copy /usr/lib/libc.so.6 somewhere. Load it in a hex editor.

The bytes at offset 9ca05 should be hex 74 79.

Change them to EB 79.

Prior to running mpv, execute this command:

export LD_LIBRARY_PATH=/directory_with_modified_libc:$LD_LIBRARY_PATH

This makes glibc take a code path like 2.37 did.

Offline

#20 2023-08-05 20:15:17

grobber
Member
Registered: 2018-02-09
Posts: 29

Re: [SOLVED] mpv has trouble opening mp4s after recent update

seth wrote:

Quite possibly the glibc posix_memalign regression then as well.

It's beginning to look like it.

seth wrote:

(Though turning mp3 to mp4 to get a video window for a podcast isn't the most elegant approach either wink

If 'inelegant' is the worst you'll say about that, I have to commend you on your restraint big_smile. Yes, that was the functional equivalent to taking a club to the whole thing. I am now fully set: clearly, the thing to do is to just leave the mp3s alone and play them with --force-window; there's absolutely no disadvantage to it, and my only (non-)excuse is that I didn't know of the option. It's easy to undo my mp4 mess too: I can just run

ffmpeg -i <file.mp4> <file.mp3>

to remove the now-unwanted video component. This is obviously eminently scriptable; it just takes a while to run.

What with the hints at the glibc regression and the suggested patch as well, I think this is as close as we can profitably get to squeezing this thread, so I'll mark it as solved. Thank you (all) for the help!

Offline

#21 2023-08-06 16:34:45

lopster
Member
Registered: 2021-10-11
Posts: 8

Re: [SOLVED] mpv has trouble opening mp4s after recent update

The workaround below was posted in the mpv report by narpfel. It's probably better than a binary patch to libc.so. Installation of the arch package jemalloc is required.

https://github.com/mpv-player/mpv/issue … 1666892864

Another workaround: Using a different allocator, e. g. jemalloc, via LD_PRELOAD, as described here: https://github.com/jemalloc/jemalloc/wi … ng-Started

$ LD_PRELOAD=`jemalloc-config --libdir`/libjemalloc.so.`jemalloc-config --revision` mpv ...

Offline

Board footer

Powered by FluxBB