[FFmpeg-user] Using the "select" filter

Clément Bœsch ubitux at gmail.com
Tue Nov 22 21:30:44 CET 2011


On Fri, Nov 18, 2011 at 11:06:12AM +0000, Tim Nicholson wrote:
> On 17/11/11 19:10, Clément Bœsch wrote:
> >On Thu, Nov 17, 2011 at 08:09:40PM +0100, Clément Bœsch wrote:
> >>On Thu, Nov 17, 2011 at 11:19:48AM +0000, Tim Nicholson wrote:
> >>>The examples of using the select filter given at:-
> >>>
> >>>http://ffmpeg.org/ffmpeg.html#select
> >>>
> >>>suggest, for example,
> >>>
> >>># select only I-frames
> >>>select='eq(pict_type\,I)'
> >>>
> >>>
> >>>However when I tried this I got an error.
> >>>
> >>>ffmpeg -i in.mp4 -vf "select='eq(pict_type\,I)', showinfo" -f mp4 -y
> >>>/dev/null
> >>>[..]
> >>>Missing ')' or too many args in 'eq(pict_type\,I)'
> >>>
> >>>
> >>>Removing the "\" which I assume is there to "escape" the comma
> >>>solved the problem, thus:-
> >>>
> >>>ffmpeg -i in.mp4 -vf "select='eq(pict_type,I)', showinfo" -f mp4 -y
> >>>/dev/null
> >>>
> >>>This looks like a small error in the docs.
> >>>
> >>
> >>You are not supposed to add quotes around the select.
> 
> The quotes were around the whole filtergraph, not just the select.
> 
> >>
> >>   ffmpeg -i in.mp4 -vf select='eq(pict_type,I)',showinfo -f ...
> >>
> >
> >Erh. I meant:
> >    ffmpeg -i in.mp4 -vf select='eq(pict_type,\I)',showinfo -f ...
> 
> Actually you meant:-
> 
> ffmpeg -i in.mp4 -vf select='eq(pict_type\,I)', showinfo -f ...
> 

Yes, without the space before showinfo since there is no surrounding
quotes.

> Why is select different to any other filter?
> 

The filter isn't, the documentation might be though.

> Looking through the list of examples provided in:-
> 
> http://ffmpeg.org/ffmpeg.html#Video-Filters
> 
> shows the following:-
> 	
> 23.11 fieldorder
> ffmpeg -i in.vob -vf "fieldorder=bff" out.dv
> 
> 23.16 hflip
> ffmpeg -i in.avi -vf "hflip" out.avi
> 
> 23.34 slicify
> ffmpeg -i in.avi -vf "slicify=32" out.avi
> 
> 23.37 unsharp
> ffmpeg -i in.avi -vf "unsharp" out.mp4
> 
> 23.38 vflip
> ffmpeg -i in.avi -vf "vflip" out.avi
> 
> From which one might reasonably deduce that is is normal, and
> recommended to enclose the whole filtergraph within " ". It
> certainly aids clarity in seeing what elements on the command line
> are part of the whole filter arrangement, and I think its more
> readable when you don't end up with \ escapes littering a filter
> that already has ample use of other punctuation characters such as =
> , : it reminds me a bit of perl. ;P
> 

The documentation is a bit inconsistent I agree, but I think the examples
should have the '\' in it: it's more obvious when the failure occurs on
the '\' instead of the comma: "why does it fails on the comma? I don't see
why I need to escape it...", while in case of the an extra escape the most
common thought is something like "herp derp yet another shell escaping
issue i need to double escape, remove escape, ..." which is more likely to
lead to a solution.

Also note the shell escaping varies between shells (I know tcsh has for
instance a totally insane way of escaping).

I think examples with the full command line should include the " ", or at
least a command that obviously work out of the box.

On the other hand, if it's just for the -vf part, I don't think the
surrounding quotes should appear: it is obvious you have to send that part
of the command line "verbatim" to FFmpeg, so deal with your shell.

Of course the documentation could be improved, but I don't feel like doing
it :)

If you want to discuss such topic, you are welcome on ffmpeg-devel.

PS: sorry for the late reply.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20111122/560d9977/attachment.asc>


More information about the ffmpeg-user mailing list