[xiph-commits] r9840 - trunk/ffmpeg2theora

j at svn.xiph.org j at svn.xiph.org
Wed Aug 24 10:55:56 PDT 2005


Author: j
Date: 2005-08-24 10:55:52 -0700 (Wed, 24 Aug 2005)
New Revision: 9840

Modified:
   trunk/ffmpeg2theora/ChangeLog
   trunk/ffmpeg2theora/Makefile.am
   trunk/ffmpeg2theora/ffmpeg2theora.1
   trunk/ffmpeg2theora/ffmpeg2theora.c
Log:
- rework, cmd line option parsing
- default output name is now without inputfile extension
        sample.avi -> sample.ogg
- update changelog and manpage



Modified: trunk/ffmpeg2theora/ChangeLog
===================================================================
--- trunk/ffmpeg2theora/ChangeLog	2005-08-24 12:39:29 UTC (rev 9839)
+++ trunk/ffmpeg2theora/ChangeLog	2005-08-24 17:55:52 UTC (rev 9840)
@@ -1,81 +1,87 @@
-0.13 	2005-03-12
-	- add new command line options, starttime, endtime, sharpness, keyint
-	- fix compile issues with new version of faad
-	- better support for stdout on win32,
-	   to allow ezstream streaming non-theora source types
-	- deinterlace only input marked as interlaced by default
-	- handle input files with frame sizes that are not a multiple of 16
-	- document --channels to resample audio to i.e. 1 channel
+0.14     2005-08-15
+    - add support for v4l input devices
+    - update to latest version of ffmpeg-cvs(now uses pkg-config)
+    - --audiostream id, new option to select an audio stream if 
+      input has more than one audio stream
 
-0.12 	2004-11-18
-	- add more command line options, for bitrate modes, metadata
-	- update kino plugin
+0.13     2005-03-12
+    - add new command line options, starttime, endtime, sharpness, keyint
+    - fix compile issues with new version of faad
+    - better support for stdout on win32,
+       to allow ezstream streaming non-theora source types
+    - deinterlace only input marked as interlaced by default
+    - handle input files with frame sizes that are not a multiple of 16
+    - document --channels to resample audio to i.e. 1 channel
 
