Closed boblickj closed 4 days ago
Hey @boblickj thanks for taking the time to create an issue for this.
That prob explains why I've seen it randomly fail, just never had the time to dig into why, partly due to my limited ffmpeg knowledge.
Yes, def open to a PR but what are you thinking on how to get it working? Can we somehow detect the lack of keyframes prior to running ffmpeg?
@stevezau
Looked into this a bit — technically we can count the keyframes using ffprobe, but it’s essentially a linear scan over the file contents. This isn’t really an issue for small files, but kills processing for any large REMUX.
My two thoughts were to either just add a new on/off parameter similar to how plex does it, or we could add a check to count the number of images generated before creating the BIF. The only caveat to this is the number of keyframes can vary quite a bit depending on the motion in videos, so we would probably need to create an arbitrary threshold of expected vs actual.
Hey @boblickj, hmm ok. I am not sure if i fully understand this but in my mind couldn't we just detect the error from FFMPEG and rerun without "-skip_frame:v "?
That way the user does not need to worry about any settings?
Hey @stevezau,
We can get the count of keyframes with the below command, but its runtime scales with file size. This isn't an issue if your library is small -- however in my tests, processing a single ~80GB REMUX takes about 10 minutes on a high-speed enterprise HDD.
I think the best solution is a hybrid:
-skip_frame:v nokey
if necessaryffprobe -loglevel error -hide_banner -select_streams v:0 -show_entries packet=pts_time,flags -of csv=print_section=0 <input file> | grep K | wc -l
@boblickj, can I confirm my understanding of the problem before we choose a path forward.
Is this right?
You propose we add a setting that removes the flag "-skip_frame:v nokey" from the FFMPEG command.
From a user experience perspective
OR.. Are you saying it still succeeds, but because of the lack of keyframes, only a few video preview files are generated?
@boblickj ^^?
@boblickj haven't heard from you?
Closing due to inactivity.
Certain video files will not generate previews with the default Plex ffmpeg args if the encoded media has a lack of keyframes. This can be fixed by adding
GenerateBIFKeyframesOnly="0"
to parameters.xml. Essentially, this removes-skip_frame:v nokey
from the argument list. This shouldn't be enabled by default as it can increase processing time, but in my experience, it now successfully generates previews for all media.I can submit a PR if this is something you would be okay supporting.
https://www.reddit.com/r/PleX/comments/u2u5j1/generating_video_preview_thumbnails_keeps_redoing/ https://support.plex.tv/articles/201105343-advanced-hidden-server-settings/