From ed5b13265e788f7a3fdb456f56b719c41964bcb5 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 13 Aug 2011 12:20:50 +0200 Subject: [PATCH 1/4] avconv: re-add nb_streams to InputFile. It was mistakenly removed in 2cf8355f98681bdd726b739008acd5483f82f8d7, not taking into account that new streams might appear in av_read_frame() that avconv doesn't know about. Fixes bug 24. --- avconv.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/avconv.c b/avconv.c index 64b2347bf5..733a9a4131 100644 --- a/avconv.c +++ b/avconv.c @@ -239,6 +239,8 @@ typedef struct InputFile { int ist_index; /* index of first stream in ist_table */ int buffer_size; /* current total buffer size */ int64_t ts_offset; + int nb_streams; /* number of stream that avconv is aware of; may be different + from ctx.nb_streams if new streams appear during av_read_frame() */ } InputFile; typedef struct OutputStream { @@ -2316,7 +2318,7 @@ static int transcode(OutputFile *output_files, } /* the following test is needed in case new streams appear dynamically in stream : we ignore them */ - if (pkt.stream_index >= input_files[file_index].ctx->nb_streams) + if (pkt.stream_index >= input_files[file_index].nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; @@ -2676,13 +2678,13 @@ static int opt_map(const char *opt, const char *arg) } if (*sync) sync++; - for (i = 0; i < input_files[sync_file_idx].ctx->nb_streams; i++) + for (i = 0; i < input_files[sync_file_idx].nb_streams; i++) if (check_stream_specifier(input_files[sync_file_idx].ctx, input_files[sync_file_idx].ctx->streams[i], sync) == 1) { sync_stream_idx = i; break; } - if (i == input_files[sync_file_idx].ctx->nb_streams) { + if (i == input_files[sync_file_idx].nb_streams) { av_log(NULL, AV_LOG_ERROR, "Sync stream specification in map %s does not " "match any streams.\n", arg); exit_program(1); @@ -2705,7 +2707,7 @@ static int opt_map(const char *opt, const char *arg) m->disabled = 1; } else - for (i = 0; i < input_files[file_idx].ctx->nb_streams; i++) { + for (i = 0; i < input_files[file_idx].nb_streams; i++) { if (check_stream_specifier(input_files[file_idx].ctx, input_files[file_idx].ctx->streams[i], *p == ':' ? p + 1 : p) <= 0) continue; @@ -3068,6 +3070,7 @@ static int opt_input_file(const char *opt, const char *filename) input_files[nb_input_files - 1].ctx = ic; input_files[nb_input_files - 1].ist_index = nb_input_streams - ic->nb_streams; input_files[nb_input_files - 1].ts_offset = input_ts_offset - (copy_ts ? 0 : timestamp); + input_files[nb_input_files - 1].nb_streams = ic->nb_streams; frame_rate = (AVRational){0, 0}; frame_pix_fmt = PIX_FMT_NONE; @@ -3897,7 +3900,7 @@ static int opt_target(const char *opt, const char *arg) if(nb_input_files) { int i, j; for (j = 0; j < nb_input_files; j++) { - for (i = 0; i < input_files[j].ctx->nb_streams; i++) { + for (i = 0; i < input_files[j].nb_streams; i++) { AVCodecContext *c = input_files[j].ctx->streams[i]->codec; if(c->codec_type != AVMEDIA_TYPE_VIDEO) continue; From c922816d31abec986e7b719812707ebab6e333f3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 28 Aug 2011 18:51:45 +0200 Subject: [PATCH 2/4] avconv: remove stubs of crop* and pad* options --- avconv.c | 20 -------------------- doc/avconv.texi | 14 -------------- 2 files changed, 34 deletions(-) diff --git a/avconv.c b/avconv.c index 733a9a4131..6514269fb2 100644 --- a/avconv.c +++ b/avconv.c @@ -2480,12 +2480,6 @@ static int opt_frame_rate(const char *opt, const char *arg) return 0; } -static int opt_frame_crop(const char *opt, const char *arg) -{ - fprintf(stderr, "Option '%s' has been removed, use the crop filter instead\n", opt); - return AVERROR(EINVAL); -} - static int opt_frame_size(const char *opt, const char *arg) { if (av_parse_video_size(&frame_width, &frame_height, arg) < 0) { @@ -2495,11 +2489,6 @@ static int opt_frame_size(const char *opt, const char *arg) return 0; } -static int opt_pad(const char *opt, const char *arg) { - fprintf(stderr, "Option '%s' has been removed, use the pad filter instead\n", opt); - return -1; -} - static int opt_frame_pix_fmt(const char *opt, const char *arg) { if (strcmp(arg, "list")) { @@ -4104,15 +4093,6 @@ static const OptionDef options[] = { { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" }, { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" }, { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" }, - { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, - { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, - { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, - { "cropright", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop}, "Removed, use the crop filter instead", "size" }, - { "padtop", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, - { "padbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, - { "padleft", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, - { "padright", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "size" }, - { "padcolor", HAS_ARG | OPT_VIDEO, {(void*)opt_pad}, "Removed, use the pad filter instead", "color" }, { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" }, { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" }, { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantizer scale (VBR)", "q" }, diff --git a/doc/avconv.texi b/doc/avconv.texi index a0368a5afe..959b781349 100644 --- a/doc/avconv.texi +++ b/doc/avconv.texi @@ -274,20 +274,6 @@ form @var{num}:@var{den}, where @var{num} and @var{den} are the numerator and denominator of the aspect ratio. For example "4:3", "16:9", "1.3333", and "1.7777" are valid argument values. -@item -croptop @var{size} -@item -cropbottom @var{size} -@item -cropleft @var{size} -@item -cropright @var{size} -All the crop options have been removed. Use -vf -crop=width:height:x:y instead. - -@item -padtop @var{size} -@item -padbottom @var{size} -@item -padleft @var{size} -@item -padright @var{size} -@item -padcolor @var{hex_color} -All the pad options have been removed. Use -vf -pad=width:height:x:y:color instead. @item -vn Disable video recording. @item -bt @var{tolerance} From 8b7222979c074d4fbdc0346305ea22584309cb38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= Date: Mon, 29 Aug 2011 13:44:13 +0200 Subject: [PATCH 3/4] isom: add missing AVC-Intra tags, rearrange list and update comments Signed-off-by: Diego Biurrun --- libavformat/isom.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/libavformat/isom.c b/libavformat/isom.c index 7d42e80070..48fd8e1452 100644 --- a/libavformat/isom.c +++ b/libavformat/isom.c @@ -137,11 +137,18 @@ const AVCodecTag codec_movvideo_tags[] = { { CODEC_ID_RAWVIDEO, MKTAG('W', 'R', 'A', 'W') }, { CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */ - { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC Intra 50 / 1080 interlace */ - { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC Intra 50 / 720 */ - { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC Intra 100 / 1080 interlace */ - { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC Intra 100 / 720 */ - { CODEC_ID_H264, MKTAG('a', 'i', '1', '2') }, /* AVC Intra 100 / 1080 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC-Intra 50M 720p25/50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '2') }, /* AVC-Intra 50M 1080p25/50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '3') }, /* AVC-Intra 50M 1080p24/30/60 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '5') }, /* AVC-Intra 50M 1080i50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '5', '6') }, /* AVC-Intra 50M 1080i60 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', 'p') }, /* AVC-Intra 100M 720p24/30/60 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', 'q') }, /* AVC-Intra 100M 720p25/50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '2') }, /* AVC-Intra 100M 1080p25/50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '3') }, /* AVC-Intra 100M 1080p24/30/60 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '5') }, /* AVC-Intra 100M 1080i50 */ + { CODEC_ID_H264, MKTAG('a', 'i', '1', '6') }, /* AVC-Intra 100M 1080i60 */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', '1') }, /* Apple MPEG-1 Camcorder */ { CODEC_ID_MPEG1VIDEO, MKTAG('m', 'p', 'e', 'g') }, /* MPEG */ From 22141917a987e22685ee20440148e25724451f50 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Sun, 21 Aug 2011 18:27:44 +0200 Subject: [PATCH 4/4] Revert "h264: Properly set coded_{width, height} when parsing H.264." This reverts commit b47904d158709bdec1a9d40e83d1abadf50081dc. coded_{width, height} overwrites width and height in avcodec_open and it currently just report the non-lowres size. --- libavcodec/h264.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/libavcodec/h264.c b/libavcodec/h264.c index 5116ca232d..d0474489d9 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -2574,9 +2574,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0){ s->avctx->sample_aspect_ratio= h->sps.sar; av_assert0(s->avctx->sample_aspect_ratio.den); - h->s.avctx->coded_width = 16*s->mb_width; - h->s.avctx->coded_height = 16*s->mb_height; - if(h->sps.video_signal_type_present_flag){ s->avctx->color_range = h->sps.full_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; if(h->sps.colour_description_present_flag){