72 #if HAVE_SYS_RESOURCE_H
74 #include <sys/types.h>
75 #include <sys/resource.h>
76 #elif HAVE_GETPROCESSTIMES
79 #if HAVE_GETPROCESSMEMORYINFO
85 #include <sys/select.h>
90 #include <sys/ioctl.h>
136 #define DEFAULT_PASS_LOGFILENAME_PREFIX "ffmpeg2pass"
154 static struct termios oldtty;
155 static int restore_tty;
184 uint32_t *pal, *dst2;
192 if (r->
x < 0 || r->
x + r->
w > w || r->
y < 0 || r->
y + r->
h > h) {
197 dst += r->
y * dst_linesize + r->
x * 4;
200 for (y = 0; y < r->
h; y++) {
201 dst2 = (uint32_t *)dst;
203 for (x = 0; x < r->
w; x++)
204 *(dst2++) = pal[*(src2++)];
230 int64_t pts, end_pts;
247 "Impossible to get a blank canvas.\n");
250 dst = frame->
data [0];
252 for (i = 0; i < num_rects; i++)
276 if (pts2 <= ist2->sub2video.last_pts)
280 for (j = 0, nb_reqs = 0; j < ist2->
nb_filters; j++)
303 tcsetattr (0, TCSANOW, &oldtty);
335 istty = isatty(0) && isatty(2);
337 if (istty && tcgetattr (0, &tty) == 0) {
341 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
342 |INLCR|IGNCR|ICRNL|IXON);
343 tty.c_oflag |= OPOST;
344 tty.c_lflag &= ~(
ECHO|ECHONL|ICANON|IEXTEN);
345 tty.c_cflag &= ~(CSIZE|PARENB);
350 tcsetattr (0, TCSANOW, &tty);
377 n = select(1, &rfds, NULL, NULL, &tv);
386 # if HAVE_PEEKNAMEDPIPE
388 static HANDLE input_handle;
391 input_handle = GetStdHandle(STD_INPUT_HANDLE);
392 is_pipe = !GetConsoleMode(input_handle, &dw);
395 if (stdin->_cnt > 0) {
401 if (!PeekNamedPipe(input_handle, NULL, 0, NULL, &nchars, NULL)) {
433 printf(
"bench: maxrss=%ikB\n", maxrss);
573 printf(
"bench: %8"PRIu64
" %s \n", t -
current_time, buf);
584 ost2->
finished |= ost == ost2 ? this_stream : others;
630 bsf_arg ? bsf_arg->
value : NULL,
637 memcpy(t, new_pkt.
data, new_pkt.
size);
654 av_log(NULL,
AV_LOG_ERROR,
"Failed to open bitstream filter %s for stream %d with codec %s",
670 av_log(s,
AV_LOG_WARNING,
"Invalid DTS: %"PRId64
" PTS: %"PRId64
" in output stream %d:%d, replacing by guess\n",
683 if (pkt->
dts < max) {
685 av_log(s, loglevel,
"Non-monotonous DTS in output stream "
686 "%d:%d; previous: %"PRId64
", current: %"PRId64
"; ",
692 av_log(s, loglevel,
"changing to %"PRId64
". This may result "
693 "in incorrect timestamps in the output file.\n",
710 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n",
775 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
791 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
805 int subtitle_out_max_size = 1024 * 1024;
806 int subtitle_out_size, nb, i;
836 for (i = 0; i < nb; i++) {
837 unsigned save_num_rects = sub->
num_rects;
854 subtitle_out_max_size, sub);
857 if (subtitle_out_size < 0) {
864 pkt.
size = subtitle_out_size;
871 pkt.
pts += 90 * sub->start_display_time;
873 pkt.
pts += 90 * sub->end_display_time;
884 int ret, format_video_sync;
888 int nb_frames, nb0_frames, i;
889 double sync_ipts,
delta, delta0;
908 sync_ipts = next_picture->
pts;
937 double cor =
FFMIN(-delta0, duration);
944 switch (format_video_sync) {
946 if (ost->
frame_number == 0 && delta - duration >= 0.5) {
956 else if (delta > 1.1) {
957 nb_frames =
lrintf(delta);
959 nb0_frames =
lrintf(delta0 - 0.6);
965 else if (delta > 0.6)
977 nb0_frames =
FFMIN(nb0_frames, nb_frames);
981 "*** dropping frame %d from stream %d at ts %"PRId64
"\n",
984 if (nb_frames > (nb0_frames && ost->
last_droped) + (nb_frames > nb0_frames)) {
986 av_log(NULL,
AV_LOG_ERROR,
"%d frame duplication too large, skipping\n", nb_frames - 1);
996 for (i = 0; i < nb_frames; i++) {
1002 if (i < nb0_frames && ost->last_frame) {
1005 in_picture = next_picture;
1032 int got_packet, forced_keyframe = 0;
1055 forced_keyframe = 1;
1061 av_dlog(NULL,
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
1069 forced_keyframe = 1;
1080 if (forced_keyframe) {
1088 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
1105 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1117 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1122 frame_size = pkt.
size;
1151 return -10.0 * log(d) / log(10.0);
1158 double ti1, bitrate, avg_bitrate;
1183 avg_bitrate = (double)(ost->
data_size * 8) / ti1 / 1000.0;
1184 fprintf(
vstats_file,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
1185 (
double)ost->
data_size / 1024, ti1, bitrate, avg_bitrate);
1211 AVFrame *filtered_frame = NULL;
1238 "Error in av_buffersink_get_frame_flags(): %s\n",
av_err2str(ret));
1249 filtered_frame->
pts = frame_pts =
1258 filtered_frame->
pts = frame_pts;
1271 filtered_frame->
pts = frame_pts;
1275 "Audio filter graph output is not normalized and encoder does not support parameter changes\n");
1294 uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
1295 uint64_t subtitle_size = 0;
1296 uint64_t data_size = 0;
1297 float percent = -1.0;
1306 default: other_size += ost->
data_size;
break;
1312 if (data_size && total_size>0 && total_size >= data_size)
1313 percent = 100.0 * (total_size - data_size) / data_size;
1315 av_log(NULL,
AV_LOG_INFO,
"video:%1.0fkB audio:%1.0fkB subtitle:%1.0fkB other streams:%1.0fkB global headers:%1.0fkB muxing overhead: ",
1316 video_size / 1024.0,
1317 audio_size / 1024.0,
1318 subtitle_size / 1024.0,
1319 other_size / 1024.0,
1320 extra_size / 1024.0);
1330 uint64_t total_packets = 0, total_size = 0;
1359 total_packets, total_size);
1364 uint64_t total_packets = 0, total_size = 0;
1393 total_packets, total_size);
1395 if(video_size + data_size + audio_size + subtitle_size + extra_size == 0){
1396 av_log(NULL,
AV_LOG_WARNING,
"Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)\n");
1403 AVBPrint buf_script;
1408 int frame_number, vid, i;
1410 int64_t pts = INT64_MIN;
1411 static int64_t last_time = -1;
1412 static int qp_histogram[52];
1413 int hours, mins, secs, us;
1415 if (!
print_stats && !is_last_report && !progress_avio)
1418 if (!is_last_report) {
1419 if (last_time == -1) {
1423 if ((cur_time - last_time) < 500000)
1429 oc = output_files[0]->
ctx;
1432 if (total_size <= 0)
1440 ost = output_streams[i];
1445 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"q=%2.1f ", q);
1446 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1450 float fps, t = (cur_time-timer_start) / 1000000.0;
1453 fps = t > 1 ? frame_number / t : 0;
1454 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"frame=%5d fps=%3.*f q=%3.1f ",
1455 frame_number, fps < 9.95, fps, q);
1456 av_bprintf(&buf_script,
"frame=%d\n", frame_number);
1458 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1461 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"L");
1467 for (j = 0; j < 32; j++)
1468 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%X", (
int)
lrintf(
log2(qp_histogram[j] + 1)));
1472 double error, error_sum = 0;
1473 double scale, scale_sum = 0;
1475 char type[3] = {
'Y',
'U',
'V' };
1476 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"PSNR=");
1477 for (j = 0; j < 3; j++) {
1478 if (is_last_report) {
1479 error = enc->
error[j];
1480 scale = enc->
width * enc->
height * 255.0 * 255.0 * frame_number;
1489 p =
psnr(error / scale);
1490 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"%c:%2.2f ", type[j], p);
1491 av_bprintf(&buf_script,
"stream_%d_%d_psnr_%c=%2.2f\n",
1494 p =
psnr(error_sum / scale_sum);
1495 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
"*:%2.2f ",
psnr(error_sum / scale_sum));
1496 av_bprintf(&buf_script,
"stream_%d_%d_psnr_all=%2.2f\n",
1516 bitrate = pts && total_size >= 0 ? total_size * 8 / (pts / 1000.0) : -1;
1518 if (total_size < 0)
snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1520 else snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1521 "size=%8.0fkB time=", total_size / 1024.0);
1522 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1523 "%02d:%02d:%02d.%02d ", hours, mins, secs,
1525 if (bitrate < 0)
snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1527 else snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
1528 "bitrate=%6.1fkbits/s", bitrate);
1529 if (total_size < 0)
av_bprintf(&buf_script,
"total_size=N/A\n");
1530 else av_bprintf(&buf_script,
"total_size=%"PRId64
"\n", total_size);
1531 av_bprintf(&buf_script,
"out_time_ms=%"PRId64
"\n", pts);
1532 av_bprintf(&buf_script,
"out_time=%02d:%02d:%02d.%06d\n",
1533 hours, mins, secs, us);
1536 snprintf(buf + strlen(buf),
sizeof(buf) - strlen(buf),
" dup=%d drop=%d",
1542 const char end = is_last_report ?
'\n' :
'\r';
1544 fprintf(stderr,
"%s %c", buf, end);
1551 if (progress_avio) {
1553 is_last_report ?
"end" :
"continue");
1555 FFMIN(buf_script.len, buf_script.size - 1));
1558 if (is_last_report) {
1560 progress_avio = NULL;
1576 int stop_encoding = 0;
1612 ret = encode(enc, &pkt, NULL, &got_packet);
1630 pkt_size = pkt.
size;
1718 opkt.
dts -= ost_tb_start_time;
1739 &opkt.data, &opkt.size,
1754 avpicture_fill(&pict, opkt.data, ost->st->codec->pix_fmt, ost->st->codec->width, ost->st->codec->height);
1768 char layout_name[256];
1787 int i,
ret, err = 0, resample_changed;
1805 if (*got_output || ret<0 || pkt->
size)
1808 if (!*got_output || ret < 0) {
1836 if (resample_changed) {
1837 char layout1[64], layout2[64];
1841 "layout for Input Stream #%d.%d\n", ist->
file_index,
1853 "Input stream #%d:%d frame changed from rate:%d fmt:%s ch:%d chl:%s to rate:%d fmt:%s ch:%d chl:%s\n",
1884 decoded_frame->
pts = pkt->
pts;
1887 decoded_frame->
pts = ist->
dts;
1895 for (i = 0; i < ist->nb_filters; i++) {
1896 if (i < ist->nb_filters - 1) {
1897 f = ist->filter_frame;
1914 return err < 0 ? err :
ret;
1920 int i,
ret = 0, err = 0, resample_changed;
1921 int64_t best_effort_timestamp;
1933 decoded_frame, got_output, pkt);
1944 "has_b_frames is larger in decoder than demuxer %d > %d ",
1950 if (*got_output || ret<0 || pkt->
size)
1953 if (*got_output && ret >= 0) {
1957 av_log(NULL,
AV_LOG_DEBUG,
"Frame parameters mismatch context %d,%d,%d != %d,%d,%d\n",
1958 decoded_frame->
width,
1967 if (!*got_output || ret < 0) {
1997 "frame_pts:%s frame_pts_time:%s best_effort_ts:%"PRId64
" best_effort_ts_time:%s keyframe:%d frame_type:%d time_base:%d/%d\n",
2000 best_effort_timestamp,
2014 if (resample_changed) {
2016 "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
2036 if (!frame_sample_aspect->
num)
2039 if (i < ist->nb_filters - 1) {
2049 }
else if (ret < 0) {
2051 "Failed to inject frame into filter network: %s\n",
av_err2str(ret));
2059 return err < 0 ? err :
ret;
2066 &subtitle, got_output, pkt);
2068 if (*got_output || ret<0 || pkt->
size)
2071 if (ret < 0 || !*got_output) {
2082 if (end < ist->prev_sub.subtitle.end_display_time) {
2084 "Subtitle duration reduced from %d to %d%s\n",
2086 end <= 0 ?
", dropping it" :
"");
2171 "Multiple frames in a packet from stream %d\n", pkt->
stream_index);
2222 if (got_output && !pkt)
2274 avc[i] = output_files[i]->ctx;
2277 printf(
"SDP:\n%s\n", sdp);
2286 if (
hwaccels[i].pix_fmt == pix_fmt)
2297 for (p = pix_fmts; *p != -1; p++) {
2310 ret = hwaccel->
init(s);
2314 "%s hwaccel requested for input stream #%d:%d, "
2315 "but cannot be initialized.\n", hwaccel->
name,
2347 snprintf(error, error_len,
"Decoder (codec %s) not found for input stream #%d:%d",
2362 av_log(NULL,
AV_LOG_WARNING,
"Warning using DVB subtitles for filtering and output at the same time is not fully supported, also see -compute_edt [0|1]\n");
2372 "Error while opening decoder for input stream "
2395 int64_t va = *(int64_t *)a, vb = *(int64_t *)
b;
2396 return va < vb ? -1 : va > vb ? +1 : 0;
2406 for (p = kf; *p; p++)
2417 for (i = 0; i <
n; i++) {
2418 char *next = strchr(p,
',');
2423 if (!memcmp(p,
"chapters", 8)) {
2432 "Could not allocate forced key frames array.\n");
2464 InputFile *file = input_files[input_index];
2470 "New %s stream %d:%d at pos:%"PRId64
" and DTS:%ss\n",
2482 int encoder_string_len;
2483 int format_flags = 0;
2505 encoder_string =
av_mallocz(encoder_string_len);
2506 if (!encoder_string)
2512 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
2520 int ret = 0, i, j, k;
2536 if (fg->
inputs[0]->
ist == input_streams[k])
2552 oc = output_files[i]->
ctx;
2569 ost = output_streams[i];
2597 uint64_t extra_size;
2603 if (extra_size > INT_MAX) {
2612 unsigned int codec_tag;
2659 if( copy_tb<0 && dec_ctx->time_base.den
2707 av_log(NULL,
AV_LOG_FATAL,
"-acodec copy and -vol are incompatible (frames are not decoded)\n");
2717 #if FF_API_AUDIOENC_DELAY
2735 "with stream copy may produce invalid files\n");
2759 snprintf(error,
sizeof(error),
"Encoder (codec %s) not found for output stream #%d:%d",
2793 "about the input framerate is available. Falling "
2794 "back to a default value of 25fps for output stream #%d:%d. Use the -r option "
2795 "if you want a different framerate.\n",
2809 switch (enc_ctx->codec_type) {
2815 enc_ctx->time_base = (
AVRational){ 1, enc_ctx->sample_rate };
2819 if (ost->
filter && !(enc_ctx->time_base.num && enc_ctx->time_base.den))
2824 "Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
2829 enc_ctx->time_base);
2837 if (!strncmp(ost->
enc->
name,
"libx264", 7) &&
2841 "No pixel format specified, %s for H.264 encoding chosen.\n"
2842 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2844 if (!strncmp(ost->
enc->
name,
"mpeg2video", 10) &&
2848 "No pixel format specified, %s for MPEG-2 encoding chosen.\n"
2849 "Use -pix_fmt yuv420p for compatibility with outdated media players.\n",
2882 if (!enc_ctx->width) {
2893 char logfilename[1024];
2896 snprintf(logfilename,
sizeof(logfilename),
"%s-%d.log",
2900 if (!strcmp(ost->
enc->
name,
"libx264")) {
2905 size_t logbuffer_size;
2911 enc_ctx->stats_in = logbuffer;
2917 logfilename, strerror(errno));
2929 ost = output_streams[i];
2930 if (ost->encoding_needed) {
2939 if (!ost->enc_ctx->subtitle_header) {
2946 if (!
av_dict_get(ost->encoder_opts,
"threads", NULL, 0))
2947 av_dict_set(&ost->encoder_opts,
"threads",
"auto", 0);
2948 av_dict_set(&ost->encoder_opts,
"side_data_only_packets",
"1", 0);
2953 snprintf(error,
sizeof(error),
"Error while opening encoder for output stream #%d:%d - maybe incorrect parameters such as bit_rate, rate, width or height",
2954 ost->file_index, ost->index);
2960 ost->enc_ctx->frame_size);
2962 if (ost->enc_ctx->bit_rate && ost->enc_ctx->bit_rate < 1000)
2964 " It takes bits/s as argument, not kbits/s\n");
2969 "Error setting up codec context options.\n");
2977 "Error initializing the output stream codec context.\n");
2980 ost->st->codec->codec= ost->enc_ctx->codec;
2990 ost = output_streams[i];
3014 oc = output_files[i]->
ctx;
3018 "Could not write header for output file #%d "
3019 "(incorrect codec parameters ?): %s",
3025 if (strcmp(oc->oformat->name,
"rtp")) {
3034 av_dump_format(output_files[i]->ctx, i, output_files[i]->ctx->filename, 1);
3040 ist = input_streams[i];
3042 for (j = 0; j < ist->nb_filters; j++) {
3043 if (ist->filters[j]->graph->graph_desc) {
3045 ist->file_index, ist->st->index, ist->dec ? ist->dec->name :
"?",
3046 ist->filters[j]->name);
3055 ost = output_streams[i];
3057 if (ost->attachment_filename) {
3060 ost->attachment_filename, ost->file_index, ost->index);
3064 if (ost->filter && ost->filter->graph->graph_desc) {
3071 ost->index, ost->enc ? ost->enc->name :
"?");
3076 input_streams[ost->source_index]->
file_index,
3077 input_streams[ost->source_index]->
st->
index,
3080 if (ost->sync_ist != input_streams[ost->source_index])
3082 ost->sync_ist->file_index,
3083 ost->sync_ist->st->index);
3084 if (ost->stream_copy)
3087 const AVCodec *in_codec = input_streams[ost->source_index]->
dec;
3088 const AVCodec *out_codec = ost->enc;
3089 const char *decoder_name =
"?";
3090 const char *in_codec_name =
"?";
3091 const char *encoder_name =
"?";
3092 const char *out_codec_name =
"?";
3095 decoder_name = in_codec->
name;
3097 if (!strcmp(decoder_name, in_codec_name))
3098 decoder_name =
"native";
3102 encoder_name = out_codec->
name;
3104 if (!strcmp(encoder_name, out_codec_name))
3105 encoder_name =
"native";
3109 in_codec_name, decoder_name,
3110 out_codec_name, encoder_name);
3163 int64_t opts_min = INT64_MAX;
3170 if (!ost->
finished && opts < opts_min) {
3181 static int64_t last_time;
3204 if (key ==
'c' || key ==
'C'){
3208 fprintf(stderr,
"\nEnter command: <target>|all <time>|-1 <command>[ <argument>]\n");
3210 while ((k =
read_key()) !=
'\n' && k !=
'\r' && i <
sizeof(buf)-1)
3215 (n = sscanf(buf,
"%63[^ ] %lf %255[^ ] %255[^\n]", target, &time, command, arg)) >= 3) {
3217 target, time, command, arg);
3224 fprintf(stderr,
"Command reply for stream %d: ret:%d res:\n%s", i, ret, buf);
3225 }
else if (key ==
'c') {
3226 fprintf(stderr,
"Queing commands only on filters supporting the specific command is unsupported\n");
3235 "Parse error, at least 3 arguments were expected, "
3236 "only %d given in string '%s'\n", n, buf);
3239 if (key ==
'd' || key ==
'D'){
3243 if(!debug) debug = 1;
3247 if(scanf(
"%d", &debug)!=1)
3248 fprintf(stderr,
"error parsing debug value\n");
3257 fprintf(stderr,
"debug=%d\n", debug);
3260 fprintf(stderr,
"key function\n"
3261 "? show this help\n"
3262 "+ increase verbosity\n"
3263 "- decrease verbosity\n"
3264 "c Send command to first matching filter supporting it\n"
3265 "C Send/Que command to all matching filters\n"
3266 "D cycle through available debug modes\n"
3267 "h dump packets/hex press to cycle through the 3 states\n"
3269 "s Show QP histogram\n"
3276 static void *input_thread(
void *
arg)
3298 "Unable to send packet to main thread: %s\n",
3317 if (!f->in_thread_queue)
3329 static int init_input_threads(
void)
3333 if (nb_input_files == 1)
3341 f->non_blocking = 1;
3348 av_log(NULL,
AV_LOG_ERROR,
"pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(ret));
3378 if (nb_input_files > 1)
3379 return get_input_packet_mt(f, pkt);
3388 if (output_streams[i]->unavailable)
3397 input_files[i]->eagain = 0;
3399 output_streams[i]->unavailable = 0;
3411 InputFile *ifile = input_files[file_index];
3432 ist = input_streams[ifile->
ist_index + i];
3463 goto discard_packet;
3472 goto discard_packet;
3476 "next_dts:%s next_dts_time:%s next_pts:%s next_pts_time:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3487 int64_t stime, stime2;
3494 int64_t new_start_time = INT64_MAX;
3536 memcpy(dst_data, src_sd->
data, src_sd->
size);
3560 "Inter stream timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3580 "timestamp discontinuity %"PRId64
", new offset= %"PRId64
"\n",
3608 av_log(NULL,
AV_LOG_INFO,
"demuxer+ffmpeg -> ist_index:%d type:%s pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s off:%s off_time:%s\n",
3642 int nb_requests, nb_requests_max = 0;
3660 for (i = 0; i < graph->
nb_inputs; i++) {
3661 ifilter = graph->
inputs[i];
3667 if (nb_requests > nb_requests_max) {
3668 nb_requests_max = nb_requests;
3733 int64_t timer_start;
3746 if ((ret = init_input_threads()) < 0)
3782 ist = input_streams[i];
3793 os = output_files[i]->
ctx;
3802 ost = output_streams[i];
3810 ist = input_streams[i];
3826 if (output_streams) {
3828 ost = output_streams[i];
3850 struct rusage rusage;
3852 getrusage(RUSAGE_SELF, &rusage);
3853 return (rusage.ru_utime.tv_sec * 1000000LL) + rusage.ru_utime.tv_usec;
3854 #elif HAVE_GETPROCESSTIMES
3856 FILETIME
c, e, k,
u;
3857 proc = GetCurrentProcess();
3858 GetProcessTimes(proc, &c, &e, &k, &u);
3859 return ((int64_t) u.dwHighDateTime << 32 | u.dwLowDateTime) / 10;
3867 #if HAVE_GETRUSAGE && HAVE_STRUCT_RUSAGE_RU_MAXRSS
3868 struct rusage rusage;
3869 getrusage(RUSAGE_SELF, &rusage);
3870 return (int64_t)rusage.ru_maxrss * 1024;
3871 #elif HAVE_GETPROCESSMEMORYINFO
3873 PROCESS_MEMORY_COUNTERS memcounters;
3874 proc = GetCurrentProcess();
3875 memcounters.cb =
sizeof(memcounters);
3876 GetProcessMemoryInfo(proc, &memcounters,
sizeof(memcounters));
3877 return memcounters.PeakPagefileUsage;
3894 setvbuf(stderr,NULL,_IONBF,0);
3899 if(argc>1 && !strcmp(argv[1],
"-d")){
3923 if (nb_output_files <= 0 && nb_input_files == 0) {
3930 if (nb_output_files <= 0) {
3945 printf(
"bench: utime=%0.3fs\n", ti / 1000000.0);
3947 av_log(NULL,
AV_LOG_DEBUG,
"%"PRIu64
" frames successfully decoded, %"PRIu64
" decoding errors\n",