obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Can not change the progress by clicking the slider when playing some mp3 files with album cover image

Open ccc-rrr opened this issue 1 year ago • 2 comments

Operating System Info

Windows 11

Other OS

No response

OBS Studio Version

30.2.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/hZ5KkfgyKOWNtOub

OBS Studio Crash Log URL

No response

Expected Behavior

can change change the progress by clicking the slider

Current Behavior

Can not change the progress by clicking the slider when playing some mp3 files with album art cover image.

Other player like media player(11.2406.13.0) or VLC, can play it and change the progress.

Steps to Reproduce

  1. add the test1.mp3 as a source.
  2. play it
  3. click the slider while playing ...

Anything else we should know?

This is the screenshot. test1_mp3_2024-08-27_19-01-19

This is the test1 mp3 zip file. test1.zip

ccc-rrr avatar Aug 27 '24 11:08 ccc-rrr

Hi @ccc-rrr I'm also not able to set the slider position, but for me it goes to restart state as if the play has been completed can you please confirm this behavior once. Also can you try with non image audios and confirm whether this issue happens. If yes, please provide a sample audio file

Sugam-Chand-M avatar Sep 02 '24 18:09 Sugam-Chand-M

Hi @ccc-rrr I'm also not able to set the slider position, but for me it goes to restart state as if the play has been completed can you please confirm this behavior once. Also can you try with non image audios and confirm whether this issue happens. If yes, please provide a sample audio file

Hi @Sugam-Chand-M , I test test1.mp3 again.

  1. Sound missed if I clicked the slider.
  2. Can not display the cover (black square) when rerun OBS and the mp3 is the first source (auto save scene).

When the play is completed, it goes to restart state unless set it to "loop" mode. I think it's OK. It behave same when plays mp3 files with / without cover image.

I test other mp3 files without cover image and the slider works well.

ccc-rrr avatar Sep 03 '24 01:09 ccc-rrr

@Sugam-Chand-M After a day debuging, I found a workaround. During the init of those source of mp3 files with cover (init_avformat in media.c), after avformat_find_stream_info, there are 2 streams(nb_streams=2). One is the audio , the other is the cover that was probed as a video stream (codec_type=AVMEDIA_TYPE_VIDEO and codec_id=AV_CODEC_ID_MJPEG in codecpar). After clicking the slicker, the m->eof=true and cause the pos was set to the start position.

As the slicder is more import than the cover, my workaround just ignore the cover and can make the slider work correctly: In media.c in media-playback:

bool pure_audio = false;
if (m->fmt->iformat && m->fmt->iformat->name) {
	if (strcmp(m->fmt->iformat->name, "aac") == 0 ||
	    strcmp(m->fmt->iformat->name, "mp3") == 0 ||
	    strcmp(m->fmt->iformat->name, "ogg") == 0 ||
	    strcmp(m->fmt->iformat->name, "wav") == 0) {
		pure_audio = true;
	}
}
if (pure_audio) {
	m->has_video = false;
} else {
	m->has_video = mp_decode_init(m, AVMEDIA_TYPE_VIDEO, m->hw);
}

Currently I have not found a solution can make the cover and the slicder work correctly together.

ccc-rrr avatar Dec 31 '24 00:12 ccc-rrr

I am also experiencing this and @ccc-rrr 's explanation is likely also the cause of #11739 - wanted to flag that this is a more widespread issue with a Media Source's handling of MP3 files containing embedded artwork files.

olliesouthie avatar Jan 28 '25 05:01 olliesouthie