[FFmpeg-trac] #1520(undetermined:new): allow mathematical expressions for -t and -ss
FFmpeg
trac at avcodec.org
Tue Jul 10 19:20:48 CEST 2012
#1520: allow mathematical expressions for -t and -ss
-------------------------------------+-------------------------------------
Reporter: dericed | Owner:
Type: enhancement | Status: new
Priority: normal | Component:
Version: unspecified | undetermined
Keywords: | Resolution:
Blocking: | Blocked By:
Analyzed by developer: 0 | Reproduced by developer: 0
-------------------------------------+-------------------------------------
Comment (by Cigaes):
I see three separate issues here:
First, the possibility of putting mathematical expressions in the -t
option. In the example you show, you can just let the shell do the work:
{{{./ffmpeg -t $(printf %.6f $[1001/30000.]) -f lavfi -i aevalsrc=0 -c:a
pcm_s16le out.wav}}}
works just fine (and we could easily do away with the printf for the
rounding). Of course, it does not work if you want to use in the formula
values that come from the input file. That is the reason for the formulas
in most filters: you can make them depend on the input video size or
whatever.
Second, the accuracy of the time. It is completely unrelated to the way
the time is parsed. Unless you are dealing with a recording with a sample
rate beyond the megahertz, six decimal places is plenty enough.
Third, your problems getting the exact duration you request. This is in
fact a completely unrelated issue. If you examine your output file, you
can notice that it has exactly 2048 samples. The reason is that
{{{aevalsrc}}} always outputs samples 1024 at a time, and ffmpeg does not
change the grouping to adjust for the -t option. The immediate solution
for that is to select a frame size that will fit your selected number of
samples. In this particular case, {{{n=1471}}} and {{{-t 0.033356}}} work
perfectly. There is room for enhancement here too.
--
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/1520#comment:1>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list