Plex stuck on creating thumbnails (FFmpeg issue)

I’ve searched and found many examples of people having the same issue and it finally happend to me as well. I checked the problematic file and it turns out that FFmpeg can’t handle the file correctly:

[h264 @ 00000171edc519c0] mmco: unref short failure
[h264 @ 00000171edc52740] illegal short term buffer state detected

Since the video plays fine otherwise, I’ve decided to just circumvent the problem because otherwise, Plex tries (and fails) to generate the thumbnails every single day. Turns out the issue only arises when telling FFmpeg to drop intra frames (skip_frame: nokey/nointra), so I’ve forced it to default and let Plex (successfully) create the thumbnails.

Would it be possible for Plex to check for those error messages and reset it to default automatically? If not, hopefully people will find this thread and be able to fix it themselves.

Linux tutorial:

  1. sudo mv /usr/lib/plexmediaserver/Plex\ Transcoder /usr/lib/plexmediaserver/Plex\ Transcoder.orig
  2. sudo nano /usr/lib/plexmediaserver/Plex\ Transcoder
#!/bin/bash
exec /usr/lib/plexmediaserver/Plex\ Transcoder.orig "${@/nokey/default}"
  1. chmod +x /usr/lib/plexmediaserver/Plex\ Transcoder

Changing how PMS works, specifically the transcoder, to cope with that file isn’t the answer.

The file is (per spec) invalid. mmco is not correct.
It is printing out those errors legitimately.

You should replace the file.

[h264 @ 00000171edc519c0] mmco: unref short failure
[h264 @ 00000171edc52740] illegal short term buffer state detected
1 Like

There’s a hidden preference you can use instead of binary-hacking Plex to avoid a broken file.

1 Like

Well yeah, obviously something is wrong, but not ignoring/bypassing those errors is just being pedantic. The video plays/seeks fine otherwise and reripping unfortunately is not an opion. If Plex doesn’t want to implement a workaround, which it really should because it works when using the default paramters, it should atleast flag the file as noncompliant so it doesn’t waste my resources every morning.

There’s a hidden preference you can use instead of binary-hacking Plex to avoid a broken file.

Thanks for watching out brother. I’ve already fixed the issue for me and re-replaced the transcoder, but I’ll keep this in mind for the next time. By the way, how did you find that?

You can make an HTTP request for a list of all of the settings to Plex. (Hi, @dane22.)

At the time I was digging around to figure out why some files were failing - see the thread I linked previously. And I knew that -skip_frame nokey was a huge performance increase. So I was snooping in the binaries too.

And I was trying to figure out why the Video Preview Thumbnails were SO big.

1 Like

May I have the DEBUG logs ZIP where these errors were found ?

I’d like to see what information PMS / the transcoder found for them.

