[FFmpeg-devel] [FFmpeg-cvslog] ffmpeg: Implement support for seeking relative to EOF

Michael Niedermayer michael at niedermayer.cc
Wed Jul 29 19:02:06 CEST 2015


On Wed, Jul 29, 2015 at 06:22:04PM +0200, Clément Bœsch wrote:
> On Wed, Jul 29, 2015 at 05:32:14PM +0200, Michael Niedermayer wrote:
> > ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Mon Jul 27 04:30:26 2015 +0200| [f4ada6dc3ff7a5c4193d2b30151a48de8e219c94] | committer: Michael Niedermayer
> > 
> > ffmpeg: Implement support for seeking relative to EOF
> > 
> > Fixes Ticket227
> > 
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f4ada6dc3ff7a5c4193d2b30151a48de8e219c94
> > ---
> > 
> >  doc/ffmpeg.texi |    5 +++++
> >  ffmpeg.h        |    1 +
> >  ffmpeg_opt.c    |    6 ++++++
> >  3 files changed, 12 insertions(+)
> > 
> > diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
> > index 4d73788..3806a12 100644
> > --- a/doc/ffmpeg.texi
> > +++ b/doc/ffmpeg.texi
> > @@ -307,6 +307,11 @@ input until the timestamps reach @var{position}.
> >  
> >  @var{position} may be either in seconds or in @code{hh:mm:ss[.xxx]} form.
> >  
> > + at item -sseof @var{position} (@emph{input/output})
> > +
> > +Like the -ss option but relative to the "end of file". That is negative
> 
> nit: @code{-ss}

Fixed


> 
> > +values are earlier in the file, 0 is at EOF.
> > +
> 
> So mmh,, this works properly for both the duration of the input, and the
> duration of the output (respectively for -sseof as input and output
> option)

thats just copy an pasted, but does it not work?
If it doesnt ill take a look at if it can be made to work


> 
> >  @item -itsoffset @var{offset} (@emph{input})
> >  Set the input time offset.
> >  
> > diff --git a/ffmpeg.h b/ffmpeg.h
> > index a7e5e51..7467b16 100644
> > --- a/ffmpeg.h
> > +++ b/ffmpeg.h
> > @@ -92,6 +92,7 @@ typedef struct OptionsContext {
> >  
> >      /* input/output options */
> >      int64_t start_time;
> > +    int64_t start_time_eof;
> >      int seek_timestamp;
> >      const char *format;
> >  
> > diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> > index 3c9f98a..351c47b 100644
> > --- a/ffmpeg_opt.c
> > +++ b/ffmpeg_opt.c
> > @@ -156,6 +156,7 @@ static void init_options(OptionsContext *o)
> >      o->stop_time = INT64_MAX;
> >      o->mux_max_delay  = 0.7;
> >      o->start_time     = AV_NOPTS_VALUE;
> > +    o->start_time_eof = AV_NOPTS_VALUE;
> >      o->recording_time = INT64_MAX;
> >      o->limit_filesize = UINT64_MAX;
> >      o->chapters_input_file = INT_MAX;
> > @@ -933,6 +934,8 @@ static int open_input_file(OptionsContext *o, const char *filename)
> >          }
> >      }
> >  
> > +    if (o->start_time_eof != AV_NOPTS_VALUE && ic->duration>0)
> > +        o->start_time = o->start_time_eof + ic->duration;
> 
> You most likely want to print a warning about this having no effect when
> the duration can not be computed.

fixed

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150729/df79ccb6/attachment.sig>


More information about the ffmpeg-devel mailing list