Mercurial > mplayer.hg
comparison libmpcodecs/ve_lavc.c @ 5632:93c9df5225a7
2-pass qscale fixed
author | arpi |
---|---|
date | Mon, 15 Apr 2002 13:39:48 +0000 |
parents | d9af91d38449 |
children | 8bec4d7d04f0 |
comparison
equal
deleted
inserted
replaced
5631:6cc3c2466288 | 5632:93c9df5225a7 |
---|---|
151 (float)mux_v->h.dwRate/mux_v->h.dwScale, | 151 (float)mux_v->h.dwRate/mux_v->h.dwScale, |
152 100, /* crispness */ | 152 100, /* crispness */ |
153 5) == -1){ | 153 5) == -1){ |
154 mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); | 154 mp_msg(MSGT_MENCODER,MSGL_ERR,"2pass failed: filename=%s\n", passtmpfile); |
155 pass=0; | 155 pass=0; |
156 } | 156 } else |
157 lavc_venc_context.flags|=CODEC_FLAG_QSCALE|CODEC_FLAG_TYPE; // VBR | |
157 break; | 158 break; |
158 } | 159 } |
159 | 160 |
160 if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) { | 161 if (avcodec_open(&lavc_venc_context, vf->priv->codec) != 0) { |
161 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec); | 162 mp_msg(MSGT_MENCODER,MSGL_ERR,MSGTR_CantOpenCodec); |
197 lavc_venc_picture.linesize[2]=mpi->stride[2]; | 198 lavc_venc_picture.linesize[2]=mpi->stride[2]; |
198 | 199 |
199 if(pass==2){ // handle 2-pass: | 200 if(pass==2){ // handle 2-pass: |
200 lavc_venc_context.flags|=CODEC_FLAG_QSCALE; // enable VBR | 201 lavc_venc_context.flags|=CODEC_FLAG_QSCALE; // enable VBR |
201 lavc_venc_context.quality=VbrControl_get_quant(); | 202 lavc_venc_context.quality=VbrControl_get_quant(); |
202 #ifdef CODEC_FLAG_TYPE | |
203 lavc_venc_context.flags|=CODEC_FLAG_TYPE; // force keyframes | |
204 lavc_venc_context.key_frame=VbrControl_get_intra(); | 203 lavc_venc_context.key_frame=VbrControl_get_intra(); |
205 lavc_venc_context.gop_size=0x3fffffff; | 204 lavc_venc_context.gop_size=0x3fffffff; |
206 #else | |
207 #error you should upgrade libavcodec... get latest CVS | |
208 #endif | |
209 out_size = avcodec_encode_video(&lavc_venc_context, mux_v->buffer, mux_v->buffer_size, | 205 out_size = avcodec_encode_video(&lavc_venc_context, mux_v->buffer, mux_v->buffer_size, |
210 &lavc_venc_picture); | 206 &lavc_venc_picture); |
211 VbrControl_update_2pass_vbr_encoding(lavc_venc_context.mv_bits, | 207 VbrControl_update_2pass_vbr_encoding(lavc_venc_context.mv_bits, |
212 lavc_venc_context.i_tex_bits+lavc_venc_context.p_tex_bits, | 208 lavc_venc_context.i_tex_bits+lavc_venc_context.p_tex_bits, |
213 8*out_size); | 209 8*out_size); |