33 #include <stdatomic.h>
73 #if HAVE_SYS_RESOURCE_H
75 #include <sys/types.h>
76 #include <sys/resource.h>
77 #elif HAVE_GETPROCESSTIMES
80 #if HAVE_GETPROCESSMEMORYINFO
84 #if HAVE_SETCONSOLECTRLHANDLER
90 #include <sys/select.h>
95 #include <sys/ioctl.h>
163 static struct termios oldtty;
164 static int restore_tty;
168 static void free_input_threads(
void);
194 uint32_t *pal, *dst2;
202 if (
r->x < 0 ||
r->x +
r->w >
w ||
r->y < 0 ||
r->y +
r->h >
h) {
204 r->x,
r->y,
r->w,
r->h,
w,
h
209 dst +=
r->y * dst_linesize +
r->x * 4;
211 pal = (uint32_t *)
r->data[1];
212 for (y = 0; y <
r->h; y++) {
213 dst2 = (uint32_t *)dst;
215 for (x = 0; x <
r->w; x++)
216 *(dst2++) = pal[*(src2++)];
218 src +=
r->linesize[0];
246 int64_t
pts, end_pts;
268 "Impossible to get a blank canvas.\n");
271 dst =
frame->data [0];
272 dst_linesize =
frame->linesize[0];
273 for (
i = 0;
i < num_rects;
i++)
298 if (pts2 <= ist2->sub2video.last_pts)
305 for (j = 0, nb_reqs = 0; j < ist2->
nb_filters; j++)
332 tcsetattr (0, TCSANOW, &oldtty);
356 ret = write(2,
"Received > 3 system signals, hard exiting\n",
357 strlen(
"Received > 3 system signals, hard exiting\n"));
363 #if HAVE_SETCONSOLECTRLHANDLER
364 static BOOL WINAPI CtrlHandler(DWORD fdwCtrlType)
371 case CTRL_BREAK_EVENT:
375 case CTRL_CLOSE_EVENT:
376 case CTRL_LOGOFF_EVENT:
377 case CTRL_SHUTDOWN_EVENT:
400 if (tcgetattr (0, &tty) == 0) {
404 tty.c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
405 |INLCR|IGNCR|ICRNL|IXON);
406 tty.c_oflag |= OPOST;
407 tty.c_lflag &= ~(
ECHO|ECHONL|ICANON|IEXTEN);
408 tty.c_cflag &= ~(CSIZE|PARENB);
413 tcsetattr (0, TCSANOW, &tty);
425 signal(SIGPIPE, SIG_IGN);
427 #if HAVE_SETCONSOLECTRLHANDLER
428 SetConsoleCtrlHandler((PHANDLER_ROUTINE) CtrlHandler, TRUE);
445 n = select(1, &rfds,
NULL,
NULL, &tv);
454 # if HAVE_PEEKNAMEDPIPE
456 static HANDLE input_handle;
459 input_handle = GetStdHandle(STD_INPUT_HANDLE);
460 is_pipe = !GetConsoleMode(input_handle, &dw);
465 if (!PeekNamedPipe(input_handle,
NULL, 0,
NULL, &nchars,
NULL)) {
518 &sub,
sizeof(sub),
NULL);
579 ost->audio_channels_mapped = 0;
587 if (
ost->muxing_queue) {
599 free_input_threads();
625 "Error closing vstats file, loss of information possible: %s\n",
684 "bench: %8" PRIu64
" user %8" PRIu64
" sys %8" PRIu64
" real %s \n",
698 ost2->
finished |=
ost == ost2 ? this_stream : others;
717 if (
ost->frame_number >=
ost->max_frames) {
729 ost->max_muxing_queue_size);
732 "Too many packets buffered for output stream %d:%d.\n",
766 if (
ost->frame_rate.num &&
ost->is_cfr) {
780 av_log(
s,
AV_LOG_WARNING,
"Invalid DTS: %"PRId64
" PTS: %"PRId64
" in output stream %d:%d, replacing by guess\n",
797 av_log(
s, loglevel,
"Non-monotonous DTS in output stream "
798 "%d:%d; previous: %"PRId64
", current: %"PRId64
"; ",
804 av_log(
s, loglevel,
"changing to %"PRId64
". This may result "
805 "in incorrect timestamps in the output file.\n",
816 ost->packets_written++;
822 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s size:%d\n",
881 "packet for stream #%d:%d.\n",
ost->file_index,
ost->
index);
917 ost->samples_encoded +=
frame->nb_samples;
918 ost->frames_encoded++;
924 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
946 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
964 int subtitle_out_max_size = 1024 * 1024;
965 int subtitle_out_size, nb,
i;
999 for (
i = 0;
i < nb;
i++) {
1000 unsigned save_num_rects = sub->
num_rects;
1014 ost->frames_encoded++;
1017 subtitle_out_max_size, sub);
1020 if (subtitle_out_size < 0) {
1048 int ret, format_video_sync;
1053 int nb_frames, nb0_frames,
i;
1054 double delta, delta0;
1060 if (
ost->source_index >= 0)
1064 if (frame_rate.
num > 0 && frame_rate.
den > 0)
1070 if (!
ost->filters_script &&
1079 if (!next_picture) {
1081 nb0_frames = nb_frames =
mid_pred(
ost->last_nb0_frames[0],
1082 ost->last_nb0_frames[1],
1083 ost->last_nb0_frames[2]);
1085 delta0 = sync_ipts -
ost->sync_opts;
1114 if (delta0 < -0.6) {
1118 sync_ipts =
ost->sync_opts;
1123 switch (format_video_sync) {
1125 if (
ost->frame_number == 0 && delta0 >= 0.5) {
1135 }
else if (
delta < -1.1)
1137 else if (
delta > 1.1) {
1140 nb0_frames =
llrintf(delta0 - 0.6);
1146 else if (
delta > 0.6)
1158 nb_frames =
FFMIN(nb_frames,
ost->max_frames -
ost->frame_number);
1159 nb0_frames =
FFMIN(nb0_frames, nb_frames);
1161 memmove(
ost->last_nb0_frames + 1,
1162 ost->last_nb0_frames,
1164 ost->last_nb0_frames[0] = nb0_frames;
1166 if (nb0_frames == 0 &&
ost->last_dropped) {
1169 "*** dropping frame %d from stream %d at ts %"PRId64
"\n",
1172 if (nb_frames > (nb0_frames &&
ost->last_dropped) + (nb_frames > nb0_frames)) {
1178 nb_frames_dup += nb_frames - (nb0_frames &&
ost->last_dropped) - (nb_frames > nb0_frames);
1185 ost->last_dropped = nb_frames == nb0_frames && next_picture;
1188 for (
i = 0;
i < nb_frames;
i++) {
1190 int forced_keyframe = 0;
1196 if (i < nb0_frames && ost->last_frame) {
1197 in_picture =
ost->last_frame;
1199 in_picture = next_picture;
1204 in_picture->
pts =
ost->sync_opts;
1210 ost->top_field_first >= 0)
1226 ost->forced_kf_ref_pts = in_picture->
pts;
1230 if (
ost->forced_kf_index <
ost->forced_kf_count &&
1231 in_picture->
pts >=
ost->forced_kf_pts[
ost->forced_kf_index]) {
1232 ost->forced_kf_index++;
1233 forced_keyframe = 1;
1234 }
else if (
ost->forced_keyframes_pexpr) {
1236 ost->forced_keyframes_expr_const_values[
FKF_T] = pts_time;
1238 ost->forced_keyframes_expr_const_values,
NULL);
1239 ff_dlog(
NULL,
"force_key_frame: n:%f n_forced:%f prev_forced_n:%f t:%f prev_forced_t:%f -> res:%f\n",
1240 ost->forced_keyframes_expr_const_values[
FKF_N],
1243 ost->forced_keyframes_expr_const_values[
FKF_T],
1247 forced_keyframe = 1;
1249 ost->forced_keyframes_expr_const_values[
FKF_N];
1251 ost->forced_keyframes_expr_const_values[
FKF_T];
1255 ost->forced_keyframes_expr_const_values[
FKF_N] += 1;
1256 }
else if (
ost->forced_keyframes
1257 && !strncmp(
ost->forced_keyframes,
"source", 6)
1260 forced_keyframe = 1;
1263 if (forced_keyframe) {
1271 "frame_pts:%s frame_pts_time:%s time_base:%d/%d\n",
1276 ost->frames_encoded++;
1294 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1306 "pkt_pts:%s pkt_pts_time:%s pkt_dts:%s pkt_dts_time:%s\n",
1325 ost->frame_number++;
1331 if (!
ost->last_frame)
1334 if (next_picture &&
ost->last_frame)
1347 return -10.0 * log10(d);
1354 double ti1,
bitrate, avg_bitrate;
1369 fprintf(
vstats_file,
"frame= %5d q= %2.1f ", frame_number,
1386 avg_bitrate = (double)(
ost->data_size * 8) / ti1 / 1000.0;
1387 fprintf(
vstats_file,
"s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
1388 (
double)
ost->data_size / 1024, ti1,
bitrate, avg_bitrate);
1427 if (!
ost->filter || !
ost->filter->graph->graph)
1431 if (!
ost->initialized) {
1432 char error[1024] =
"";
1444 filtered_frame =
ost->filtered_frame;
1453 "Error in av_buffersink_get_frame_flags(): %s\n",
av_err2str(
ret));
1460 if (
ost->finished) {
1476 float_pts +=
FFSIGN(float_pts) * 1.0 / (1<<17);
1478 filtered_frame->
pts =
1485 if (!
ost->frame_aspect_ratio.num)
1501 "Audio filter graph output is not normalized and encoder does not support parameter changes\n");
1520 uint64_t video_size = 0, audio_size = 0, extra_size = 0, other_size = 0;
1521 uint64_t subtitle_size = 0;
1523 float percent = -1.0;
1529 switch (
ost->enc_ctx->codec_type) {
1533 default: other_size +=
ost->data_size;
break;
1535 extra_size +=
ost->enc_ctx->extradata_size;
1545 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: ",
1546 video_size / 1024.0,
1547 audio_size / 1024.0,
1548 subtitle_size / 1024.0,
1549 other_size / 1024.0,
1550 extra_size / 1024.0);
1560 uint64_t total_packets = 0, total_size = 0;
1565 for (j = 0; j <
f->nb_streams; j++) {
1589 total_packets, total_size);
1594 uint64_t total_packets = 0, total_size = 0;
1603 total_size +=
ost->data_size;
1604 total_packets +=
ost->packets_written;
1608 if (
ost->encoding_needed) {
1610 ost->frames_encoded);
1617 ost->packets_written,
ost->data_size);
1623 total_packets, total_size);
1625 if(video_size +
data_size + audio_size + subtitle_size + extra_size == 0){
1635 static void print_report(
int is_last_report, int64_t timer_start, int64_t cur_time)
1637 AVBPrint buf, buf_script;
1642 int frame_number, vid,
i;
1645 int64_t
pts = INT64_MIN + 1;
1646 static int64_t last_time = -1;
1647 static int qp_histogram[52];
1648 int hours, mins, secs,
us;
1649 const char *hours_sign;
1656 if (!is_last_report) {
1657 if (last_time == -1) {
1658 last_time = cur_time;
1661 if ((cur_time - last_time) < 500000)
1663 last_time = cur_time;
1666 t = (cur_time-timer_start) / 1000000.0;
1672 if (total_size <= 0)
1682 if (!
ost->stream_copy)
1687 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1693 frame_number =
ost->frame_number;
1694 fps = t > 1 ? frame_number / t : 0;
1695 av_bprintf(&buf,
"frame=%5d fps=%3.*f q=%3.1f ",
1696 frame_number, fps < 9.95, fps, q);
1697 av_bprintf(&buf_script,
"frame=%d\n", frame_number);
1699 av_bprintf(&buf_script,
"stream_%d_%d_q=%.1f\n",
1708 for (j = 0; j < 32; j++)
1714 double error, error_sum = 0;
1715 double scale, scale_sum = 0;
1717 char type[3] = {
'Y',
'U',
'V' };
1719 for (j = 0; j < 3; j++) {
1720 if (is_last_report) {
1722 scale = enc->
width * enc->
height * 255.0 * 255.0 * frame_number;
1733 av_bprintf(&buf_script,
"stream_%d_%d_psnr_%c=%2.2f\n",
1736 p =
psnr(error_sum / scale_sum);
1738 av_bprintf(&buf_script,
"stream_%d_%d_psnr_all=%2.2f\n",
1757 hours_sign = (
pts < 0) ?
"-" :
"";
1759 bitrate =
pts && total_size >= 0 ? total_size * 8 / (
pts / 1000.0) : -1;
1762 if (total_size < 0)
av_bprintf(&buf,
"size=N/A time=");
1763 else av_bprintf(&buf,
"size=%8.0fkB time=", total_size / 1024.0);
1779 if (total_size < 0)
av_bprintf(&buf_script,
"total_size=N/A\n");
1780 else av_bprintf(&buf_script,
"total_size=%"PRId64
"\n", total_size);
1782 av_bprintf(&buf_script,
"out_time_us=N/A\n");
1783 av_bprintf(&buf_script,
"out_time_ms=N/A\n");
1788 av_bprintf(&buf_script,
"out_time=%s%02d:%02d:%02d.%06d\n",
1789 hours_sign, hours, mins, secs,
us);
1802 av_bprintf(&buf_script,
"speed=%4.3gx\n", speed);
1806 const char end = is_last_report ?
'\n' :
'\r';
1808 fprintf(stderr,
"%s %c", buf.str,
end);
1818 is_last_report ?
"end" :
"continue");
1820 FFMIN(buf_script.len, buf_script.size - 1));
1823 if (is_last_report) {
1826 "Error closing progress log, loss of information possible: %s\n",
av_err2str(
ret));
1856 if (!
ost->encoding_needed)
1861 if (!
ost->initialized) {
1863 char error[1024] =
"";
1866 "Finishing stream %d:%d without any data written to it.\n",
1968 if (
ost->source_index != ist_index)
1998 !
ost->copy_initial_nonkeyframes)
2001 if (!
ost->frame_number && !
ost->copy_prior_start) {
2006 ist->
pts < comp_start :
2017 if (
f->recording_time != INT64_MAX) {
2047 opkt.
pts = opkt.
dts - ost_tb_start_time;
2050 opkt.
dts -= ost_tb_start_time;
2061 if (!
dec->channel_layout) {
2062 char layout_name[256];
2067 if (!
dec->channel_layout)
2070 dec->channels,
dec->channel_layout);
2110 int need_reinit,
ret,
i;
2122 need_reinit |= ifilter->
width !=
frame->width ||
2141 if (need_reinit || !fg->
graph) {
2253 "Failed to inject frame into filter network: %s\n",
av_err2str(
ret));
2319 return err < 0 ? err :
ret;
2326 int i,
ret = 0, err = 0;
2327 int64_t best_effort_timestamp;
2372 "video_delay is larger in decoder than demuxer %d > %d.\n"
2373 "If you want to help, upload a sample "
2374 "of this file to https://streams.videolan.org/upload/ "
2375 "and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)\n",
2435 "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",
2438 best_effort_timestamp,
2452 return err < 0 ? err :
ret;
2477 if (end < ist->
prev_sub.subtitle.end_display_time) {
2479 "Subtitle duration reduced from %"PRId32
" to %d%s\n",
2481 end <= 0 ?
", dropping it" :
"");
2552 int eof_reached = 0;
2587 int64_t duration_dts = 0;
2588 int64_t duration_pts = 0;
2590 int decode_failed = 0;
2620 if (duration_pts > 0) {
2644 if (decode_failed) {
2727 return !eof_reached;
2759 printf(
"SDP:\n%s\n", sdp);
2812 "%s hwaccel requested for input stream #%d:%d, "
2813 "but cannot be initialized.\n",
2841 "%s hwaccel requested for input stream #%d:%d, "
2842 "but cannot be initialized.\n", hwaccel->
name,
2850 if (!
s->hw_frames_ctx)
2879 snprintf(
error, error_len,
"Decoder (codec %s) not found for input stream #%d:%d",
2894 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");
2912 "decoder on input stream #%d:%d : %s",
2922 "Error while opening decoder for input stream "
2938 if (
ost->source_index >= 0)
2945 return FFDIFFSIGN(*(
const int64_t *)
a, *(
const int64_t *)
b);
2955 if (!
ost->initialized)
2964 "Could not write header for output file #%d "
2965 "(incorrect codec parameters ?): %s\n",
3032 uint32_t codec_tag = par_dst->
codec_tag;
3041 "Error setting up codec context options.\n");
3048 "Error getting reference codec parameters.\n");
3053 unsigned int codec_tag_tmp;
3066 if (!
ost->frame_rate.num)
3093 memcpy(dst_data, sd_src->
data, sd_src->
size);
3097 if (
ost->rotate_overridden) {
3116 if (
ost->frame_aspect_ratio.num) {
3119 (
AVRational){ par_dst->height, par_dst->width });
3121 "with stream copy may produce invalid files\n");
3143 int encoder_string_len;
3144 int format_flags = 0;
3166 encoder_string =
av_mallocz(encoder_string_len);
3167 if (!encoder_string)
3173 av_strlcpy(encoder_string,
"Lavc ", encoder_string_len);
3174 av_strlcat(encoder_string,
ost->enc->name, encoder_string_len);
3186 for (p = kf; *p; p++)
3197 for (
i = 0;
i < n;
i++) {
3198 char *next = strchr(p,
',');
3203 if (!memcmp(p,
"chapters", 8)) {
3212 "Could not allocate forced key frames array.\n");
3239 ost->forced_kf_pts =
pts;
3248 if (
ost->enc_timebase.num > 0) {
3253 if (
ost->enc_timebase.num < 0) {
3300 if (!
ost->frame_rate.num)
3302 if (ist && !
ost->frame_rate.num)
3304 if (ist && !
ost->frame_rate.num)
3306 if (ist && !
ost->frame_rate.num) {
3310 "about the input framerate is available. Falling "
3311 "back to a default value of 25fps for output stream #%d:%d. Use the -r option "
3312 "if you want a different framerate.\n",
3316 if (
ost->enc->supported_framerates && !
ost->force_fps) {
3318 ost->frame_rate =
ost->enc->supported_framerates[idx];
3323 ost->frame_rate.num,
ost->frame_rate.den, 65535);
3348 "Please consider specifying a lower framerate, a different muxer or -vsync 2\n");
3354 ost->frame_aspect_ratio.num ?
3374 if (
ost->top_field_first == 0) {
3376 }
else if (
ost->top_field_first == 1) {
3380 if (
ost->forced_keyframes) {
3381 if (!strncmp(
ost->forced_keyframes,
"expr:", 5)) {
3386 "Invalid force_key_frames expression '%s'\n",
ost->forced_keyframes+5);
3389 ost->forced_keyframes_expr_const_values[
FKF_N] = 0;
3396 }
else if(strncmp(
ost->forced_keyframes,
"source", 6)) {
3403 if (!enc_ctx->
width) {
3424 if (
ost->encoding_needed) {
3435 if (
dec &&
dec->subtitle_header) {
3438 if (!
ost->enc_ctx->subtitle_header)
3440 memcpy(
ost->enc_ctx->subtitle_header,
dec->subtitle_header,
dec->subtitle_header_size);
3441 ost->enc_ctx->subtitle_header_size =
dec->subtitle_header_size;
3454 "encoder on output stream #%d:%d : %s",
3460 int input_props = 0, output_props = 0;
3465 if (input_descriptor)
3467 if (output_descriptor)
3469 if (input_props && output_props && input_props != output_props) {
3471 "Subtitle encoding currently only possible from text to text "
3472 "or bitmap to bitmap");
3481 "Error while opening encoder for output stream #%d:%d - "
3482 "maybe incorrect parameters such as bit_rate, rate, width or height",
3489 ost->enc_ctx->frame_size);
3491 if (
ost->enc_ctx->bit_rate &&
ost->enc_ctx->bit_rate < 1000 &&
3494 " It takes bits/s as argument, not kbits/s\n");
3499 "Error initializing the output stream codec context.\n");
3509 if (
ost->enc_ctx->nb_coded_side_data) {
3512 for (
i = 0;
i <
ost->enc_ctx->nb_coded_side_data;
i++) {
3519 memcpy(dst_data, sd_src->
data, sd_src->
size);
3553 ost->st->codec->codec=
ost->enc_ctx->codec;
3554 }
else if (
ost->stream_copy) {
3563 {
"disposition" ,
NULL, 0,
AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit =
"flags" },
3581 static const AVClass class = {
3587 const AVClass *pclass = &
class;
3601 ost->initialized = 1;
3618 "New %s stream %d:%d at pos:%"PRId64
" and DTS:%ss\n",
3627 int ret = 0,
i, j, k;
3631 char error[1024] = {0};
3651 if (
ifile->rate_emu)
3652 for (j = 0; j <
ifile->nb_streams; j++)
3680 for (j = 0; j <
ifile->ctx->nb_programs; j++) {
3724 if (
ost->attachment_filename) {
3749 ost->sync_ist->file_index,
3751 if (
ost->stream_copy)
3756 const char *decoder_name =
"?";
3757 const char *in_codec_name =
"?";
3758 const char *encoder_name =
"?";
3759 const char *out_codec_name =
"?";
3763 decoder_name = in_codec->
name;
3766 in_codec_name =
desc->name;
3767 if (!strcmp(decoder_name, in_codec_name))
3768 decoder_name =
"native";
3772 encoder_name = out_codec->
name;
3775 out_codec_name =
desc->name;
3776 if (!strcmp(encoder_name, out_codec_name))
3777 encoder_name =
"native";
3781 in_codec_name, decoder_name,
3782 out_codec_name, encoder_name);
3807 if (
ost->finished ||
3810 if (
ost->frame_number >=
ost->max_frames) {
3831 int64_t opts_min = INT64_MAX;
3841 "cur_dts is invalid st:%d (%d) [init:%d i_done:%d finish:%d] (this is harmless if it occurs once at the start per stream)\n",
3844 if (!
ost->initialized && !
ost->inputs_done)
3847 if (!
ost->finished &&
opts < opts_min) {
3859 if (tcgetattr(0, &tty) == 0) {
3860 if (
on) tty.c_lflag |=
ECHO;
3861 else tty.c_lflag &= ~
ECHO;
3862 tcsetattr(0, TCSANOW, &tty);
3870 static int64_t last_time;
3876 last_time = cur_time;
3893 if (
key ==
'c' ||
key ==
'C'){
3894 char buf[4096], target[64],
command[256],
arg[256] = {0};
3897 fprintf(stderr,
"\nEnter command: <target>|all <time>|-1 <command>[ <argument>]\n");
3900 while ((k =
read_key()) !=
'\n' && k !=
'\r' &&
i <
sizeof(buf)-1)
3905 fprintf(stderr,
"\n");
3907 (n = sscanf(buf,
"%63[^ ] %lf %255[^ ] %255[^\n]", target, &time,
command,
arg)) >= 3) {
3916 fprintf(stderr,
"Command reply for stream %d: ret:%d res:\n%s",
i,
ret, buf);
3917 }
else if (
key ==
'c') {
3918 fprintf(stderr,
"Queuing commands only on filters supporting the specific command is unsupported\n");
3923 fprintf(stderr,
"Queuing command failed with error %s\n",
av_err2str(
ret));
3929 "Parse error, at least 3 arguments were expected, "
3930 "only %d given in string '%s'\n", n, buf);
3933 if (
key ==
'd' ||
key ==
'D'){
3937 if(!debug) debug = 1;
3940 |FF_DEBUG_VIS_QP|FF_DEBUG_VIS_MB_TYPE
3949 while ((k =
read_key()) !=
'\n' && k !=
'\r' &&
i <
sizeof(buf)-1)
3954 fprintf(stderr,
"\n");
3955 if (k <= 0 || sscanf(buf,
"%d", &debug)!=1)
3956 fprintf(stderr,
"error parsing debug value\n");
3963 ost->enc_ctx->debug = debug;
3966 fprintf(stderr,
"debug=%d\n", debug);
3969 fprintf(stderr,
"key function\n"
3970 "? show this help\n"
3971 "+ increase verbosity\n"
3972 "- decrease verbosity\n"
3973 "c Send command to first matching filter supporting it\n"
3974 "C Send/Queue command to all matching filters\n"
3975 "D cycle through available debug modes\n"
3976 "h dump packets/hex press to cycle through the 3 states\n"
3978 "s Show QP histogram\n"
3985 static void *input_thread(
void *
arg)
4008 "Thread message queue blocking; consider raising the "
4009 "thread_queue_size option (current value: %d)\n",
4010 f->thread_queue_size);
4015 "Unable to send packet to main thread: %s\n",
4026 static void free_input_thread(
int i)
4031 if (!
f || !
f->in_thread_queue)
4042 static void free_input_threads(
void)
4047 free_input_thread(
i);
4050 static int init_input_thread(
int i)
4058 if (
f->ctx->pb ? !
f->ctx->pb->seekable :
4059 strcmp(
f->ctx->iformat->name,
"lavfi"))
4060 f->non_blocking = 1;
4062 f->thread_queue_size,
sizeof(
AVPacket));
4067 av_log(
NULL,
AV_LOG_ERROR,
"pthread_create failed: %s. Try to increase `ulimit -v` or decrease `ulimit -s`.\n", strerror(
ret));
4075 static int init_input_threads(
void)
4080 ret = init_input_thread(
i);
4099 for (
i = 0;
i <
f->nb_streams;
i++) {
4110 return get_input_packet_mt(
f,
pkt);
4141 return tmp_time_base;
4147 return tmp_time_base;
4157 int i,
ret, has_audio = 0;
4164 for (
i = 0;
i <
ifile->nb_streams;
i++) {
4175 for (
i = 0;
i <
ifile->nb_streams;
i++) {
4196 if (!
ifile->duration)
4206 if (
ifile->loop > 0)