Repository navigation
Avoid calling PIL.Image twice to open a file - #1149
Conversation
Sometimes reading metadata is just slow.... lets avoid it...
|
seems like something is off in the windows ffmpeg build? |
|
@hmaarrfk Yes, there exists currently a flakey test for the old ffmpeg plugin (not the pyav one) where something in the shutdown of the subprocess is racy which may causes a test to fail. I'm not super motivated to fix it though, because the "damage" it does is that I need to spend 2 seconds to click on "re-run failed tests" 🤷 and the entire plugin will get deprecated in favour of the pyAV one anyway. That issue doesn't affect us here though. This CI run is failing because FFMPEG appears to now support a new hardware accelerator codec called |
|
I'll review the PR later this week. I remember that there is a reason why the file opening is written so awkwardly ... something about not leaking a file reference in an edge-case ... but it's been a few years since I touched that code so I need to dig through it again to refresh my memory 😅 |
yeah, it seems that this was the reason, but i can't follow the kind of edge case it helps with. Thx tbh, this isn't really on my critical path, it just looked really weird.... |
|
Okay, I got the logic now. Pillow's It's safe to merge the two calls into one, but we won't get a big performance boost out of it I fear. |
|
ah got it. |
|
not sure i agree. THe old way
Alot of time is "wasted' reading metadata from files. as that metadata grows, it becomes an increased cost. Its just a tiny optimization, but also improves readability IMO. Thx for merging. |
Sometimes reading metadata is just slow.... lets avoid it...