[FFmpeg-user] Can transpose and between done in one command

Moritz Barsnick barsnick at gmx.net
Tue Sep 26 14:35:13 EEST 2023


Hi Cecil,

> In principle that would lead to a little better output video I think,
> because it is processed one time less. Or would it not make much
> difference?

Oh, yes, absolutely it would make a difference. Each (lossy) reencoding
is a loss in quality. Also, you could save a lot of time.

As the ffmpeg-filters docs say,
> Filters in the same linear chain are separated by commas, [...]

You're already doing this with "select,(a)setpts".

I would suggest selecting first, then transposing (which saves you from
transposing content which is later discarded), but it shouldn't matter.

I'm just not sure whether the t's in your select filter need to be
adapted, because you changed the video timestamps in the original
"first" step.

>             -vf "transpose=cclock"  \

>             -vf "
>                  select='between(t,   0.7,  13.0) +
>                          between(t,  26.0,  67.0) +
>                          between(t,  82.0,  87.2)',
>                   setpts=N/FRAME_RATE/TB
>             "                                       \
>             -af "
>                 aselect='between(t,   0.7,  13.0) +
>                          between(t,  26.0,  67.0) +
>                          between(t,  82.0,  87.2)',
>                  asetpts=N/SR/TB
>             "                                       \


So ultimately, your filters would be:

            -vf "
                 select='between(t,   0.7,  13.0) +
                         between(t,  26.0,  67.0) +
                         between(t,  82.0,  87.2)',
                 setpts=N/FRAME_RATE/TB,
                 transpose=cclock
            "                                       \
            -af "
                aselect='between(t,   0.7,  13.0) +
                         between(t,  26.0,  67.0) +
                         between(t,  82.0,  87.2)',
                 asetpts=N/SR/TB
            "

I'm not sure how you manage to collect content from 82.0 to 87.2 in a
59 second long video, but I may be missing something. ;-)

Cheers,
Moritz


More information about the ffmpeg-user mailing list