MCPcopy Create free account
hub / github.com/byhook/ffmpeg4android / new_video_stream

Function new_video_stream

ffmpeg-single-cmd/src/main/cpp/ffmpeg_opt.c:1513–1709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1511}
1512
1513static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, int source_index)
1514{
1515 AVStream *st;
1516 OutputStream *ost;
1517 AVCodecContext *video_enc;
1518 char *frame_rate = NULL, *frame_aspect_ratio = NULL;
1519
1520 ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index);
1521 st = ost->st;
1522 video_enc = ost->enc_ctx;
1523
1524 MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st);
1525 if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) {
1526 av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate);
1527 exit_program(1);
1528 }
1529 if (frame_rate && video_sync_method == VSYNC_PASSTHROUGH)
1530 av_log(NULL, AV_LOG_ERROR, "Using -vsync 0 and -r can produce invalid output files\n");
1531
1532 MATCH_PER_STREAM_OPT(frame_aspect_ratios, str, frame_aspect_ratio, oc, st);
1533 if (frame_aspect_ratio) {
1534 AVRational q;
1535 if (av_parse_ratio(&q, frame_aspect_ratio, 255, 0, NULL) < 0 ||
1536 q.num <= 0 || q.den <= 0) {
1537 av_log(NULL, AV_LOG_FATAL, "Invalid aspect ratio: %s\n", frame_aspect_ratio);
1538 exit_program(1);
1539 }
1540 ost->frame_aspect_ratio = q;
1541 }
1542
1543 MATCH_PER_STREAM_OPT(filter_scripts, str, ost->filters_script, oc, st);
1544 MATCH_PER_STREAM_OPT(filters, str, ost->filters, oc, st);
1545
1546 if (!ost->stream_copy) {
1547 const char *p = NULL;
1548 char *frame_size = NULL;
1549 char *frame_pix_fmt = NULL;
1550 char *intra_matrix = NULL, *inter_matrix = NULL;
1551 char *chroma_intra_matrix = NULL;
1552 int do_pass = 0;
1553 int i;
1554
1555 MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
1556 if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) {
1557 av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size);
1558 exit_program(1);
1559 }
1560
1561 video_enc->bits_per_raw_sample = frame_bits_per_raw_sample;
1562 MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
1563 if (frame_pix_fmt && *frame_pix_fmt == '+') {
1564 ost->keep_pix_fmt = 1;
1565 if (!*++frame_pix_fmt)
1566 frame_pix_fmt = NULL;
1567 }
1568 if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == AV_PIX_FMT_NONE) {
1569 av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
1570 exit_program(1);

Callers 2

init_output_filterFunction · 0.85
open_output_fileFunction · 0.85

Calls 6

new_output_streamFunction · 0.85
exit_programFunction · 0.85
parse_matrix_coeffsFunction · 0.85
read_fileFunction · 0.85
get_ost_filtersFunction · 0.85
check_streamcopy_filtersFunction · 0.85

Tested by

no test coverage detected