Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#61 closed enhancement (fixed)

ability to read video size during filtergraph operation

Reported by: Hanspeter Niederstrasser Owned by: Michael Niedermayer
Priority: wish Component: avfilter
Version: git Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: yes

Description

While running a video through a filtergraph, I needed to know the size of the video. However, I could not find a way to read the size of the video at that point in time.

-vf "scale=${OUTWIDTH}:-1 [small] ; movie=${WATERMARK_FILE} [wm] ; [small][wm] overlay=main_w-overlay_w-10:10 [tagged] ; [tagged] pad=${OUTWIDTH}:${OUTHEIGHT}:0:(${OUTHEIGHT}-in_w)/2"

This is the filtergraph I was using. My goal is to take several videos with different sizes and aspect ratios, shrink them all to a fixed width, and then add padding as necessary to give them all the same height. Because the scaled video will have varying height dimensions, I need to determine the height value before I can calculate the padding value. The 'crop' filter has "in_w" and "in_h" to provide the current values of the video, but these parameters don't seem to be available in the 'pad' filter.

So it would be great to either

1) have the 'pad' filter have in_w and in_h made available

or

2) more generalizable, have a 'filter' that returns the dimension values of the video so it can be fed into an expression for evaluation and use in other filters in the filtergraph.

Change History (3)

in reply to:  description ; comment:1 by Stefano Sabatini, 11 years ago

Replying to nieder:
[...]

So it would be great to either

1) have the 'pad' filter have in_w and in_h made available

This was already implemented.

or

2) more generalizable, have a 'filter' that returns the dimension values of the video so it can be fed into an expression for evaluation and use in other filters in the filtergraph.

I don't know how to interpret this description and I'm not sure this is even possible.

Please close the ticket if you're fine with solution 1.

in reply to:  1 comment:2 by Stefano Sabatini, 11 years ago

Analyzed by developer: set
Resolution: fixed
Status: newclosed

Replying to saste:

Replying to nieder:
[...]

So it would be great to either

1) have the 'pad' filter have in_w and in_h made available

This was already implemented.

or

2) more generalizable, have a 'filter' that returns the dimension values of the video so it can be fed into an expression for evaluation and use in other filters in the filtergraph.

I don't know how to interpret this description and I'm not sure this is even possible.

Please close the ticket if you're fine with solution 1.

comment:3 by Hanspeter Niederstrasser, 11 years ago

1) in_w and in_h works now on pad, even with the same git revision that I had when I filed the report. I don't know what happened there, so ignore that part of the report.

2) Is the new filter "showinfo" supposed to be the one that does this now?

Note: See TracTickets for help on using tickets.