static AVFormatContext *input_files[MAX_FILES];
static int64_t input_files_ts_offset[MAX_FILES];
+static double input_files_ts_scale[MAX_FILES][MAX_STREAMS];
static int nb_input_files = 0;
static AVFormatContext *output_files[MAX_FILES];
static float mux_preload= 0.5;
static float mux_max_delay= 0.7;
-static int64_t recording_time = 0;
+static int64_t recording_time = INT64_MAX;
static int64_t start_time = 0;
static int64_t rec_timestamp = 0;
static int64_t input_ts_offset = 0;
pkt.flags |= PKT_FLAG_KEY;
write_frame(s, &pkt, ost->st->codec, bitstream_filters[ost->file_index][pkt.stream_index]);
*frame_size = ret;
+ video_size += ret;
//fprintf(stderr,"\nFrame: %3d %3d size: %5d type: %d",
// enc->frame_number-1, enc->real_pict_num, ret,
// enc->pict_type);
break;
case CODEC_TYPE_VIDEO:
do_video_out(os, ost, ist, &picture, &frame_size);
- video_size += frame_size;
if (vstats_filename && frame_size)
do_video_stats(os, ost, frame_size);
break;
}
/* finish if recording time exhausted */
- if (recording_time > 0 && opts_min >= (recording_time / 1000000.0))
+ if (opts_min >= (recording_time / 1000000.0))
break;
/* finish if limit size exhausted */
if (pkt.pts != AV_NOPTS_VALUE)
pkt.pts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
+ if(input_files_ts_scale[file_index][pkt.stream_index]){
+ if(pkt.pts != AV_NOPTS_VALUE)
+ pkt.pts *= input_files_ts_scale[file_index][pkt.stream_index];
+ if(pkt.dts != AV_NOPTS_VALUE)
+ pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index];
+ }
+
// fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE) {
int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q);
m->in_file = strtol(p, &p, 0);
}
+static void opt_input_ts_scale(const char *arg)
+{
+ unsigned int stream;
+ double scale;
+ char *p;
+
+ stream = strtol(arg, &p, 0);
+ if (*p)
+ p++;
+ scale= strtod(p, &p);
+
+ if(stream >= MAX_STREAMS)
+ av_exit(1);
+
+ input_files_ts_scale[nb_input_files][stream]= scale;
+}
+
static int opt_recording_time(const char *opt, const char *arg)
{
recording_time = parse_time_or_die(opt, arg, 1);
{ "fs", HAS_ARG | OPT_INT64, {(void*)&limit_filesize}, "set the limit file size in bytes", "limit_size" }, //
{ "ss", OPT_FUNC2 | HAS_ARG, {(void*)opt_start_time}, "set the start time offset", "time_off" },
{ "itsoffset", OPT_FUNC2 | HAS_ARG, {(void*)opt_input_ts_offset}, "set the input ts offset", "time_off" },
+ { "itsscale", HAS_ARG, {(void*)opt_input_ts_scale}, "set the input ts scale", "stream:scale" },
{ "title", HAS_ARG | OPT_STRING, {(void*)&str_title}, "set the title", "string" },
{ "timestamp", OPT_FUNC2 | HAS_ARG, {(void*)&opt_rec_timestamp}, "set the timestamp", "time" },
{ "author", HAS_ARG | OPT_STRING, {(void*)&str_author}, "set the author", "string" },