Script to regenerate video previews multi threaded?

The Python docs got blander between 2.6 and 3:

2.6:

The form ‘!’ is available for those poor souls who claim they can’t remember whether network byte order is big-endian or little-endian.

3:

The form '!' represents the network byte order which is always big-endian as defined in IETF RFC 1700.

lol

Edited the script and created a proper repo here GitHub - stevezau/plex_generate_vid_previews: This is a script to manually generate Plex preview thumbnails

Seems to work, no need for docker to generate bif.

thanks @Volts !

2 Likes

@Volts

Also old one of mine

1 Like

Woah. Prehistoric. Nice! I should explore your repo for other fun things.

Bifserver itself would have been useful! Lol

1 Like

What can I say, besides been a Dinosaur :smiley:

1 Like

I don’t think this is an error but more a problem with going too fast. I keep getting “Temporary failure in name resolution” errors, so I can only presume Plex is blocking and/or throttling me. Best guess is that DDoS flood protections are rate limiting connections.

@jasonsansone are you responding to the wrong thread? When do you get that error?

In python std error out when running the script. I will try and reproduce it to post an Issue on GitHub.

1 Like

Steve’s script or Dane’s?

Plex doesn’t seem to use DNS rate limiting, not anywhere that I’m aware of.

And the script assumes you’ll provide a token, so I don’t think it’s an auth system rate limit.

Did you give it a valid URL for the local server, and if you gave it a *.plex.direct URL, can that name be resolved on the host? Maybe *.plex.direct is blocked by DNS rebinding protection on your router.

I am testing out @stevezau awesome script. I am encountering issues, but I am trying to figure out if its just me or there needs to be any code improvements. I will report back. Amazing work!

1 Like

@jasonsansone that script was best effort and only tested on my machine so I wouldn’t be surprised if you hit issues.

I can help via GH issues if needed

2 Likes

I will see what I can do. I have never worked with python.

@jasonsansone - just to check, what problem are you trying to solve by running the script? Do you have a similar situation, many VPTs to generate?

2x different Plex servers with 50K+ files each to generate previews for and Plex’s preview generation is single threaded.

Cool! Yeah, same problem to solve. Just checking!

With this script, I can actually find a bottleneck which happens to be the storage sequential read speed. I am saturating my Ceph cluster at around 1.2GBs while analyzing 4K remux files concurrently.

1 Like

@jasonsansone i assume that means it is working for you?

I got it working. I attempted a PR on Git, I am also still seeing where I can improve the code for myself and others.

1 Like

I have never used git or coded in python, so I apologize if I am doing anything wrong. I am trying to get the hang of it. The PR can be tracked here. I am extremely grateful for the work of @stevezau and not trying to overstep by any means. Just hoping to contribute to the code for everyone.

1 Like

I think I am done for now. I encourage people to test the tweaks. The pending PR should add:

  • Adds tests in script to warn about missing dependencies and gracefully exit if any are missing
  • Adds test for ffmpeg to warn about missing ffmpeg requirement and gracefully exit if missing
  • Adds test for MediaInfo to warn about missing MediaInfo requirement and gracefully exit if missing
  • Add code to allow python script to execute as a defined UID and GUID for file permissions to match plexmediaserver process
  • Add code to create directory tree for .bif files prior to attempting to write out completed .bif when directory path is incomplete.
  • Image optimization prior to .bif generation for better compression and storage space utilization.
  • HDR detection and tonemapping for HDR content to prevent washed out colors
1 Like