You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-16 22:42:38 +02:00
ffmpeg: add option not to offset seek position by start time
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@ -1158,6 +1158,13 @@ This option enables or disables accurate seeking in input files with the
|
|||||||
transcoding. Use @option{-noaccurate_seek} to disable it, which may be useful
|
transcoding. Use @option{-noaccurate_seek} to disable it, which may be useful
|
||||||
e.g. when copying some streams and transcoding the others.
|
e.g. when copying some streams and transcoding the others.
|
||||||
|
|
||||||
|
@item -seek_timestamp (@emph{input})
|
||||||
|
This option enables or disables seeking by timestamp in input files with the
|
||||||
|
@option{-ss} option. It is disabled by default. If enabled, the argument
|
||||||
|
to the @option{-ss} option is considered an actual timestamp, and is not
|
||||||
|
offset by the start time of the file. This matters only for files which do
|
||||||
|
not start from timestamp 0, such as transport streams.
|
||||||
|
|
||||||
@item -thread_queue_size @var{size} (@emph{input})
|
@item -thread_queue_size @var{size} (@emph{input})
|
||||||
This option sets the maximum number of queued packets when reading from the
|
This option sets the maximum number of queued packets when reading from the
|
||||||
file or device. With low latency / high rate live streams, packets may be
|
file or device. With low latency / high rate live streams, packets may be
|
||||||
|
2
ffmpeg.h
2
ffmpeg.h
@ -92,6 +92,7 @@ typedef struct OptionsContext {
|
|||||||
|
|
||||||
/* input/output options */
|
/* input/output options */
|
||||||
int64_t start_time;
|
int64_t start_time;
|
||||||
|
int seek_timestamp;
|
||||||
const char *format;
|
const char *format;
|
||||||
|
|
||||||
SpecifierOpt *codec_names;
|
SpecifierOpt *codec_names;
|
||||||
@ -339,6 +340,7 @@ typedef struct InputFile {
|
|||||||
int64_t ts_offset;
|
int64_t ts_offset;
|
||||||
int64_t last_ts;
|
int64_t last_ts;
|
||||||
int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
|
int64_t start_time; /* user-specified start time in AV_TIME_BASE or AV_NOPTS_VALUE */
|
||||||
|
int seek_timestamp;
|
||||||
int64_t recording_time;
|
int64_t recording_time;
|
||||||
int nb_streams; /* number of stream that ffmpeg is aware of; may be different
|
int nb_streams; /* number of stream that ffmpeg is aware of; may be different
|
||||||
from ctx.nb_streams if new streams appear during av_read_frame() */
|
from ctx.nb_streams if new streams appear during av_read_frame() */
|
||||||
|
@ -919,7 +919,7 @@ static int open_input_file(OptionsContext *o, const char *filename)
|
|||||||
|
|
||||||
timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time;
|
timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time;
|
||||||
/* add the stream start time */
|
/* add the stream start time */
|
||||||
if (ic->start_time != AV_NOPTS_VALUE)
|
if (!o->seek_timestamp && ic->start_time != AV_NOPTS_VALUE)
|
||||||
timestamp += ic->start_time;
|
timestamp += ic->start_time;
|
||||||
|
|
||||||
/* if seeking requested, we execute it */
|
/* if seeking requested, we execute it */
|
||||||
@ -2865,6 +2865,9 @@ const OptionDef options[] = {
|
|||||||
{ "ss", HAS_ARG | OPT_TIME | OPT_OFFSET |
|
{ "ss", HAS_ARG | OPT_TIME | OPT_OFFSET |
|
||||||
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
|
OPT_INPUT | OPT_OUTPUT, { .off = OFFSET(start_time) },
|
||||||
"set the start time offset", "time_off" },
|
"set the start time offset", "time_off" },
|
||||||
|
{ "seek_timestamp", HAS_ARG | OPT_INT | OPT_OFFSET |
|
||||||
|
OPT_INPUT, { .off = OFFSET(seek_timestamp) },
|
||||||
|
"enable/disable seeking by timestamp with -ss" },
|
||||||
{ "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
|
{ "accurate_seek", OPT_BOOL | OPT_OFFSET | OPT_EXPERT |
|
||||||
OPT_INPUT, { .off = OFFSET(accurate_seek) },
|
OPT_INPUT, { .off = OFFSET(accurate_seek) },
|
||||||
"enable/disable accurate seeking with -ss" },
|
"enable/disable accurate seeking with -ss" },
|
||||||
|
Reference in New Issue
Block a user