[MPlayer-dev-eng] [PATCH] RFC frameno options with cdsize with DOCs

Jan Gutter jan at ist.co.za
Tue May 4 17:10:05 CEST 2004


Hi all!

The latest iteration of the patch has arrived. Comments welcome!

Patch summary:

1) Adds a new option <-framenoopts> with suboptions <cdsize> and
   <filename>.
 - This allows the manual specification of cd size in the first pass of
   three-pass encoding. frameno.avi can also be overridden.

2) Modifies the default behaviour of -ovc frameno to print a message 
   that the new options are available.
 - This message needs to be translated.
   (MSGTR_FramenoOptsIsAvailable)

3) Modifies the message string that prints the recommended bitrate to 
   accept an integer value in stead of a string, thus avoiding a 
   necessary temporary string.
 - This message needs to be edited in all the translations.
   (MSGTR_RecommendedVideoBitrate)

4) Adds documentation to the English manual page of mencoder/mplayer.
 - In order to promote conformity, capitalisation and punctuation of the
   codec list is touched.
 - This needs to be translated.

5) Adds documentation to the English mencoder.xml DOC page.
 - Mb is used in stead of MB for the sake of conformity within 
   mencoder.xml.
 - This needs to be translated.

==========
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.000000000 +0200
+++ main/DOCS/man/en/mplayer.1	2004-05-04 15:25:02.335071560 +0200
@@ -4034,13 +4034,15 @@
 .PD 0
 .RSs
 .IPs "\-ovc copy"
-no encoding, just streamcopy
+No encoding, just streamcopy.
 .IPs "\-ovc divx4"
-encode to DivX4/\:DivX5
+Encode to DivX4/\:DivX5.
 .IPs "\-ovc raw"
-encode to arbitrary uncompressed format (use \-vf format to select)
+Encode to arbitrary uncompressed format (use \-vf format to select).
 .IPs "\-ovc lavc"
-encode with a libavcodec codecs
+Encode with a libavcodec codec.
+.IPs "\-ovc frameno"
+A pseudo-codec used in three-pass encoding to calculate bitrates.
 .RE
 .PD 1
 .
@@ -5217,6 +5219,27 @@
 .B rtjpeg\ 
 Enable rtjpeg encoding.
 .
+.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>
+The default target size is 700MB.
+Using this option, the target size in MB may be specified.
+.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.
+.
 .SS xvidenc (\-xvidencopts)
 .
 There are three modes available: constant bitrate (CBR), fixed
quantizer and
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.000000000 +0200
+++ main/DOCS/xml/en/mencoder.xml	2004-05-04 15:25:51.933531448 +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~/TOOLS/dvd2divxscript.pl main/TOOLS/dvd2divxscript.pl
--- main~/TOOLS/dvd2divxscript.pl	2004-05-03 16:13:54.000000000 +0200
+++ main/TOOLS/dvd2divxscript.pl	2004-05-04 16:43:20.432852136 +0200
@@ -128,19 +128,11 @@
 	exit;
 }
 
-if ($cdsize == 650) {}
-elsif ($cdsize == 700) {}
-elsif ($cdsize == 800) {}
-elsif ($cdsize == 0 ) {
+if ($cdsize == 0 ) {
 	print "No CD Size Specified - Setting to Default Value\n";
 	$cdsize = $cdsize_default;
 }
 
-else	{
-print "CD Size not valid. please choose [650|700|800]\n";
-exit;
-}
-
 if ($output eq "") {
 	print "No MovieName given - You must specify one with: --out
[movie_name]\n";
 	exit;
@@ -205,7 +197,7 @@
 die "Prechacheing failed. mencoder exited with Status Code $?" unless
$status == 0;
 
 print "Encoding Audio...\n";
-$status = system ("mencoder $vob_tempfile -ovc frameno -oac mp3lame
-lameopts br=$abr:cbr:vol=3 -o frameno.avi 1>./audio.stderr
2>/dev/tty8");
+$status = system ("mencoder $vob_tempfile -ovc frameno -framenoopts
cdsize=$cdsize -oac mp3lame -lameopts br=$abr:cbr:vol=3 -o frameno.avi
1>./audio.stderr 2>/dev/tty8");
 die "Encoding Audio failed. mencoder exited with Status Code $?" unless
$status == 0;
 
 # now we have to find out the recommended bitrate for the Video
encoding process...
diff -urN main~/cfg-mencoder.h main/cfg-mencoder.h
--- main~/cfg-mencoder.h	2004-05-03 16:13:54.000000000 +0200
+++ main/cfg-mencoder.h	2004-05-04 15:15:57.045968104 +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~/help/help_mp-en.h main/help/help_mp-en.h
--- main~/help/help_mp-en.h	2004-05-03 16:13:53.000000000 +0200
+++ main/help/help_mp-en.h	2004-05-04 15:41:13.671405992 +0200
@@ -179,7 +179,8 @@
 #define MSGTR_ErrorWritingFile "%s: Error writing file.\n"
 #define MSGTR_WritingAVIIndex "\nWriting AVI index...\n"
 #define MSGTR_FixupAVIHeader "Fixing AVI header...\n"
-#define MSGTR_RecommendedVideoBitrate "Recommended video bitrate for %s
CD: %d\n"
+#define MSGTR_RecommendedVideoBitrate "Recommended video bitrate for
%dMB CD: %d\n"
+#define MSGTR_FramenoOptsIsAvailable "Use -framenoopts cdsize=<size in
MB> to specify size.\n"
 #define MSGTR_VideoStreamResult "\nVideo stream: %8.3f kbit/s  (%d
bps)  size: %d bytes  %5.3f secs  %d frames\n"
 #define MSGTR_AudioStreamResult "\nAudio stream: %8.3f kbit/s  (%d
bps)  size: %d bytes  %5.3f secs\n"
 
diff -urN main~/mencoder.c main/mencoder.c
--- main~/mencoder.c	2004-05-03 16:13:56.000000000 +0200
+++ main/mencoder.c	2004-05-04 15:41:29.443008344 +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,13 @@
     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,700,(int)((700*1024*1024-muxer_f_size)/mux_v->timer/125));
+        printf(MSGTR_FramenoOptsIsAvailable);
+    } 
+    else {
+       
printf(MSGTR_RecommendedVideoBitrate,frameno_cdsize,(int)((frameno_cdsize*1024*1024-muxer_f_size)/mux_v->timer/125));
+    }
 }
 
 printf(MSGTR_VideoStreamResult,





More information about the MPlayer-dev-eng mailing list