[FFmpeg-devel] [PATCH 1/2] libavfilter/scale: More descriptive in/ref/out logging
kmark937 at gmail.com
Wed Jul 19 09:01:54 EEST 2017
Just wondering if anyone had any thoughts on the grepability issue,
which I believe is the only potential issue/breaking change with this
On Sun, Jun 11, 2017 at 9:59 PM, Kevin Mark <kmark937 at gmail.com> wrote:
> Hi Michael,
> Hoping to get your thoughts on the grepability issue (wrt my previous
> email). If it needs to be on a single line there's no reason the new format
> cannot be changed to do so (removing the \n and adding a separator, really).
> However I'm a big fan of it as-is (for both scale and scale2ref) and I can't
> find a case of my own where the regex I proposed would be troublesome.
> On Tue, Jun 6, 2017 at 4:17 PM Kevin Mark <kmark937 at gmail.com> wrote:
>> On Tue, Jun 6, 2017 at 11:49 AM, Michael Niedermayer
>> <michael at niedermayer.cc> wrote:
>> > yes but its much harder to grep for as its not a single line anymore
>> I agree that it's not going to be as pretty a regular expression to
>> grep through, as there is 33% more data, but it should still be doable
>> without too much effort. How important is it that we maintain "API"
>> compatibility on verbose CLI output?
>> ffmpeg [...] scale2ref=0:0 [...] -v verbose - 2>&1 >/dev/null | grep -oP
>> Where regex is:
>> (in|out|ref) +w:(\d+) h:(\d+) fmt:(\w+) sar:(\d+)\/(\d+)(?:
>> Assuming GNU grep 2.25+, you'll get:
>> in w:320 h:240 fmt:rgb24 sar:1/1
>> ref w:640 h:360 fmt:rgb24 sar:1/1
>> out w:640 h:360 fmt:rgb24 sar:3/4 flags:0x2
>> It also works with BSD grep 2.5.1-FreeBSD included in macOS if you use
>> the -E option instead of -P. These would be considered three separate
>> matches so if you're using a good regex engine it'd be pretty easy to
>> loop over each match, check the first group to determine if it's in,
>> ref, or out and act accordingly on the rest of the captured data. You
>> could also, if you wanted, assume that the first line is in and the
>> second line is out if you only have two matches (or lines even) and if
>> you have three matches/lines the first is in, second is ref, third is
>> out. If you needed it to work with less sophisticated engines it
>> shouldn't be too hard to dumb down the regex above.
>> Live-ish example: https://regex101.com/r/wvHLpa/1
>> Is there a special property that makes single lines much easier to
>> grep? Something specific to bash? I wouldn't think bash would have any
>> problems looping over this by line.
More information about the ffmpeg-devel