[MPlayer-dev-eng] [PATCH] RFC frameno options with cdsize with DOCs
Jan Gutter
jan at ist.co.za
Mon May 3 16:34:33 CEST 2004
Here's the frameno options patch with documentation added.
Any comments on how to improve the patch (for example, completely
dropping it and going into exile) would be appreciated!
diff -urN main~/DOCS/man/en/mplayer.1 main/DOCS/man/en/mplayer.1
--- main~/DOCS/man/en/mplayer.1 2004-05-03 16:13:53.862217512 +0200
+++ main/DOCS/man/en/mplayer.1 2004-05-03 16:19:07.520534200 +0200
@@ -4041,6 +4041,8 @@
encode to arbitrary uncompressed format (use \-vf format to select)
.IPs "\-ovc lavc"
encode with a libavcodec codecs
+.IPs "\-ovc frameno"
+pseudo\-codec used in three\-pass encoding to calculate the bitrate
.RE
.PD 1
.
@@ -5285,6 +5287,25 @@
.TP
.B kfreduction=<0\-100>
(default=30, 2pass mode only)
+.
+.SS frameno (\-framenoopts)
+.
+The frameno pseudo-codec is used to calculate the required bitrate for a
+two\-pass encoding session more precisely. In order to to this, only the audio
+is compressed. After the size of the compressed audio is subtracted from the
+target size, a much more accurate guess can be made for the target bitrate.
+.br
+.I NOTE:
+Three\-pass encoding is documented much more thoroughly in the mencoder
+documentation. You are encouraged to consult it.
+.TP
+.B cdsize=<0\-32000>
+Target file size in MB. If not given, a range of example sizes and bitrates
+will be output upon completion.
+.TP
+.B filename=<filename>
+The default file name to be used is frameno.avi. Using this option, another
+output for the dummy file can be specified.
.RE
.PP
diff -urN main~/DOCS/xml/en/mencoder.xml main/DOCS/xml/en/mencoder.xml
--- main~/DOCS/xml/en/mencoder.xml 2004-05-03 16:13:53.872215992 +0200
+++ main/DOCS/xml/en/mencoder.xml 2004-05-03 16:17:07.698749880 +0200
@@ -69,6 +69,11 @@
long movie, <application>MEncoder</application> prints the recommended
bitrate values for 650Mb, 700Mb, and 800Mb destination sizes, after this
pass finishes.
+ </para>
+ <para>
+ If a custom CD size is needed, use the
+ <option>-framenoopts cdsize=<replaceable>size in MB</replaceable></option>
+ option to specify the destination size for the bitrate calculation, in Mb.
</para></step>
<step><para>
<emphasis>Second pass:</emphasis>
diff -urN main~/cfg-mencoder.h main/cfg-mencoder.h
--- main~/cfg-mencoder.h 2004-05-03 16:13:54.083183920 +0200
+++ main/cfg-mencoder.h 2004-05-03 16:19:27.731461672 +0200
@@ -61,6 +61,8 @@
extern m_option_t nuvopts_conf[];
+extern m_option_t framenoopts_conf[];
+
m_option_t ovc_conf[]={
{"copy", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_COPY, NULL},
{"frameno", &out_video_codec, CONF_TYPE_FLAG, 0, 0, VCODEC_FRAMENO, NULL},
@@ -238,6 +240,8 @@
{"nuvopts", nuvopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+ {"framenoopts", framenoopts_conf, CONF_TYPE_SUBCONFIG, 0, 0, 0, NULL},
+
#define MAIN_CONF
#include "cfg-common.h"
#undef MAIN_CONF
diff -urN main~/mencoder.c main/mencoder.c
--- main~/mencoder.c 2004-05-03 16:13:56.523812888 +0200
+++ main/mencoder.c 2004-05-03 16:19:27.737460760 +0200
@@ -233,6 +233,16 @@
#endif
#endif
+// frameno "codec" options
+unsigned int frameno_cdsize = 0; // Default behavior -- print old output
+char* frameno_filename = "frameno.avi"; // use frameno.avi
+
+m_option_t framenoopts_conf[]={
+ {"filename", &frameno_filename, CONF_TYPE_STRING, 0, 0, 0, NULL},
+ {"cdsize", &frameno_cdsize, CONF_TYPE_INT, M_OPT_RANGE, 0, 32000, NULL},
+ {NULL, NULL, 0, 0, 0, 0, NULL}
+};
+
//static int vo_w=0, vo_h=0;
//-------------------------- config stuff:
@@ -368,7 +378,6 @@
m_entry_t* filelist = NULL;
char* filename=NULL;
-char* frameno_filename="frameno.avi";
int decoded_frameno=0;
int next_frameno=-1;
@@ -1497,12 +1506,19 @@
vobsub_out_close(vobsub_writer);
if(out_video_codec==VCODEC_FRAMENO && mux_v->timer>100){
- printf(MSGTR_RecommendedVideoBitrate,"650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));
- printf(MSGTR_RecommendedVideoBitrate,"700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
- printf(MSGTR_RecommendedVideoBitrate,"800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125));
- printf(MSGTR_RecommendedVideoBitrate,"2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125));
- printf(MSGTR_RecommendedVideoBitrate,"2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125));
- printf(MSGTR_RecommendedVideoBitrate,"2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125));
+ if(frameno_cdsize==0){
+ printf(MSGTR_RecommendedVideoBitrate,"650MB",(int)((650*1024*1024-muxer_f_size)/mux_v->timer/125));
+ printf(MSGTR_RecommendedVideoBitrate,"700MB",(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
+ printf(MSGTR_RecommendedVideoBitrate,"800MB",(int)((800*1024*1024-muxer_f_size)/mux_v->timer/125));
+ printf(MSGTR_RecommendedVideoBitrate,"2 x 650MB",(int)((2*650*1024*1024-muxer_f_size)/mux_v->timer/125));
+ printf(MSGTR_RecommendedVideoBitrate,"2 x 700MB",(int)((2*700*1024*1024-muxer_f_size)/mux_v->timer/125));
+ printf(MSGTR_RecommendedVideoBitrate,"2 x 800MB",(int)((2*800*1024*1024-muxer_f_size)/mux_v->timer/125));
+ }
+ else{
+ char tmp[80];
+ sprintf(tmp,"%dMB",frameno_cdsize);
+ printf(MSGTR_RecommendedVideoBitrate,tmp,(int)((frameno_cdsize*1024*1024-muxer_f_size)/mux_v->timer/125));
+ }
}
printf(MSGTR_VideoStreamResult,
More information about the MPlayer-dev-eng
mailing list