You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-11-23 21:54:53 +02:00
avconv: support -t as an input option.
It limits the duration of the data read from a given input.
This commit is contained in:
11
avconv.c
11
avconv.c
@@ -958,6 +958,7 @@ static int check_output_constraints(InputStream *ist, OutputStream *ost)
|
||||
static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *pkt)
|
||||
{
|
||||
OutputFile *of = output_files[ost->file_index];
|
||||
InputFile *f = input_files [ist->file_index];
|
||||
int64_t start_time = (of->start_time == AV_NOPTS_VALUE) ? 0 : of->start_time;
|
||||
int64_t ost_tb_start_time = av_rescale_q(start_time, AV_TIME_BASE_Q, ost->st->time_base);
|
||||
AVPacket opkt;
|
||||
@@ -974,6 +975,16 @@ static void do_streamcopy(InputStream *ist, OutputStream *ost, const AVPacket *p
|
||||
return;
|
||||
}
|
||||
|
||||
if (f->recording_time != INT64_MAX) {
|
||||
start_time = f->ctx->start_time;
|
||||
if (f->start_time != AV_NOPTS_VALUE)
|
||||
start_time += f->start_time;
|
||||
if (ist->last_dts >= f->recording_time + start_time) {
|
||||
ost->finished = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* force the input stream PTS */
|
||||
if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
audio_size += pkt->size;
|
||||
|
||||
Reference in New Issue
Block a user