4 ms·
i feel like suprocess call is an under rated way of using libs like ffmpeg- its how i usually do it. normally you have to learn the cli anyway, so it almost alw
by the_cat_kittles 7y ago
i feel like suprocess call is an under rated way of using libs like ffmpeg- its how i usually do it. normally you have to learn the cli anyway, so it almost always seems easier to just script the command generation rather than use some middleman abstraction layer
- vonseel 7y agoIt’s how I do it too, but it’s probably less “clean” for people who care about such things.
- zerocrates 7y agoNormally I'd agree, but ffmpeg is a bit of a special case: thanks to its extremely large set of options it has a rather high number of pitfalls: flags that do subtly to wildly different things depending on where they are placed relative to other arguments, for example. Complex filter graphs are pretty gnarly on their own, being a string-based sublanguage all crammed into one argument... it's not totally unreasonable to reach for something just to tame that particular beast. If this gets you halfway-workable tab completion for the various options of things it's worth it for that alone, vs. diving through the big long page that otherwise contains all the names and orders of arguments to filters.
- the_cat_kittles 7y agofair points- clearly my use cases are less demanding
- s_Hogg 7y agoAny time the CLI options stop you from doing something that is possible in the library itself, this goes out the window. That's why my friend and I wrote a pybind11 wrapper for tesseract. We could probably do something similar here, and never worry about subprocess again.
- qmmmur 7y agoI use subprocess to turn any single file in > single file out script into a batch processor that takes folders as input and output. I am sort of new to programming and I felt like this was quite dirty, but I didn't have the bindings anyway so I didn't have a choice. What are the downsides and upsides of calling subprocess versus bindings?