[FFmpeg-user] '-t' versus '-to'
Jim DeLaHunt
list+ffmpeg-user at jdlh.com
Sat Jan 13 23:33:54 EET 2024
Mark:
On 2024-01-13 12:50, Mark Filipak wrote:
> What's the difference?
>
> -t duration (input/output)
> When used as an input option (before -i), limit the duration of
> data read from the input file.
> When used as an output option (before an output url),
> stop writing the output after its duration reaches duration.
> duration must be a time duration specification, see
> (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1)
> manual.
> -to and -t are mutually exclusive and -t has priority.
>
> -to position (input/output)
> Stop writing the output or reading the input at position.
> position must be a time duration specification, see
> (ffmpeg-utils)the Time duration section in the ffmpeg-utils(1)
> manual.
> -to and -t are mutually exclusive and -t has priority.
To be clear, I believe that the above two paragraphs are direct quotes
from the FFMpeg documentation, 5.4 Main options
<https://ffmpeg.org/ffmpeg-all.html#Main-options>.
> 'duration' and 'position' seem to both be duration. What's the
> difference?
That is a great question. The FFMpeg documentation should be clear about
the meanings of these parameters, and the difference between the
meanings of the terms "duration" and "position". It is not.
I do not see these terms defined outside of section 5.4. I see 95
occurrences of the word 'position' in
<https://ffmpeg.org/ffmpeg-all.html>. I count at least four meanings for
this term: a moment in the timeline of a media file's events; the x,y
coordinates of a pixel (more rigorously, the cartesian coordinates of a
point in the two-dimensional display space); the byte offset of a piece
of data in the data stream; and the index within a character string of a
data field. There are several parameters of various options and
filters, documented by the word "position", with no explanation of the
meaning FFMpeg assigns to the word.
> …'duration' and 'position' seem to both be duration.…
You use the word 'be'. Now technical writing is difficult, and I am not
an expert at it. But my non-expert opinion is that the English verb 'to
be' is often a poor choice for use in technical statements. The English
language makes 'to be' carry a wide range of meanings, so statements
using 'to be' might be unclear.
I would say, 'duration' and 'position' both take parameters having a
syntactical format of 'time duration' as specified in the
ffmpeg-utils(1) manual.
I am also not an FFmpeg expert. The true answer to your question
probably lies in reading the code. And the code itself may have
multiple, conflicting answers. But I will guess that 'duration' refers
to a portion of a media file timeline, and 'position' refers to a moment
in the media file timeline. They are perhaps analogous to 'line segment'
and 'point' in geometry. 'position' is perhaps that moment in the
timeline which occurs at the given timespan after the beginning of the
timeline, though it could be the moment which has the given time value
relative to time zero in the timeline.
Those are just my non-expert guesses. I will be interested to hear the
correct answer(s). And I wish we could look up those answer(s) in the
FFMpeg documentation.
Good question!
—Jim DeLaHunt
More information about the ffmpeg-user
mailing list