[FFmpeg-user] Multiple Seeks (-ss/-t) in one file

Nicolas George nicolas.george at normalesup.org
Thu Nov 15 13:07:09 CET 2012


Le quartidi 24 brumaire, an CCXXI, Mr M a écrit :
> I read online that you can do multiple of these if you do ffmpeg -i
> INPUT -ss VALUE -t VALUE CODEC_PARAMTERS OUTPUTNAME then start all
> over again with -i INPUT.

You will get several files.

Unfortunately, the concat filter can not be used here because the -t option
applies after the filters.

There are enhancements possible in that area, I have some on my TODO list,
but they will not come immediately.

> The problem is I read you should always put -ss before -i otherwise if
> -ss is 08:00:00 for example, the encoding will take 8 hours cause the
> entire file is loaded.

This is so much over-simplified that it has become completely wrong.

The truth is: -ss behaves differently whether it is on the input (before -i)
or on the output (after -i).

On the input, it uses seeking: it is usually very fast, but not very
accurate because it needs to jump to a key frame. Also, with some protocols
or formats, it is very inaccurate or does not work at all.

On the output, it use skipping: frames are decoded and then discarded until
the requested time. This is much slower (but usually faster than real-time,
still), but much more accurate.

Both can be combined; in that case, the output -ss is relative to the point
requested by the input -ss.

For your case, you could probably use pipes: for each segment you want,
start a ffmpeg instance encoding to rawvideo+pcm in nut format into a pipe,
and start a global ffmpeg instance to concatenate and encode everything.
There are other variants on this solution, depending on the specifics of the
problem.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-user/attachments/20121115/a9543502/attachment.asc>


More information about the ffmpeg-user mailing list