00001 // This is core/vidl/vidl_ffmpeg_ostream_params.h 00002 #ifndef vidl_ffmpeg_ostream_params_h_ 00003 #define vidl_ffmpeg_ostream_params_h_ 00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE 00005 #pragma interface 00006 #endif 00007 //: 00008 // \file 00009 // \brief A parameters struct for vidl_ffmpeg_ostream 00010 // 00011 // \author Matt Leotta 00012 // \date 3 Jan 2006 00013 // 00014 // \verbatim 00015 // Modifications 00016 // Matt Leotta 3 Jan 2006 Adapted from code by Amitha Perera 00017 // \endverbatim 00018 00019 #include <vcl_string.h> 00020 00021 //: A parameters struct for vidl_ffmpeg_ostream 00022 // 00023 // The setter functions are provided for convenience, so that the 00024 // parameters can be set through an anonymous object. 00025 // \code 00026 // ostream.open( filename, 00027 // vidl_ffmpeg_ostream_params() 00028 // .encoder( vidl_ffmpeg_ostream_params::DVVIDEO ) 00029 // .frame_rate( 29.95 ) ); 00030 // \endcode 00031 struct vidl_ffmpeg_ostream_params 00032 { 00033 //: Available video encoders 00034 enum encoder_type { DEFAULT, 00035 MPEG4, 00036 MSMPEG4V2, 00037 MPEG2VIDEO, 00038 DVVIDEO, 00039 LJPEG, 00040 RAWVIDEO, 00041 HUFFYUV, 00042 ENCODER_END_MARKER }; 00043 00044 //: Supported video types 00045 enum file_format_type { GUESS // < Guess based on file extension 00046 }; 00047 00048 //: The type of encoder to use (default DEFAULT) 00049 encoder_type encoder_; 00050 00051 //: The file format to use (default GUESS) 00052 file_format_type file_format_; 00053 00054 //: Frame rate in frames/second. (default 25) 00055 float frame_rate_; 00056 00057 //: Bit rate in bits/second. (Default 5000) 00058 unsigned bit_rate_; 00059 00060 //: Width of a frame (default 640) 00061 unsigned ni_; 00062 00063 //: Height of a frame (default 480) 00064 unsigned nj_; 00065 00066 //: static parameters from ffmpeg.c 00067 // There are many other FFMPEG parameters available 00068 // I don't know what most of these do, but using the 00069 // default values should work most of the time 00070 int video_bit_rate_tolerance_; 00071 float frame_aspect_ratio_; 00072 int intra_only_; 00073 int gop_size_; 00074 float video_qscale_; 00075 int same_quality_; 00076 int mb_decision_; 00077 int mb_cmp_; 00078 int ildct_cmp_; 00079 int sub_cmp_; 00080 int cmp_; 00081 int pre_cmp_; 00082 int pre_me_; 00083 float lumi_mask_; 00084 float dark_mask_; 00085 float scplx_mask_; 00086 float tcplx_mask_; 00087 float p_mask_; 00088 int qns_; 00089 int use_4mv_; 00090 int use_obmc_; 00091 int use_loop_; 00092 int use_aic_; 00093 int use_aiv_; 00094 int use_umv_; 00095 int use_ss_; 00096 int use_alt_scan_; 00097 int use_trell_; 00098 int use_scan_offset_; 00099 int use_part_; 00100 int closed_gop_; 00101 int use_qpel_; 00102 int use_qprd_; 00103 int use_cbprd_; 00104 int b_frames_; 00105 int do_interlace_dct_; 00106 int do_interlace_me_; 00107 int video_qmin_; 00108 int video_qmax_; 00109 int video_lmin_; 00110 int video_lmax_; 00111 int video_mb_qmin_; 00112 int video_mb_qmax_; 00113 int video_qdiff_; 00114 float video_qblur_; 00115 float video_qcomp_; 00116 vcl_string video_rc_eq_; 00117 int debug_; 00118 int debug_mv_; 00119 int video_rc_buffer_size_; 00120 float video_rc_buffer_aggressivity_; 00121 int video_rc_max_rate_; 00122 int video_rc_min_rate_; 00123 float video_rc_initial_cplx_; 00124 float video_b_qfactor_; 00125 float video_b_qoffset_; 00126 float video_i_qfactor_; 00127 float video_i_qoffset_; 00128 int video_intra_quant_bias_; 00129 int video_inter_quant_bias_; 00130 int dct_algo_; 00131 int idct_algo_; 00132 int me_threshold_; 00133 int mb_threshold_; 00134 int intra_dc_precision_; 00135 int strict_; 00136 int error_rate_; 00137 int noise_reduction_; 00138 int sc_threshold_; 00139 int coder_; 00140 int context_; 00141 int predictor_; 00142 #if 0 00143 // not supported by older versions of FFMPEG 00144 int video_profile_; 00145 int video_level_; 00146 #endif 00147 int me_range_; 00148 int do_psnr_; 00149 int packet_size_; 00150 int me_method_; 00151 int do_pass_; 00152 00153 //------------------------------------------------------- 00154 00155 //: Construct to default values 00156 vidl_ffmpeg_ostream_params(); 00157 00158 //: Set the file format 00159 vidl_ffmpeg_ostream_params& file_format( file_format_type t ) 00160 { file_format_ = t; return *this; } 00161 00162 //: Set the video encoder 00163 vidl_ffmpeg_ostream_params& encoder( encoder_type t ) 00164 { encoder_ = t; return *this; } 00165 00166 //: Set the frame rate 00167 vidl_ffmpeg_ostream_params& frame_rate( float r ) 00168 { frame_rate_ = r; return *this; } 00169 00170 //: Set the bit rate 00171 vidl_ffmpeg_ostream_params& bit_rate( unsigned r ) 00172 { bit_rate_ = r; return *this; } 00173 00174 //: Set the size of the frames 00175 vidl_ffmpeg_ostream_params& size( unsigned ni, unsigned nj ) 00176 { ni_ = ni; nj_ = nj; return *this; } 00177 }; 00178 00179 #endif // vidl_ffmpeg_ostream_params_h_