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.
Thanks, Kevin On Tue, Jun 6, 2017 at 4:17 PM Kevin Mark <kmark...@gmail.com> wrote: > On Tue, Jun 6, 2017 at 11:49 AM, Michael Niedermayer > <mich...@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 > 'regex' > > Where regex is: > > (in|out|ref) +w:(\d+) h:(\d+) fmt:(\w+) sar:(\d+)\/(\d+)(?: > flags:0x[[:xdigit:]]+)? > > 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. > > Thanks, > Kevin > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel