Video Preview Thumbnail Generation Fails for Some Items

The only validity that file has is as an example of a broken file.
In that regard it excels.

Fair enough. I mean valid as in proper/legal/spec-compliant h264. The value in pointing out that they’re “valid” is that maybe Plex and FFmpeg will address the issue. :slight_smile:

But yes. Broken as in “Doctor, it hurts when I do this…”

There’s a lot of value in doing things the expected way and avoiding surprises, even if something else isn’t wrong. Better to change what’s in our control than complain things should work.

I dropped in on HB (Free) and it did a 2 Pass/De-interlacing fix in 50 seconds - and Plex happily generated VPTs for it.

Not sure how much more Science needs to be applied to it - but whatever…

Carry on…

@Volts, thanks for taking a detailed look. As you say, the obvious fix for now is to use Closed GOP on future encodes. Having thumbnail previews is a nice little extra rather than being a dealbreaker for me, so I can certainly live with it not working on some of my older files.

Incidentally, to answer your question I never had any problems with seeking/streaming these files in either Plex, Emby or Windows (VLC for example).

1 Like

Just to follow up on this topic, while I mess around with making my own BIF files for problem videos…

I’ve been ripping a few more Blu-ray discs and I’ve noticed a few that encounter the same problem. Notably, I have three discs from the Arrow label: The Thing (1982 film/2017 release), The Exorcist III (2019 release) and Dream Demon (2020 release). I’m ripping directly from the Blu-ray discs with no transcoding. Interestingly these all fail to index correctly, so I assume that whatever coding method Arrow is using, Plex doesn’t like it. FWIW, these all seem to be Open GOP files according to MediaInfo.

And just to reply to myself once more, I have now manually created BIF files for these films without using -skipframe, and then copied them to Plex’s database structure (no mean feat working out where the sd-index.bif should go!).

It works perfectly in Plex’s player.

1 Like

Nice!

What process did you use to create the BIF files?

Okay, not quite right - I need to adjust the time scale of the thumbnails, as they’re way behind the film itself.

I used your ffmpeg extraction method with no frameskip, then the Roku BIF tool at https://developer.roku.com/en-gb/docs/developer-program/media-playback/trick-mode/bif-file-creation.md. Then convoluted issues trying to find out where to put the resultant BIF file in the database structure. Phew!

FYI, I modified a copy of the Plex Media Server binary to call the Plex Transcoder (which is really just a fancy FFmpeg) with "-skip_frame:v none " instead of “-skip_frame:v nokey”, and it worked.

cp -a "Plex Media Server" "Plex Media Server.orig"
sed "s/nokey/none /" "Plex Media Server.orig" > "Plex Media Server"

Obviously it’s a lot slower, but if the only files in your library are these ones, it gets the job done until a real fix is available.

Edit: scroll down to a lower post for a much better solution.

Video Preview Thumbnail Generation Fails for Some Items - #48 by Volts

1 Like

Arrow’s “Robocop” has the same issue symptoms. Lots of I frames, fewer IDR frames.

I opened https://trac.ffmpeg.org/ticket/8820 with FFmpeg.

Volts, that’s brilliant. I didn’t know enough about how Plex works to try something like that. Thanks for doing the bug report too.

I’d opened another thread elsewhere about Arrow releases and a dev was going to look at it. The three that I own all cause this problem, so it’s obviously something to do with their encoding. But I really think you’ve hit on the problem and solution here. With your workaround my server is happily chuntering away making previews.

@cryptoluks, @tenyo, @f18cc, @artwhitehead, can you share samples, and/or the process that you’ve used to rip these files?

It’s my impression that this happens when the FFMpeg component in Plex fails to parse out keyframes in some H.264 streams.

More examples would be nice, especially anybody else who has original media + rips with this problem.

I primarily use TMPGEnc Video Master Works 7. I can share an example of a movie that seems to fail immediately when creating thumbnails. What’s the best way to share it? The file is 1.8GB.

That’s the same encoder @Raelworld was using when he was doing encodes, I believe.

It’s our theory that enabling Output bitstream for editing (Closed GOP) in TMPGEnc will force that encoder to emit bitstreams that Plex can create video preview thumbnails for.

@Raelworld posted a screenshot for that above:

I’d be curious if that resolves the issue for you when doing encodes.

If anybody else is seeing this problem with BD Remuxes that would be particularly interesting.

you can create small samples like @

https://support.plex.tv/articles/201035968-generating-sample-files-from-media/

Hmmm, can definitely give that a try. I will say that I have other files I’ve done using the same method and Plex is able to create thumbnails just fine. It always seems to be rather inconsistent.
Creating a sample file might run into the same issues as it might take a while to recreate the problem with a smaller file. I usually don’t run into problems with TV shows which are shorter in length, and those files are between 500 - 800MB usually.
Here’s a link to the file that I know fails. [link removed] It is a larger file, but maybe someone who knows what they’re looking at can determine why Plex is failing to generate thumbnails.

Thank you for sharing. Does TMPGEnc add the chapters, or were those included on disc? Very nice either way.

That file has the same structure as the others. Plenty of I frames, not very many IDR frames. VPT generation is definitely failing for the same reason.

If you have files that were encoded the same way, but that work, I would love to review one of them.

I believe that setting “Closed GOP” will usually avoid the problem. It’s not a certainty that “Open GOP” will instantly and always cause the problem, however.

I will definitely try the closed GOP method from here on out. The Chapters were on the disc, but TMPGEnc will also outputs chapters that you import or create on your own. Here’s another file that Plex created thumbnails for just fine that, other than the aspect ratio, is encoded with identical settings.
[link removed]

That’s interesting. The encoding settings aren’t identical, but they’re very very close. The one that’s different is the x264 “ref” setting. That’s still related to how frames refer to each other and might-maybe influence how many I vs. IDR frames are generated.

Superman:
Encoding settings: cabac=1 / ref=6 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=1 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / slices=1 / nr=0 / decimate=1 / interlaced=0 / minigop=0 / stitchable=1 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=1 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 / vbv_bufsize=18000 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:1.00

TWOO:
Encoding settings: cabac=1 / ref=4 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=1 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / slices=1 / nr=0 / decimate=1 / interlaced=0 / minigop=0 / stitchable=1 / constrained_intra=0 / bframes=3 / b_pyramid=0 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=1 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=2pass / mbtree=1 / bitrate=2000 / ratetol=1.0 / qcomp=0.60 / qpmin=3 / qpmax=69 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / vbv_maxrate=18000 / vbv_bufsize=18000 / nal_hrd=vbr / filler=0 / ip_ratio=1.40 / aq=1:1.00

Superman has lots more (145) IDR frames than the ones that don’t work in Plex (1-10), but it still has many more I frames than IDR frames. Maybe it has “enough” - or may they’re “spread across” the file more evenly.

That’s different from most Closed GOP files, which sometimes make EVERY I frame into an IDR frame.

Neat, thanks.