Revision bc6caae2 ffmpeg.c

View differences:

ffmpeg.c
86 86
static int video_disable = 0;
87 87
static int video_codec_id = CODEC_ID_NONE;
88 88
static int same_quality = 0;
89
static int b_frames = 0;
89 90
static int use_hq = 0;
90 91
static int use_4mv = 0;
91 92
static int do_deinterlace = 0;
......
1270 1271
    gop_size = atoi(arg);
1271 1272
}
1272 1273

  
1274
void opt_b_frames(const char *arg)
1275
{
1276
    b_frames = atoi(arg);
1277
    if (b_frames > FF_MAX_B_FRAMES) {
1278
        fprintf(stderr, "\nCannot have more than %d B frames, increase FF_MAX_B_FRAMES.\n", FF_MAX_B_FRAMES);
1279
        exit(1);
1280
    } else if (b_frames < 1) {
1281
        fprintf(stderr, "\nNumber of B frames must be higher than 0\n");
1282
        exit(1);
1283
    }
1284
}
1285

  
1273 1286
void opt_qscale(const char *arg)
1274 1287
{
1275 1288
    video_qscale = atoi(arg);
......
1773 1786
                video_enc->flags |= CODEC_FLAG_HQ;
1774 1787
                video_enc->flags |= CODEC_FLAG_4MV;
1775 1788
            }
1776
            video_enc->qmin= video_qmin;
1777
            video_enc->qmax= video_qmax;
1778
            video_enc->max_qdiff= video_qdiff;
1779
            video_enc->qblur= video_qblur;
1780
            video_enc->qcompress= video_qcomp;
1789
            
1790
            if (b_frames) {
1791
                if (codec_id != CODEC_ID_MPEG4) {
1792
                    fprintf(stderr, "\nB frames encoding only supported by MPEG-4.\n");
1793
                    exit(1);
1794
                }
1795
                video_enc->max_b_frames = b_frames;
1796
                video_enc->b_frame_strategy = 0;
1797
                video_enc->b_quant_factor = 2.0;
1798
            }
1799
            
1800
            video_enc->qmin = video_qmin;
1801
            video_enc->qmax = video_qmax;
1802
            video_enc->max_qdiff = video_qdiff;
1803
            video_enc->qblur = video_qblur;
1804
            video_enc->qcompress = video_qcomp;
1781 1805
            
1782 1806
            if (do_psnr)
1783 1807
                video_enc->get_psnr = 1;
......
2124 2148
    { "vcodec", HAS_ARG | OPT_EXPERT, {(void*)opt_video_codec}, "force video codec", "codec" },
2125 2149
    { "me", HAS_ARG | OPT_EXPERT, {(void*)opt_motion_estimation}, "set motion estimation method", 
2126 2150
      "method" },
2151
    { "bf", HAS_ARG | OPT_EXPERT, {(void*)opt_b_frames}, "use 'frames' B frames (only MPEG-4)", "frames" },
2127 2152
    { "hq", OPT_BOOL | OPT_EXPERT, {(void*)&use_hq}, "activate high quality settings" },
2128 2153
    { "4mv", OPT_BOOL | OPT_EXPERT, {(void*)&use_4mv}, "use four motion vector by macroblock (only MPEG-4)" },
2129 2154
    { "sameq", OPT_BOOL, {(void*)&same_quality}, 

Also available in: Unified diff