I absolutely love ffmpeg, but for the life of me I cannot understand how its pipeline system works. Each time I need to use it, I attempt to construct the command myself, but end up giving up and consulting StackOverflow. Amazingly, someone has usually done the exact thing I need to do and posted their command line to StackOverflow, so I'm never out of luck! How do I actually start understanding how ffmpeg works? I w…
I know a lot of people look down on ChatGpt. But I have been using it for creating scripts to use with ffmpeg and I was able to get most of the things that I needed with very little massaging required. You can then ask ChatGpt about what it did and why so it will explain it as well so you can get some basic understanding on how things work. People don't realise what kind of tool Chat Gpt is and how to properly utilis…
FFmpeg 6.0
171–180 of 210 posts
Re: FFmpeg 6.0
#172Re: FFmpeg 6.0
#173Earlier quoted context omitted.
The ordering of the arguments changes behavior, I don't think that's a good thing or desired outcome, at most it's a bug_feature. It tend to happen when big project rolls out batteries itself, in this case command line parsing.
argument order is definitely a feature. with -ss being one that behaves differently depending on it's location in reference to -i. it's not an accidental thing and the desired outcome dictates where you place it. not understanding that just means you're not using it enough to grok it.
But I'm not convinced, maybe it is the local optima though.
Re: FFmpeg 6.0
#174Earlier quoted context omitted.
It’s bad at counting because counting relies on a stateful O(N) algorithm you run in your brain. GPT is trained to reproduce human text, which tends to simply have the output of this O(N) counting process, but not the process itself. So GPT “thinks” it should be able to just spit out the number just like human text implies we do. It doesn’t know we are relying on an offline O(N) algorithm. If you have it emit a numbe…
Shouldn't RHLF help with this? So it learns that when people specify a number, they mean something very specific.
You could RL learn that when someone specifies a number, the appropriate thing to say is "Ok, 40 asterisks, let's count them, 1, *, 2, *, 3 , *, ..." and then it would indeed produce 40 asterisks. But not as a single string. Because producing them as a single contiguous string requires some offline state/memory/processing, and all the neural network has access to is the last ~page of text.
Embedding the counting process into the text itself kind of embeds the state of the O(N) algorithm in the O(N) text itself, that is, "unrolling the loop" externally.
Re: FFmpeg 6.0
#175I love the version names, all famous scientists (Von Neumann, Riemann, Lorentz etc.)! Though I am curious whether there is a specific reasoning behind a name in relation to a version (alphabetically, numerically, chronologically etc.)?
Re: FFmpeg 6.0
#176I wrote a large and messy script to encode a random amount of videos of any aspect ratio so it can fit in a mosaic with the xstack filter. I think there are still slight audio sync issues, because I should reencode video files individually but I do a single pass instead to not deal with leftover files. I'm quite happy with the result. I wish I could write a script to do some basic effect on a video, like adding some…
Re: FFmpeg 6.0
#177Earlier quoted context omitted.
Thanks. Looks like the input in question was an .avi file. That's a container format I don't know anything about (and don't particularly care to). I suspect then it's not relevant for anything more modern.
A surprising number of mp4 files are missing the ctts atom that contains pts since it’s sort-of optional outside the Apple stack (like ffmpeg generated such files from raw h264, which is probably the actual motivation for finally fixing this.) This should allow you to not generate or fix such files. It’s sort-of optional for most playback stacks because they leave frame reordering to individual decoders as a codec-sp…
I have a bit of a love-hate relationship with ffmpeg. Love because it does things nothing else does (e.g. has a main-profile software H.264 decoder) and is so comprehensive, hate because code quality varies (lots of long-unfixed bugs/quirks in trac) and documentation/API/CLI experience is poor. E.g., I wish the documentation for this new bsf explained what you just said.
Re: FFmpeg 6.0
#178Earlier quoted context omitted.
It really works! With few interactions, ChatGPT was able to create a not so obvious -filter_complex pipeline, like: ffmpeg -ss 00:01:00 -t 00:02:00 -i input1.mp4 -ss 00:03:00 -t 00:02:30 -i input2.mp4 -filter_complex "[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[v][a];[v]eq=brightness=0.3[outv]" -map "[outv]" output.mp4
And what does all that filter_complex do?
The first filter, concat, takes in a set of synchronized audio and video segments, concatenates them, and returns the resulting audio and video clips. n specifies the number of segments, v specifies the number of output video clips, and a specifies the number of output audio clips. The results are saved to the values of [v] and [a] for video and audio respectively.
The eq filter then takes the [v] video returned by concat, and adjusts the value to a brightness of 0.3. For reference, 0 represent no change to the brightness.
This [v] value is then mapped to the output video using -map.
That being said, this filter isn't correct, as the [a] value is never used or mapped, so the filter would fail. The correct way to write the filter, if the intended use is to discard the audio, would be:
-filter_complex "[0:v][1:v]concat[v];[v]eq=brightness=0.3[outv]"
I omitted the n,v, and a values in the concat filter, as they are by default 2,1, and 0 respectively.Another way to visualize this filter in an imperative style would look like this:
def filter(input0, input1) {
v = concat(input0.v,input1.v);
outv = eq(v,brightness=0.3);
return outv;
}Re: FFmpeg 6.0
#179Fun fact of the day: ffmpeg is written by Fabrice Bellard, who among other impressive things, wrote the JS PC emulator capable of running windows 2000 in a browser over 10 years ago that got me fascinated with emulators in general. https://bellard.org/jslinux/tech.html
Re: FFmpeg 6.0
#180Earlier quoted context omitted.
A surprising number of mp4 files are missing the ctts atom that contains pts since it’s sort-of optional outside the Apple stack (like ffmpeg generated such files from raw h264, which is probably the actual motivation for finally fixing this.) This should allow you to not generate or fix such files. It’s sort-of optional for most playback stacks because they leave frame reordering to individual decoders as a codec-sp…
Thanks, that makes more sense! Raw (Annex B) h264 in particular isn't exactly an ideal media format but I've definitely gone through it while debugging stuff and can see how you'd need this plugin to get from it to a correctly muxed file with B frames. I have a bit of a love-hate relationship with ffmpeg. Love because it does things nothing else does (e.g. has a main-profile software H.264 decoder) and is so comprehe…
I really wonder why it costs people so much to write the whys of everything technical they do in at least a source code comment, but it is indeed an everyday's uphill battle.