-0.11 	2004-09-04
-	- changed default, then called without parameters to -p preview mode
-	- changed PREVIEW(PAL) settings to 384x288 to make pixel aspect ratio 1:1
-	- performance improvement if compiled with theora-mmx 
-	  [http://svn.xiph.org/branches/theora-mmx]
-	- new option: --aspect to define frame aspect ratio: i.e. 4:3 or 16:9
+0.12     2004-11-18
+    - add more command line options, for bitrate modes, metadata
+    - update kino plugin
 
-0.10.2 	2004-07-17
-	- add cropping support
-	- remove support for ffmpeg<0.4.9-pre1
-	- change configure.ac and Makefile.am to better build with
-	  mingw32
+0.11     2004-09-04
+    - changed default, then called without parameters to -p preview mode
+    - changed PREVIEW(PAL) settings to 384x288 to make pixel aspect ratio 1:1
+    - performance improvement if compiled with theora-mmx 
+      [http://svn.xiph.org/branches/theora-mmx]
+    - new option: --aspect to define frame aspect ratio: i.e. 4:3 or 16:9
 
-0.10.1 	2004-07-15 21:03:15
-	- fix problems with mpeg files using ffmpeg from cvs or versions
-	  newer than 0.4.8.
-	- remove --with-ffmpegcvs and detect changes by LIBAVCODEC_BUILD
+0.10.2     2004-07-17
+    - add cropping support
+    - remove support for ffmpeg<0.4.9-pre1
+    - change configure.ac and Makefile.am to better build with
+      mingw32
 
-0.10 	2004-07-10 18:14:15
-	- write eos at the end of the file.
-	- fix memleak due to not enough calls of ogg_stream_pageout
+0.10.1     2004-07-15 21:03:15
+    - fix problems with mpeg files using ffmpeg from cvs or versions
+      newer than 0.4.8.
+    - remove --with-ffmpegcvs and detect changes by LIBAVCODEC_BUILD
 
-0.9 	2004-07-04 13:14:15
-	- add presets
-	- add more comandline options
+0.10     2004-07-10 18:14:15
+    - write eos at the end of the file.
+    - fix memleak due to not enough calls of ogg_stream_pageout
 
-0.8 	2004-06-19 18:47:14
-	- use ffmpeg aspect ration if possible
-	- normalize quality options to 0-10
-	- fix skipping issues with a/v sync
+0.9     2004-07-04 13:14:15
+    - add presets
+    - add more comandline options
 
-0.7.1 	2004-05-31 01:55:40
-	- added --enable-ffmpegcvs to link against ffmpeg from cvs
-	- try to find and link to shared avcodec/avformat 
-	  if source not found
+0.8     2004-06-19 18:47:14
+    - use ffmpeg aspect ration if possible
+    - normalize quality options to 0-10
+    - fix skipping issues with a/v sync
 
-0.7 	2004-05-30 18:40:40
-	- add comandline options for audio/video quality
-	- fix bug causing crashes with DV files, without resizing
-	- use autotools
+0.7.1     2004-05-31 01:55:40
+    - added --enable-ffmpegcvs to link against ffmpeg from cvs
+    - try to find and link to shared avcodec/avformat 
+      if source not found
 
-0.6 	2004-05-06 13:47:30
-	- added resize option
+0.7     2004-05-30 18:40:40
+    - add comandline options for audio/video quality
+    - fix bug causing crashes with DV files, without resizing
+    - use autotools
 
+0.6     2004-05-06 13:47:30
+    - added resize option
+
 0.5.1   2004-03-27 21:59:40
-	- fix kino export
-	- add -f fmt do define input format.
+    - fix kino export
+    - add -f fmt do define input format.
 
-0.5 	2004-03-27 19:59:40
-	- link against shared library on linux
-	- kino export module and support to read from stdin
-	   [works only to some extend for now]
+0.5     2004-03-27 19:59:40
+    - link against shared library on linux
+    - kino export module and support to read from stdin
+       [works only to some extend for now]
 
 0.4
-	- fix wrong deinterlaceing
-	- change memory allocation to work with mingw32
+    - fix wrong deinterlaceing
+    - change memory allocation to work with mingw32
 
 0.3
-	- make encoding of audio only files possible. 
-	  can be used to transcode audio files[mp4,wav,ac3...] to ogg vorbis now
-	  time to call if ffmpeg2ogg?
-	- some code cleanup
+    - make encoding of audio only files possible. 
+      can be used to transcode audio files[mp4,wav,ac3...] to ogg vorbis now
+      time to call if ffmpeg2ogg?
+    - some code cleanup
 
 0.2
-	- added deinterlace support
-	
+    - added deinterlace support
+    
 0.1
-	- initial version
+    - initial version

Modified: trunk/ffmpeg2theora/Makefile.am
===================================================================
--- trunk/ffmpeg2theora/Makefile.am	2005-08-24 12:39:29 UTC (rev 9839)
+++ trunk/ffmpeg2theora/Makefile.am	2005-08-24 17:55:52 UTC (rev 9840)
@@ -2,7 +2,7 @@
 
 SUBDIRS = kino_export
 
-EXTRA_DIST = Makefile.mingw32 theorautils.h get_ffmpeg_cvs.sh
+EXTRA_DIST = Makefile.mingw32 theorautils.h get_ffmpeg_cvs.sh ffmpeg2theora.1
 
 EXTRA=-D_FILE_OFFSET_BITS=64 -I$(prefix)/include
 

Modified: trunk/ffmpeg2theora/ffmpeg2theora.1
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.1	2005-08-24 12:39:29 UTC (rev 9839)
+++ trunk/ffmpeg2theora/ffmpeg2theora.1	2005-08-24 17:55:52 UTC (rev 9840)
@@ -86,13 +86,17 @@
 \*(lqffmpeg2theora -p info\*(rq for more information.
 .SS Input options:
 .TP
-.B \-d, \-\-deinterlace
+.B \-\-deinterlace
 Force deinterlace.  Otherwise only material marked as interlaced will be
 deinterlaced.
 .TP
 .B \-f, \-\-format
 Specify input format.
 .TP
+.B \-\-v4l  /dev/video0
+read data from v4l device /dev/video0, 
+you have to specify an output file with -0
+.TP
 .B \-\-inputfps
 Override input fps.
 .SS Metadata options:

Modified: trunk/ffmpeg2theora/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.c	2005-08-24 12:39:29 UTC (rev 9839)
+++ trunk/ffmpeg2theora/ffmpeg2theora.c	2005-08-24 17:55:52 UTC (rev 9840)
@@ -37,6 +37,19 @@
 
 #include "theorautils.h"
 
+#define DEINTERLACE_FLAG     1
+#define DEBUG_FLAG           2
+#define SYNC_FLAG            3
+#define NOSOUND_FLAG         4
+#define V4L_FLAG             5
+#define CROPTOP_FLAG         6
+#define CROPBOTTOM_FLAG      7
+#define CROPRIGHT_FLAG       8
+#define CROPLEFT_FLAG        9
+#define ASPECT_FLAG         10
+#define INPUTFPS_FLAG       11
+#define AUDIOSTREAM_FLAG    12
+
 static double rint(double x) {
     if (x < 0.0)
         return (double)(int)(x - 0.5);
@@ -690,7 +703,7 @@
         "\t\t\t\t '"PACKAGE" -p info' for more informations\n"
     
         "\nInput options:\n"
-        "\t --deinterlace,-d \tforce deinterlace\n"
+        "\t --deinterlace \tforce deinterlace\n"
         "\t\t\t\t otherwise only material marked as interlaced \n"
         "\t\t\t\t will be deinterlaced\n"
         "\t --format,-f\t\tspecify input format\n"
@@ -739,20 +752,11 @@
     int  outputfile_set=0;
     char outputfile_name[255];
     char inputfile_name[255];
+    char *str_ptr;
     
-    static int croptop_flag=0;
-    static int cropbottom_flag=0;
-    static int cropright_flag=0;
-    static int cropleft_flag=0;    
-    static int nosound_flag=0;    
-    static int aspect_flag=0;
-    static int inputfps_flag=0;
+    static int flag=-1;
     static int metadata_flag=0;
-    static int deinterlace_flag=0;
-    static int audiostream_flag=0;
-    static int sync_flag=0;
-    static int v4l_flag=0;
-    
+
     AVInputFormat *input_fmt = NULL;
     AVFormatParameters *formatParams = NULL;
     
@@ -769,23 +773,23 @@
       {"audiobitrate",required_argument,NULL,'A'},
       {"sharpness",required_argument,NULL,'S'},
       {"keyint",required_argument,NULL,'K'},
-      {"deinterlace",0,&deinterlace_flag,'d'},
+      {"deinterlace",0,&flag,DEINTERLACE_FLAG},
       {"samplerate",required_argument,NULL,'H'},
       {"channels",required_argument,NULL,'c'},
-      {"nosound",0,&nosound_flag,1},
-      {"v4l",required_argument,&v4l_flag,1},
-      {"aspect",required_argument,&aspect_flag,1},
+      {"nosound",0,&flag,NOSOUND_FLAG},
+      {"v4l",required_argument,&flag,V4L_FLAG},
+      {"aspect",required_argument,&flag,ASPECT_FLAG},
       {"v2v-preset",required_argument,NULL,'p'},
       {"nice",required_argument,NULL,'N'},
-      {"croptop",required_argument,&croptop_flag,1},
-      {"cropbottom",required_argument,&cropbottom_flag,1},
-      {"cropright",required_argument,&cropright_flag,1},
-      {"cropleft",required_argument,&cropleft_flag,1},
-      {"inputfps",required_argument,&inputfps_flag,1},
-      {"audiostream",required_argument,&audiostream_flag,1},
+      {"croptop",required_argument,&flag,CROPTOP_FLAG},
+      {"cropbottom",required_argument,&flag,CROPBOTTOM_FLAG},
+      {"cropright",required_argument,&flag,CROPRIGHT_FLAG},
+      {"cropleft",required_argument,&flag,CROPLEFT_FLAG},
+      {"inputfps",required_argument,&flag,INPUTFPS_FLAG},
+      {"audiostream",required_argument,&flag,AUDIOSTREAM_FLAG},
       {"starttime",required_argument,NULL,'s'},
       {"endtime",required_argument,NULL,'e'},
-      {"sync",0,&sync_flag,1},
+      {"sync",0,&flag,SYNC_FLAG},
   
       {"artist",required_argument,&metadata_flag,10},
       {"title",required_argument,&metadata_flag,11},
@@ -795,7 +799,7 @@
       {"copyright",required_argument,&metadata_flag,15},
       {"license",required_argument,&metadata_flag,16},
 
-      {"debug",0,NULL,'D'},
+      {"debug",0,&flag,DEBUG_FLAG},
       {"help",0,NULL,'h'},
       {NULL,0,NULL,0}
     };
@@ -814,53 +818,62 @@
         switch(c)
         {
             case 0:
-                if (sync_flag){
-                    convert->sync=1;
-                    sync_flag=0;
+                if (flag) {
+                    switch (flag) 
+                    {
+                        case DEINTERLACE_FLAG:
+                            convert->deinterlace=1;
+                            flag=-1;
+                            break;
+                        case DEBUG_FLAG:
+                            info.debug=1;
+                            flag=-1;
+                            break;
+                        case SYNC_FLAG:
+                            convert->sync=1;
+                            flag=-1;
+                            break;
+                        case NOSOUND_FLAG:
+                            convert->disable_audio=1;
+                            flag=-1;
+                            break;
+                        case V4L_FLAG:
+                            formatParams = malloc(sizeof(AVFormatParameters));
+                            formatParams->device = optarg;
+                            flag=-1;
+                            break;
+                /* crop */
+                        case CROPTOP_FLAG:
+                            convert->frame_topBand=crop_check(convert,"top",optarg);
+                            flag=-1;
+                            break;
+                        case CROPBOTTOM_FLAG:
+                            convert->frame_bottomBand=crop_check(convert,"bottom",optarg);
+                            flag=-1;
+                            break;
+                        case CROPRIGHT_FLAG:
+                            convert->frame_rightBand=crop_check(convert,"right",optarg);
+                            flag=-1;
+                            break;
+                        case CROPLEFT_FLAG:
+                            convert->frame_leftBand=crop_check(convert,"left",optarg);
+                            flag=-1;
+                            break;
+                        case ASPECT_FLAG:
+                            convert->frame_aspect=aspect_check(optarg);
+                            flag=-1;
+                            break;
+                        case INPUTFPS_FLAG:
+                            convert->force_input_fps=atof(optarg);
+                            flag=-1;
+                            break;
+                        case AUDIOSTREAM_FLAG:
+                            convert->audiostream=atoi(optarg);;
+                            flag=-1;
+                            break;
+                    }
                 }
 
-                if (nosound_flag){
-                    convert->disable_audio=1;
-                    nosound_flag=0;
-                }
-                if (v4l_flag) {
-                    formatParams = malloc(sizeof(AVFormatParameters));
-                    formatParams->device = optarg;
-                    v4l_flag = 0;
-                }
-                if (deinterlace_flag){
-                    convert->deinterlace=1;
-                    deinterlace_flag=0;
-                }
-                /* crop */
-                if (croptop_flag){
-                    convert->frame_topBand=crop_check(convert,"top",optarg);
-                    croptop_flag=0;
-                }
-                if (cropbottom_flag){
-                    convert->frame_bottomBand=crop_check(convert,"bottom",optarg);
-                    cropbottom_flag=0;
-                }
-                if (cropright_flag){
-                    convert->frame_rightBand=crop_check(convert,"right",optarg);
-                    cropright_flag=0;
-                }
-                if (cropleft_flag){
-                    convert->frame_leftBand=crop_check(convert,"left",optarg);
-                    cropleft_flag=0;
-                }
-                if (aspect_flag){
-                    convert->frame_aspect=aspect_check(optarg);
-                    aspect_flag=0;
-                }
-                if (inputfps_flag){
-                    convert->force_input_fps=atof(optarg);
-                    inputfps_flag=0;
-                }
-                if (audiostream_flag){
-                    convert->audiostream=atoi(optarg);;
-                    audiostream_flag=0;
-                }
                 /* metadata */
                 if (metadata_flag){
                     switch(metadata_flag) {
@@ -954,12 +967,6 @@
                     exit(1);
                 }
                 break;                        
-            case 'd':
-                if(!strcmp(optarg,"off"))
-                    convert->deinterlace=0;
-                else
-                    convert->deinterlace=1;
-                break;
             case 'H':
                 convert->sample_rate=atoi(optarg);
                 break;
@@ -1007,10 +1014,6 @@
 #endif
                 }
                 break;
-            case 'D':
-                //enable debug informations
-                info.debug=1;
-                break;
             case 'h':
                 print_usage ();
                 exit(1);
@@ -1033,7 +1036,13 @@
             sprintf(inputfile_name,"pipe:");
         }
         if(outputfile_set!=1){
-            sprintf(outputfile_name,"%s.ogg",argv[optind]);
+            sprintf(outputfile_name, "%s", argv[optind]);
+            if(str_ptr = rindex(outputfile_name, '.')) {
+                sprintf(str_ptr, ".ogg");
+            }
+           else {
+                sprintf(outputfile_name, "%s.ogg", outputfile_name);
+            }
             outputfile_set=1;
         }
         optind++;



More information about the commits mailing list