stashapp / stash

An organizer for your porn, written in Go. Documentation: https://docs.stashapp.cc
https://stashapp.cc/
GNU Affero General Public License v3.0
9.2k stars 792 forks source link

[Bug Report] Panic when playing MP3 file as a scene #4109

Closed yarsiemanym closed 8 months ago

yarsiemanym commented 1 year ago

Describe the bug Whenever I attempt to play an MP3 or an MP3 that has been converted to an MP4, the app panics and the container crashes.

To Reproduce

  1. Add MP3 to the list of known Video Extensions (Settings -> Library -> Media content extensions -> Video Extensions)
  2. Copy an MP3 file into the library directory.
  3. Scan to detect the new file.
  4. Select the new file in Scenes.
  5. Play the scene.
  6. The container crashes with the following error.
panic: runtime error: integer divide by zero

goroutine 73 [running]:
github.com/stashapp/stash/pkg/ffmpeg.VideoFilter.ScaleMaxLM({0x0?, 0x7f28912e08ef?}, 0x7?, 0xc0004ce380?, 0x6?, 0x30?, 0x7f28912e08ef?)
    github.com/stashapp/stash/pkg/ffmpeg/filter.go:65 +0xb9
github.com/stashapp/stash/pkg/ffmpeg.(*FFMpeg).hwMaxResFilter(0x7f2891c75400?, {0x7f28912e08ef, 0x7}, 0x0, 0x0, 0xc000204cf8?)
    github.com/stashapp/stash/pkg/ffmpeg/codec_hardware.go:167 +0xca
github.com/stashapp/stash/pkg/ffmpeg.(*runningStream).makeStreamArgs(0xc00021c780, 0xc0002e8700, 0x0)
    github.com/stashapp/stash/pkg/ffmpeg/stream_segmented.go:343 +0x994
github.com/stashapp/stash/pkg/ffmpeg.(*StreamManager).startTranscode(0xc0002e8700, 0xc00021c780, 0x0, 0xc000300de0)
    github.com/stashapp/stash/pkg/ffmpeg/stream_segmented.go:660 +0x269
github.com/stashapp/stash/pkg/ffmpeg.(*StreamManager).ensureTranscode(0xc000300e40?, 0xc0001dd794?, 0x2?)
    github.com/stashapp/stash/pkg/ffmpeg/stream_segmented.go:797 +0x76
github.com/stashapp/stash/pkg/ffmpeg.(*StreamManager).monitorStreams(0xc0002e8700)
    github.com/stashapp/stash/pkg/ffmpeg/stream_segmented.go:827 +0x2a9
github.com/stashapp/stash/pkg/ffmpeg.NewStreamManager.func1()
    github.com/stashapp/stash/pkg/ffmpeg/stream.go:67 +0x3f
created by github.com/stashapp/stash/pkg/ffmpeg.NewStreamManager
    github.com/stashapp/stash/pkg/ffmpeg/stream.go:63 +0x26d

Expected behavior Play the audio from the MP3 file without any video.

Screenshots N/A

Stash Version:

Desktop:

Additional context Why MP3s? Because /r/gonewildaudio is a thing. I'd like to be able to treat them as audio-only scenes.

I also tried converting the MP3 file to an MP4 and got the same error. I have a hunch the divide by 0 might be because the video has a resolution of 0. Are MP3s supported? If not, is there a workaround I can try?

WithoutPants commented 8 months ago

Treating mp3 as video files is not a supported use case, and these sorts of errors would be expected.

There is no workaround that I'm aware of, short of re-encoding the mp3 files into mp4 files with a blank video using ffmpeg. See also existing feature request #1258.