Also, please show me the XML for the file which generated this error. (hover over the item → Get Info → View XML → from top down through the </media> XML tag.

With this information, we can properly diagnose and discuss before going too far off base on assumptions.

It’s a working part of WebTools-NG now :wink:

Edit: And glad to see at least someone can use my work :smiley:

Actually, Raelworld already identified the issue - it has something to do with having open GOPs. So I’m pretty sure the video is correct, it’s just that FFmpeg can’t handle it (for H.264 at least, read that thread for more info).

Here’s a little clip if you want to see for yourself: bad.zip (5.5 MB)

ffmpeg -skip_frame nokey -i bad.mkv img-%02d.jpg

Are you sure your file has open GOPs? FFmpeg can handle them fine in most cases, without throwing the errors you’re getting. AFAIK it’s just -skip_frame nokey that fails in that case.

Obviously yours is also failing, but it would be interesting to see if yours has open GOP too - or if it’s for another reason.

Does your original have the encoding settings embedded? Can you share the stuff Chuck asked for, a bigger sample of the file, and/or the output from mediainfo?

AFAIK it’s just -skip_frame nokey that fails in that case.

Well, yeah, that’s exactly what’s happening here.

Does your original have the encoding settings embedded? Can you share the stuff Chuck asked for, a bigger sample of the file, and/or the output from mediainfo ?

I didn’t really wanna invest too much time in debugging this because I know Plex doesn’t really care about these kinds of issues (don’t get me wrong, it’s still a great product). So anyway, turns out that it’s a mixture between having open GOPs (open_gop=1) and setting the GOP length too low (keyint<=25).
Same thing happend in the other post (open_gop=1:keyint=24).

Bump, this is obviously a bug and should either be fixed or worked around.

Yes, this should be fixed!
Using -skip_frame bidir instead of -skip_frame nokey would also be sufficient and it is even faster than -skip_frame default. :wink:

I don’t think bidir is better than nokey for this issue. It’s been a while but I’m 95% sure I tested that too.

Are you having this issue? Does your media match the discussion above? Share a sample if you like.

I have noticed this happening more often in the last month or two as well. Pretty convinced I have wonked files, but it didn’t happen before.

yeah, i have the same error message on my file.

[h264 @ 000002071c3f9a40] illegal short term buffer state detectedup=45 drop=0 speed= 117x
[h264 @ 000002071c375340] mmco: unref short failure bitrate=N/A dup=45 drop=0 speed=1.22x
[h264 @ 000002071c375340] illegal short term buffer state detected
[h264 @ 000002071c374980] illegal short term buffer state detectedup=45 drop=0 speed=0.927x
[h264 @ 000002071c375340] illegal short term buffer state detectedup=45 drop=0 speed=0.62x

with bidir everything works. I don´t know if it’s any better but it definitely works and is faster than default. (on my system)

Would you mind testing your file with bidir again? :slight_smile:

1 Like

Sure, I will. I wonder if it’s a similar-but-different issue, or if I’m mis-remembering about testing bidir before.

The issue in the files we were looking at was poor identification of keyframes when nokey was used. In some cases I frames were almost all skipped, leaving nothing to make previews with. But it happened quickly and didn’t generate errors.

bidir should skip only the B frames, leaving the I and P frames. It does sound like that should succeed, so I’m questioning my memory.

It may not give as much speed-up, depending on the GOP structure of a file. I think we’re on the same page.

I wonder if your file has broken B frames, and skipping them is addressing that error.

You can find a test sample in this thread.

Anyway, I remember testing with bidir and yeah, it works, although it can/will generate duplicates. The preferred solution is still default for those problematic videos, but maybe bidir would be a better default than nokey (because it’s still fast and doesn’t break “randomly”). Hopefully Plex listens.

1 Like

bidir shouldn’t be worse than nokey in that regard, and it ought to be better.

That’s part of why I’m comfortable recommending an increased GenerateBIFFrameInterval value. Making duplicate preview frames because of dropped source frames doesn’t make much sense.

@Mitzsch what’s the origin story/provenance of your file?

The file is from a bluray that I purchased a while back. (Score - Eine Geschichte der Filmmusik)
MediaInfo:

Video
ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format-Profil                            : High@L4.1
Format-Einstellungen                     : CABAC / 3 Ref Frames
Format-Einstellungen für CABAC           : Ja
Format-Einstellungen für RefFrames       : 3 frames
Codec-ID                                 : V_MPEG4/ISO/AVC
Dauer                                    : 1 h 33 min
Bitraten-Modus                           : variabel
Bitrate                                  : 22,0 Mb/s
maximale Bitrate                         : 40,0 Mb/s
Breite                                   : 1 920 Pixel
Höhe                                     : 1 080 Pixel
Bildseitenverhältnis                     : 16:9
Modus der Bildwiederholungsrate          : konstant
Bildwiederholungsrate                    : 23,976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scantyp                                  : progressiv
Bits/(Pixel*Frame)                       : 0.443
Stream-Größe                             : 14,3 GiB (93%)
verwendete Encoder-Bibliothek            : x264 core 125 r2208 d9d2288
Kodierungseinstellungen                  : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x133 / me=umh / subme=10 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-3 / threads=24 / lookahead_threads=4 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=1 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=1 / weightp=1 / keyint=24 / keyint_min=1 / scenecut=5 / intra_refresh=0 / rc_lookahead=24 / rc=2pass / mbtree=1 / bitrate=22000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=40000 / vbv_bufsize=30000 / nal_hrd=vbr / ip_ratio=1.40 / aq=1:1.00
Sprache                                  : Englisch
Default                                  : Nein
Forced                                   : Nein
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Originales Source-Medium                 : Blu-ray

Another file (Lady Vengeance - remastered bluray) with almost the same behavior. (no mmco: unref short failure bitrate error message)

[h264 @ 0000027d8d30ad80] illegal short term buffer state detectedup=23 drop=0 speed=1.97x
[h264 @ 0000027d8d30ad80] illegal short term buffer state detectedup=23 drop=0 speed=0.265x
[h264 @ 0000027d8d309fc0] illegal short term buffer state detectedup=23 drop=0 speed=0.199x
[h264 @ 0000027d8d309b40] illegal short term buffer state detectedup=23 drop=0 speed=0.181x
Video
ID                                       : 1
ID in the original source medium         : 4113 (0x1011)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format-Profil                            : High@L4.1
Format-Einstellungen                     : CABAC / 3 Ref Frames
Format-Einstellungen für CABAC           : Ja
Format-Einstellungen für RefFrames       : 3 frames
Codec-ID                                 : V_MPEG4/ISO/AVC
Dauer                                    : 1 h 55 min
Bitraten-Modus                           : variabel
Bitrate                                  : 36,0 Mb/s
maximale Bitrate                         : 38,0 Mb/s
Breite                                   : 1 920 Pixel
Höhe                                     : 1 080 Pixel
Bildseitenverhältnis                     : 16:9
Modus der Bildwiederholungsrate          : konstant
Bildwiederholungsrate                    : 24,000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scantyp                                  : progressiv
Bits/(Pixel*Frame)                       : 0.723
Stream-Größe                             : 28,8 GiB (94%)
verwendete Encoder-Bibliothek            : x264 core 161
Kodierungseinstellungen                  : cabac=1 / ref=4 / deblock=1:-1:-1 / analyse=0x3:0x110 / me=tesa / subme=11 / psy=1 / psy_rd=1.00:0.15 / mixed_ref=1 / me_range=24 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=0 / chroma_qp_offset=-3 / threads=34 / lookahead_threads=2 / sliced_threads=0 / slices=4 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=1 / constrained_intra=0 / bframes=3 / b_pyramid=1 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=1 / weightp=1 / keyint=24 / keyint_min=1 / scenecut=60 / intra_refresh=0 / rc_lookahead=24 / rc=2pass / mbtree=1 / bitrate=36000 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=38000 / vbv_bufsize=30000 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:1.00
Sprache                                  : Englisch
Default                                  : Nein
Forced                                   : Nein
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Originales Source-Medium                 : Blu-ray

Again with bidir everything works.