Earlier quoted context omitted.
I'm dying.
https://www.youtube.com/watch?v=9kaIXkImCAM
FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
41–50 of 186 posts
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#42Earlier quoted context omitted.
Because refactoring requires understanding, which LLMs completely lack.
> Because refactoring requires understanding, which LLMs completely lack. Interesting. Here's a sample question I just asked the AI: We are working on a React mapping application. I am going to give you two components from this application. Our goal is to extract functionality to deduplicate code We can make a single base component, extract code to hooks, or any other strategy which you think is appropriate Here is t…
Cleaning up code also follows some well established patterns, performance work is much less pattern-y.
Codebases like FFMPEG are one of the kind. I bet you need 10 or 100 times more understanding than the react thing you mentioned above.
One day maybe AI can do it, but it probably won't be LLM. It would be something which can understand symbols and math.
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#43It’s nuts to think that in the near future LLM will be able to do that refactoring in seconds. All we need is enough context window.
Why would you think this is possible?
Couldn't do the same with larger codebases because the context is not enough for the input code and output refactoring.
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#44Meanwhile, I've been enjoying threaded filter processing in VapourSynth for nearly a decade. Not that this isn't great. Its fantastic. But TBH its not really going to change my workflow of VapourSynth preprocessing + av1an encoding for "quality" video encodes.
[edit]
found the docs; it's available on Linux[1]. I'm definitely looking into it tonight because it can't be worse than writing ffmpeg CLI filtergraphs!
1: http://www.vapoursynth.com/doc/installation.html#linux-insta...
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#45Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#46IIUC all current encoders that support parallelism work by multiple threads working on the same frame at the same time. Often times the frame is split into regions and each thread focuses on a specific region of the frame. This approach can have a (usually small) quality/efficiency cost and requires per-encoder logic to assemble those regions into a single frame.
What if instead/additionally different keyframe segments are processed independently? So if keyframes are every 60 frames ffmpeg will read 60 frames pass that to the first thread, the next 60 to the next thread, ... then assemble the results basically by concatenating them. It seems like this could be used to parallelize any codec in a fairly generic way and it should be more efficient as there is no thread-communication overhead or splitting of the frame into regions which harms cross-region compression.
Off the top of my head I can only think of two issues:
1. Requires loading N*keyframe period frames into memory as well as the overhead memory for encoding N frames.
2. Variable keyframe support would require special support as the keyframe splits will need to be identified before passing the video to the encoding threads. This may require extra work to be performed upfront.
But both of these seem like they won't be an issue in many cases. Lots of the time I'd be happy to use tons of RAM and output with a fixed keyframe interval.
Probably I would combine this with intra-frame parallelization such as process every frame with 4 threads and then run 8 keyframe segments in parallel. This way I can get really good parallelism but only minor quality loss from 4 regions rather than splitting the video into 32 regions which would harm quality more.
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#47Earlier quoted context omitted.
FFMPEG does so much more than just video encoding. I use ffmpeg all day every day, and only a fraction of the time do I actually make a video.
Like what do you do?
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#48Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#49It’s nuts to think that in the near future LLM will be able to do that refactoring in seconds. All we need is enough context window.
Yeah, it's nuts to think that.
I have been refactoring code using gpt-4 for some months now and the limiting factor have been the context size.
GPT-4 turbo now have 128k context and I can provide it with larger portions of the code base for the refactors.
When we have millions of tokens of context, based on what I'm experiencing now, I can see that a refactoring like the one made in ffmpeg would be possible. Or not? What am I missing here?
Re: FFmpeg lands CLI multi-threading as its "most complex refactoring" in decades
#50Earlier quoted context omitted.
Like what do you do?
One can use it instead of cat to display text files. Easy syntax to remember. ffmpeg -v quiet -f data -i file.txt -map 0:0 -c text -f data -