[MPlayer-dev-eng] [SURVEY] change mencoder's default ofilename extension?
Oded Shimon
ods15 at ods15.dyndns.org
Mon Nov 28 20:52:34 CET 2005
On Mon, Nov 28, 2005 at 02:58:41PM -0300, Reynaldo H. Verdejo Pinochet wrote:
> On Mon, Nov 28, 2005 at 12:16:58PM -0500, The Wanderer wrote:
> > There is, of course, a fourth possibility, even though it may be too
> > difficult to code feasibly at this stage: detect the file type and
> > determine the default filename (or, rather, the default extension) based
> > on that. I don't expect anyone to support that unless they're willing to
> > do the work necessary to code it, but the option does theoretically
> > exist, and it is in principle probably the most correct way.
>
> lets just add this as '4.-' to the poll, I totally forgot it, weird toh
> in my first post I suggested this as a solution too.
I suggest a variant of this idea -
keep everything the same, except:
a BIG FAT warning, when you use an output file extention which doesn't math
the output file you're giving.
way too many idiots do 'mencoder -o bla.mpg' and expect an mpeg file.
making this automatic is NOT a good idea imo, because (for ex.) both lavf
and mpeg muxer support 'mpg', so, which to choose... so, instead, just say
extremely loudly "OUTPUT FILE IS AN AVI FILE. SEE -of help" (but still
encode as usual, after all, "the user is always right".)
coding this should be easy, only ones that need checking is muxer_avi and
muxer_mpeg, the rest don't fit. i'm thinking, 'avi' is a valid extention
for muxer_avi, and 'mpg', 'mpeg', and 'vob' are valid for muxer_mpeg...
anyone for this idea? against?
- ods15
P.S. I got inspired, so here's the patch...
-------------- next part --------------
Index: mencoder.c
===================================================================
RCS file: /cvsroot/mplayer/main/mencoder.c,v
retrieving revision 1.317
diff -u -r1.317 mencoder.c
--- mencoder.c 23 Oct 2005 15:05:11 -0000 1.317
+++ mencoder.c 28 Nov 2005 19:51:28 -0000
@@ -465,6 +465,22 @@
mp_msg_set_level(verbose+MSGL_STATUS);
+{
+ int i, n = 0;
+ for (i = 0; out_filename[i]; i++)
+ if (out_filename[i] == '.') n = i + 1;
+ if (out_file_format == MUXER_TYPE_AVI) {
+ if (strcmp(out_filename + n, "avi"))
+ mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatAVI);
+ }
+ if (out_file_format == MUXER_TYPE_MPEG) {
+ if (strcmp(out_filename + n, "mpg") &&
+ strcmp(out_filename + n, "mpeg") &&
+ strcmp(out_filename + n, "vob"))
+ mp_msg(MSGT_MENCODER, MSGL_WARN, MSGTR_MencoderWrongFormatMPG);
+ }
+}
+
if (frameno_filename) {
stream2=open_stream(frameno_filename,0,&i);
if(stream2){
Index: help/help_mp-en.h
===================================================================
RCS file: /cvsroot/mplayer/main/help/help_mp-en.h,v
retrieving revision 1.192
diff -u -r1.192 help_mp-en.h
--- help/help_mp-en.h 25 Oct 2005 18:47:20 -0000 1.192
+++ help/help_mp-en.h 28 Nov 2005 19:51:33 -0000
@@ -210,6 +210,8 @@
#define MSGTR_NoVideoEncoderSelected "\nNo video encoder (-ovc) selected. Select one (see -ovc help).\n"
#define MSGTR_CannotOpenOutputFile "Cannot open output file '%s'.\n"
#define MSGTR_EncoderOpenFailed "Failed to open the encoder.\n"
+#define MSGTR_MencoderWrongFormatAVI "WARNING: OUTPUT FILE FORMAT IS _AVI_. see -of help.\n"
+#define MSGTR_MencoderWrongFormatMPG "WARNING: OUTPUT FILE FORMAT IS _MPEG_. see -of help.\n"
#define MSGTR_ForcingOutputFourcc "Forcing output fourcc to %x [%.4s]\n"
#define MSGTR_ForcingOutputAudiofmtTag "Forcing output audio format tag to 0x%x\n"
#define MSGTR_WritingAVIHeader "Writing AVI header...\n"
More information about the MPlayer-dev-eng
mailing list