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.25k stars 794 forks source link

[Bug Report] Some videos stutter during playback #5079

Open oryxcallotis opened 3 months ago

oryxcallotis commented 3 months ago

Describe the bug Some videos I have will stutter during playback. It's always the same few videos. If I opt to play then via DASH or HLS transcoding then they play properly, albeit with my CPU running near 100% to keep up. If played using DirectStream or MP4 (which I think is the same for these videos anyway), the stutter occurs.

This video is exactly the same sort of stutter I'm talking about; https://www.youtube.com/watch?v=NL9quFOU7yg

To Reproduce Steps to reproduce the behavior:

  1. Go to Scenes
  2. Click on a video
  3. Play, stuttering immediately.

Expected behavior The video should play normally and smoothly.

Stash Version: (from Settings -> About): v0.26.2

Desktop (please complete the following information):

Additional context There's nothing obvious with the video/audio codecs, or file types. The stuttering videos are using h264 for the video codec and aac for the audio, but so are every other video that plays without issue. They play perfectly fine when using MPC-HC player, and play better when using the Librewolf browser - Although it does look like these videos skip frames instead of stuttering with that browser.

feederbox826 commented 2 months ago

Direct Stream is without transcoding, MP4 is with transcoding. It doesnt seem like transcoding, but two possibilites that might stand out are if the file is mkv, transcoding will be forced. The alternative is that hardware acceleration is disabled in your browser or there is no h264 hardware acceleration

scarfa commented 2 months ago

I have this exact same problem. The video codec is the typical H264 with AAC audio in an MP4 container, and it can stutter even though the video plays fine in any other video player. It's not happening with every video, just the occasional video and always the same ones.

feederbox826 commented 2 months ago

can you provide more details about the file? a mediainfo or ffprobe output would be best.

If you're online, pop in the discord and I can help guide you through it

scarfa commented 2 months ago

can you provide more details about the file? a mediainfo or ffprobe output would be best.

If you're online, pop in the discord and I can help guide you through it

What's the discord, who should I DM?

scarfa commented 2 months ago

Here are the MediaInfo of 3 videos that stutter:

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 5.24 GiB
Duration                                 : 2 h 4 min
Overall bit rate                         : 6 011 kb/s
Frame rate                               : 29.970 FPS
Writing application                      : Lavf59.16.100
IsTruncated                              : Yes

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2 h 4 min
Source duration                          : 2 h 4 min
Bit rate                                 : 5 744 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.092
Stream size                              : 5.00 GiB (96%)
Source stream size                       : 5.00 GiB (96%)
Writing library                          : x264 core 164 r3081 19856cc
Encoding settings                        : cabac=1 / ref=3 / deblock=1:1:0 / analyse=0x1:0x131 / me=hex / subme=7 / psy=1 / psy_rd=0.50:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=infinite / keyint_min=60 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=5744 / ratetol=1.0 / qcomp=0.50 / qpmin=10 / qpmax=69 / qpstep=4 / vbv_maxrate=8041 / vbv_bufsize=8041 / nal_hrd=none / filler=0 / ip_ratio=1.41 / aq=2:1.00
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 h 4 min
Bit rate mode                            : Constant
Bit rate                                 : 256 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 228 MiB (4%)
Default                                  : Yes
Alternate group                          : 1`

--------------------------------------------------------------------------------------------------------------------------

Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 6.72 GiB
Duration                                 : 2 h 39 min
Overall bit rate                         : 6 023 kb/s
Frame rate                               : 29.970 FPS
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Main@L4
Format settings                          : CABAC / 3 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 3 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 2 h 39 min
Source duration                          : 2 h 39 min
Bit rate                                 : 5 757 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 29.970 (29970/1000) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.093
Stream size                              : 6.42 GiB (96%)
Source stream size                       : 6.42 GiB (96%)
Writing library                          : x264 core 164 r3081 19856cc
Encoding settings                        : cabac=1 / ref=3 / deblock=1:1:0 / analyse=0x1:0x131 / me=hex / subme=7 / psy=1 / psy_rd=0.50:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=0 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-2 / threads=8 / lookahead_threads=1 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=infinite / keyint_min=60 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=abr / mbtree=1 / bitrate=5744 / ratetol=1.0 / qcomp=0.50 / qpmin=10 / qpmax=69 / qpstep=4 / vbv_maxrate=8041 / vbv_bufsize=8041 / nal_hrd=none / filler=0 / ip_ratio=1.41 / aq=2:1.00
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 2 h 39 min
Bit rate mode                            : Constant
Bit rate                                 : 256 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 292 MiB (4%)
Default                                  : Yes
Alternate group                          : 1

-------------------------------------------------------------------------------------------------------------------------
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 1.06 GiB
Duration                                 : 1 h 53 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 339 kb/s
Frame rate                               : 24.000 FPS

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 1 h 53 min
Source duration                          : 1 h 53 min
Bit rate                                 : 1 200 kb/s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Variable
Frame rate                               : 24.000 FPS
Minimum frame rate                       : 4.800 FPS
Maximum frame rate                       : 96.051 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.054
Stream size                              : 974 MiB (90%)
Source stream size                       : 974 MiB (90%)
Writing library                          : x264 core 157
Encoding settings                        : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=15 / lookahead_threads=2 / 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=1 / keyint=250 / keyint_min=24 / scenecut=40 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=1200 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00
mdhd_Duration                            : 6802417
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 1 h 53 min
Bit rate mode                            : Variable
Bit rate                                 : 128 kb/s
Maximum bit rate                         : 210 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 104 MiB (10%)
feederbox826 commented 2 months ago

Is it triggering transcoding (direct stream is not selected) or is it stuttering even on direct stream?

DogmaDragon commented 2 months ago

can you provide more details about the file? a mediainfo or ffprobe output would be best. If you're online, pop in the discord and I can help guide you through it

What's the discord, who should I DM?

https://github.com/stashapp/stash#support-faq

scarfa commented 2 months ago

Is it triggering transcoding (direct stream is not selected) or is it stuttering even on direct stream?

The default playback is direct stream, although I changed it to mp4 (transcoding) and it still stutters. I just tested it on 4 browsers and Chrome, Brave, Edge stutters while Firefox doesn't. So we can maybe narrow it down to Chromium browsers?

feederbox826 commented 2 months ago

That sounds like a chromium engine issue then, I'll have to probably leave it off as just being an upstream bug with some combination of file formats

jthrow0451 commented 2 months ago

I have seen issues with certain VFR videos on Chrome and Safari (iOS) but not Firefox, if I understand correctly even if mediainfo detects a constant frame rate it is not guaranteed to be constant, you can check avg_frame_rate with ffprobe or ideally use the vfrdet filter with ffmpeg to test further some problem videos https://superuser.com/a/1487417

Either way it is probably unrelated to the stash project but useful info.