this post was submitted on 06 Aug 2024
13 points (100.0% liked)

Python

6378 readers
95 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

📅 Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
💓 Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 1 year ago
MODERATORS
 

Hi All,

I'm screening a large media library (20TB) wherein some files got corrupted when I did a transfer via filezilla (by my guess ~10%). The corrupted files display with a green "filter" over every frame (when played via plex and a number of local video players playing the file directly).

I'd like to screen the library, and want to write a script to get an average color reading.

Are there any libraries that would let me return a value AND specify how many frames I want it to take the average of? Because of how consistent and defined the issue is, it's really not necessary to average the whole file.

It would also be great if it automatically skipped non-video files, but I imagine a simple "try/except" would be fine.

My skill level here is best described as "high level hobbyist". I'm familiar with what I need to do iterating over the folder etc, but would prefer not to learn how to pull specific frames from a video container unless I have to.

Thanks for any help!

top 2 comments
sorted by: hot top controversial new old
[–] BlazeDaley 3 points 3 months ago (1 children)

Sorry for not having a direct answer for your question.

First, are these videos using Dolby Vision? If so try a google search for “Dolby Vision green tint”.

Second, if this really is a corruption issue, are you sure you really want to write something custom to fix this? What else is wrong in those files that you haven’t noticed yet? It seems unlikely that they would all corrupt consistently. Did something transform them since they were last in a known good state? Do you have other means to revert that transformation?

Finally, if you do want to continue down your current path there’s a light discussion on the topic in this stack overflow thread. You’re going to need to contend with how videos are compressed, i.e. not every frame is actually stored. You’re likely going to loose some quality or bloat the file size through applying a correction process. If you find the right tools and want to minimize loss and bloat, you may need to use different solutions for different codecs.

[–] batmaniam 3 points 3 months ago

Thank you for the tips! It turns out the files weren't corrupted at all, it was a transcoding issue somewhere in the hardware acceleration stack. I've disabled it which will cause some bottlenecks, but there's more than enough processing power in the rig for the limited amount of people that use it simultaneously.

Thank you for the reply and the links though! My original plan was NOT to fix the files, just to figure out which had an issue and re-download them. Like I said it turns out that was unnecessary.

Thanks all the same for pointing me to that thread. I do want to start screwing around with some imagine manipulation at some point, and this has already been really educational in learning the top level flow of this kind of thing. Again, I'm more used to passing data for sensors and motors.