ffmpeg.c:3789: error: Integer Overflow L2
  ([0, +oo] - 1):unsigned32 by call to `new_video_stream`.

ffmpeg.c:3750:10: Unknown value from: strcmp
3748.     av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3749. 
3750.     if (!strcmp(file_oformat->name, "ffm") &&
               ^
3751.         av_strstart(filename, "http:", NULL)) {
3752.         /* special case for files sent to ffserver: we get the stream

ffmpeg.c:3789:27: Call
3787.         if (data_disable)     use_data     = 0;
3788. 
3789.         if (use_video)    new_video_stream(oc, nb_output_files);
                                ^
3790.         if (use_audio)    new_audio_stream(oc, nb_output_files);
3791.         if (use_subtitle) new_subtitle_stream(oc, nb_output_files);

ffmpeg.c:3353:1: Global `nb_streamid_map`
  3351. }
  3352. 
  3353. static void new_video_stream(AVFormatContext *oc, int file_idx)
        ^
  3354. {
  3355.     AVStream *st;

ffmpeg.c:3361:10: Call
  3359.     AVCodec *codec= NULL;
  3360. 
  3361.     st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
                 ^
  3362.     if (!st) {
  3363.         fprintf(stderr, "Could not alloc stream\n");

libavformat/utils.c:2585:1: Parameter `s->nb_streams`
    2583. }
    2584. 
    2585. AVStream *av_new_stream(AVFormatContext *s, int id)
          ^
    2586. {
    2587.     AVStream *st;

ffmpeg.c:3366:11: Call
  3364.         ffmpeg_exit(1);
  3365.     }
  3366.     ost = new_output_stream(oc, file_idx);
                  ^
  3367. 
  3368.     output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);

ffmpeg.c:602:1: <LHS trace>
600. }
601. 
602. static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
     ^
603. {
604.     int idx = oc->nb_streams - 1;

ffmpeg.c:602:1: Parameter `oc->nb_streams`
    600. }
    601. 
    602. static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
         ^
    603. {
    604.     int idx = oc->nb_streams - 1;

ffmpeg.c:604:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `new_video_stream` 
    602. static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
    603. {
    604.     int idx = oc->nb_streams - 1;
             ^
    605.     AVOutputStream *ost;
    606. 

static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)
{
    int idx = oc->nb_streams - 1;
    AVOutputStream *ost;
    output_streams_for_file[file_idx] =
        grow_array(output_streams_for_file[file_idx],
                   sizeof(*output_streams_for_file[file_idx]),
                   &nb_output_streams_for_file[file_idx],
                   oc->nb_streams);
    ost = output_streams_for_file[file_idx][idx] =
        av_mallocz(sizeof(AVOutputStream));
    if (!ost) {
        fprintf(stderr, "Could not alloc output stream\n");
        ffmpeg_exit(1);
    }
    ost->file_index = file_idx;
    ost->index = idx;
    return ost;
}
['static void opt_output_file(const char *filename)\n{\n    AVFormatContext *oc;\n    int err, use_video, use_audio, use_subtitle, use_data;\n    int input_has_video, input_has_audio, input_has_subtitle, input_has_data;\n    AVFormatParameters params, *ap = &params;\n    AVOutputFormat *file_oformat;\n    if (!strcmp(filename, "-"))\n        filename = "pipe:";\n    oc = avformat_alloc_context();\n    if (!oc) {\n        print_error(filename, AVERROR(ENOMEM));\n        ffmpeg_exit(1);\n    }\n    if (last_asked_format) {\n        file_oformat = av_guess_format(last_asked_format, NULL, NULL);\n        if (!file_oformat) {\n            fprintf(stderr, "Requested output format \'%s\' is not a suitable output format\\n", last_asked_format);\n            ffmpeg_exit(1);\n        }\n        last_asked_format = NULL;\n    } else {\n        file_oformat = av_guess_format(NULL, filename, NULL);\n        if (!file_oformat) {\n            fprintf(stderr, "Unable to find a suitable output format for \'%s\'\\n",\n                    filename);\n            ffmpeg_exit(1);\n        }\n    }\n    oc->oformat = file_oformat;\n    av_strlcpy(oc->filename, filename, sizeof(oc->filename));\n    if (!strcmp(file_oformat->name, "ffm") &&\n        av_strstart(filename, "http:", NULL)) {\n        int err = read_ffserver_streams(oc, filename);\n        if (err < 0) {\n            print_error(filename, err);\n            ffmpeg_exit(1);\n        }\n    } else {\n        use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;\n        use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;\n        use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;\n        use_data = data_stream_copy ||  data_codec_name;\n        if (nb_input_files > 0) {\n            check_inputs(&input_has_video,\n                         &input_has_audio,\n                         &input_has_subtitle,\n                         &input_has_data);\n            if (!input_has_video)\n                use_video = 0;\n            if (!input_has_audio)\n                use_audio = 0;\n            if (!input_has_subtitle)\n                use_subtitle = 0;\n            if (!input_has_data)\n                use_data = 0;\n        }\n        if (audio_disable)    use_audio    = 0;\n        if (video_disable)    use_video    = 0;\n        if (subtitle_disable) use_subtitle = 0;\n        if (data_disable)     use_data     = 0;\n        if (use_video)    new_video_stream(oc, nb_output_files);\n        if (use_audio)    new_audio_stream(oc, nb_output_files);\n        if (use_subtitle) new_subtitle_stream(oc, nb_output_files);\n        if (use_data)     new_data_stream(oc, nb_output_files);\n        oc->timestamp = recording_timestamp;\n        av_metadata_copy(&oc->metadata, metadata, 0);\n        av_metadata_free(&metadata);\n    }\n    output_files[nb_output_files++] = oc;\n    if (oc->oformat->flags & AVFMT_NEEDNUMBER) {\n        if (!av_filename_number_test(oc->filename)) {\n            print_error(oc->filename, AVERROR(EINVAL));\n            ffmpeg_exit(1);\n        }\n    }\n    if (!(oc->oformat->flags & AVFMT_NOFILE)) {\n        if (!file_overwrite &&\n            (strchr(filename, \':\') == NULL ||\n             filename[1] == \':\' ||\n             av_strstart(filename, "file:", NULL))) {\n            if (avio_check(filename, 0) == 0) {\n                if (!using_stdin) {\n                    fprintf(stderr,"File \'%s\' already exists. Overwrite ? [y/N] ", filename);\n                    fflush(stderr);\n                    if (!read_yesno()) {\n                        fprintf(stderr, "Not overwriting - exiting\\n");\n                        ffmpeg_exit(1);\n                    }\n                }\n                else {\n                    fprintf(stderr,"File \'%s\' already exists. Exiting.\\n", filename);\n                    ffmpeg_exit(1);\n                }\n            }\n        }\n        if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) {\n            print_error(filename, err);\n            ffmpeg_exit(1);\n        }\n    }\n    memset(ap, 0, sizeof(*ap));\n    if (av_set_parameters(oc, ap) < 0) {\n        fprintf(stderr, "%s: Invalid encoding parameters\\n",\n                oc->filename);\n        ffmpeg_exit(1);\n    }\n    oc->preload= (int)(mux_preload*AV_TIME_BASE);\n    oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);\n    oc->loop_output = loop_output;\n    oc->flags |= AVFMT_FLAG_NONBLOCK;\n    set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL);\n    av_freep(&forced_key_frames);\n}', 'static void new_video_stream(AVFormatContext *oc, int file_idx)\n{\n    AVStream *st;\n    AVOutputStream *ost;\n    AVCodecContext *video_enc;\n    enum CodecID codec_id = CODEC_ID_NONE;\n    AVCodec *codec= NULL;\n    st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);\n    if (!st) {\n        fprintf(stderr, "Could not alloc stream\\n");\n        ffmpeg_exit(1);\n    }\n    ost = new_output_stream(oc, file_idx);\n    output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);\n    if(!video_stream_copy){\n        if (video_codec_name) {\n            codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,\n                                         avcodec_opts[AVMEDIA_TYPE_VIDEO]->strict_std_compliance);\n            codec = avcodec_find_encoder_by_name(video_codec_name);\n            output_codecs[nb_output_codecs-1] = codec;\n        } else {\n            codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);\n            codec = avcodec_find_encoder(codec_id);\n        }\n    }\n    avcodec_get_context_defaults3(st->codec, codec);\n    ost->bitstream_filters = video_bitstream_filters;\n    video_bitstream_filters= NULL;\n    st->codec->thread_count= thread_count;\n    video_enc = st->codec;\n    if(video_codec_tag)\n        video_enc->codec_tag= video_codec_tag;\n    if(   (video_global_header&1)\n       || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){\n        video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;\n        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;\n    }\n    if(video_global_header&2){\n        video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;\n        avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;\n    }\n    if (video_stream_copy) {\n        st->stream_copy = 1;\n        video_enc->codec_type = AVMEDIA_TYPE_VIDEO;\n        video_enc->sample_aspect_ratio =\n        st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);\n    } else {\n        const char *p;\n        int i;\n        AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};\n        video_enc->codec_id = codec_id;\n        set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec);\n        if (codec && codec->supported_framerates && !force_fps)\n            fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];\n        video_enc->time_base.den = fps.num;\n        video_enc->time_base.num = fps.den;\n        video_enc->width = frame_width;\n        video_enc->height = frame_height;\n        video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);\n        video_enc->pix_fmt = frame_pix_fmt;\n        st->sample_aspect_ratio = video_enc->sample_aspect_ratio;\n        choose_pixel_fmt(st, codec);\n        if (intra_only)\n            video_enc->gop_size = 0;\n        if (video_qscale || same_quality) {\n            video_enc->flags |= CODEC_FLAG_QSCALE;\n            video_enc->global_quality=\n                st->quality = FF_QP2LAMBDA * video_qscale;\n        }\n        if(intra_matrix)\n            video_enc->intra_matrix = intra_matrix;\n        if(inter_matrix)\n            video_enc->inter_matrix = inter_matrix;\n        p= video_rc_override_string;\n        for(i=0; p; i++){\n            int start, end, q;\n            int e=sscanf(p, "%d,%d,%d", &start, &end, &q);\n            if(e!=3){\n                fprintf(stderr, "error parsing rc_override\\n");\n                ffmpeg_exit(1);\n            }\n            video_enc->rc_override=\n                av_realloc(video_enc->rc_override,\n                           sizeof(RcOverride)*(i+1));\n            video_enc->rc_override[i].start_frame= start;\n            video_enc->rc_override[i].end_frame  = end;\n            if(q>0){\n                video_enc->rc_override[i].qscale= q;\n                video_enc->rc_override[i].quality_factor= 1.0;\n            }\n            else{\n                video_enc->rc_override[i].qscale= 0;\n                video_enc->rc_override[i].quality_factor= -q/100.0;\n            }\n            p= strchr(p, \'/\');\n            if(p) p++;\n        }\n        video_enc->rc_override_count=i;\n        if (!video_enc->rc_initial_buffer_occupancy)\n            video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;\n        video_enc->me_threshold= me_threshold;\n        video_enc->intra_dc_precision= intra_dc_precision - 8;\n        if (do_psnr)\n            video_enc->flags|= CODEC_FLAG_PSNR;\n        if (do_pass) {\n            if (do_pass == 1) {\n                video_enc->flags |= CODEC_FLAG_PASS1;\n            } else {\n                video_enc->flags |= CODEC_FLAG_PASS2;\n            }\n        }\n        if (forced_key_frames)\n            parse_forced_key_frames(forced_key_frames, ost, video_enc);\n    }\n    if (video_language) {\n        av_metadata_set2(&st->metadata, "language", video_language, 0);\n        av_freep(&video_language);\n    }\n    video_disable = 0;\n    av_freep(&video_codec_name);\n    av_freep(&forced_key_frames);\n    video_stream_copy = 0;\n    frame_pix_fmt = PIX_FMT_NONE;\n}', 'AVStream *av_new_stream(AVFormatContext *s, int id)\n{\n    AVStream *st;\n    int i;\n    AVStream **streams;\n    if (s->nb_streams >= INT_MAX/sizeof(*streams))\n        return NULL;\n    streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));\n    if (!streams)\n        return NULL;\n    s->streams = streams;\n    st = av_mallocz(sizeof(AVStream));\n    if (!st)\n        return NULL;\n    if (!(st->info = av_mallocz(sizeof(*st->info)))) {\n        av_free(st);\n        return NULL;\n    }\n    st->codec= avcodec_alloc_context();\n    if (s->iformat) {\n        st->codec->bit_rate = 0;\n    }\n    st->index = s->nb_streams;\n    st->id = id;\n    st->start_time = AV_NOPTS_VALUE;\n    st->duration = AV_NOPTS_VALUE;\n    st->cur_dts = 0;\n    st->first_dts = AV_NOPTS_VALUE;\n    st->probe_packets = MAX_PROBE_PACKETS;\n    av_set_pts_info(st, 33, 1, 90000);\n    st->last_IP_pts = AV_NOPTS_VALUE;\n    for(i=0; i<MAX_REORDER_DELAY+1; i++)\n        st->pts_buffer[i]= AV_NOPTS_VALUE;\n    st->reference_dts = AV_NOPTS_VALUE;\n    st->sample_aspect_ratio = (AVRational){0,1};\n    s->streams[s->nb_streams++] = st;\n    return st;\n}', 'static AVOutputStream *new_output_stream(AVFormatContext *oc, int file_idx)\n{\n    int idx = oc->nb_streams - 1;\n    AVOutputStream *ost;\n    output_streams_for_file[file_idx] =\n        grow_array(output_streams_for_file[file_idx],\n                   sizeof(*output_streams_for_file[file_idx]),\n                   &nb_output_streams_for_file[file_idx],\n                   oc->nb_streams);\n    ost = output_streams_for_file[file_idx][idx] =\n        av_mallocz(sizeof(AVOutputStream));\n    if (!ost) {\n        fprintf(stderr, "Could not alloc output stream\\n");\n        ffmpeg_exit(1);\n    }\n    ost->file_index = file_idx;\n    ost->index = idx;\n    return ost;\n}']