[xiph-commits] r10557 - trunk/ffmpeg2theora

j at svn.xiph.org j at svn.xiph.org
Tue Dec 6 18:32:40 PST 2005


Author: j
Date: 2005-12-06 18:32:28 -0800 (Tue, 06 Dec 2005)
New Revision: 10557

Modified:
   trunk/ffmpeg2theora/ChangeLog
   trunk/ffmpeg2theora/INSTALL
   trunk/ffmpeg2theora/ffmpeg2theora.1
   trunk/ffmpeg2theora/ffmpeg2theora.c
   trunk/ffmpeg2theora/get_ffmpeg_cvs.sh
Log:
update manpage, make v4l elements optional.


Modified: trunk/ffmpeg2theora/ChangeLog
===================================================================
--- trunk/ffmpeg2theora/ChangeLog	2005-12-06 23:48:24 UTC (rev 10556)
+++ trunk/ffmpeg2theora/ChangeLog	2005-12-07 02:32:28 UTC (rev 10557)
@@ -2,10 +2,12 @@
     - support encoding from .ogg input file.
     - don't change samplerate and audio channel unless we use command line
       options.
-    - don't change the resolution image, unless we use the presets or the
-      -x or -y options. (old default was to encode to preset preview)
+    - don't change the image resolution, unless we use the presets or the
+      -x or -y options (old default was to encode to preset preview).
     - change the audio quality levels that were multiplied by 0.99, now 
       match the quality settings of oggenc, e.g. -a2 == -q2.
+    - add --optimize option: use a full search for motion vectors and
+      reduce Theora bitrate by about 5%, but it is slower.
 
 0.15     2005-08-31
     - ti.dropframes_p = 0 so we do not loos half of the frames.

Modified: trunk/ffmpeg2theora/INSTALL
===================================================================
--- trunk/ffmpeg2theora/INSTALL	2005-12-06 23:48:24 UTC (rev 10556)
+++ trunk/ffmpeg2theora/INSTALL	2005-12-07 02:32:28 UTC (rev 10557)
@@ -13,9 +13,9 @@
 ---------------------------------
 you need
 - the latest version of libtheora ( http://www.theora.org/files )
-- ffmpeg-cvs ( http://ffmpeg.sf.net ) / by running ./get_ffmpeg_cvs.sh
-  configure it with i.e.
-  ./configure --disable-encoder --enable-faad --enable-pp --enable-a52  --enable-dts --enable-pthreads --disable-vhook --enable-gpl --enable-libogg --enable-vorbis --enable-theora
+- ffmpeg-cvs ( http://ffmpeg.sf.net ) by running ./get_ffmpeg_cvs.sh
+  (this script downloads current CVS ffmpeg, runs an appropriate
+  configure and builds ffmpeg)
 
 if you did not install ffmpeg but want to staticly link it
 (recomended by ffmpeg developers) update PKG_CONFIG_PATH to
@@ -28,7 +28,7 @@
 make
 
 
-Compinling on windows using mingw32:
+Compiling on windows using mingw32:
 ---------------------------------
 you have to compile libvorbis, libogg, libtheora
 configure ffmpeg like this:

Modified: trunk/ffmpeg2theora/ffmpeg2theora.1
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.1	2005-12-06 23:48:24 UTC (rev 10556)
+++ trunk/ffmpeg2theora/ffmpeg2theora.1	2005-12-07 02:32:28 UTC (rev 10557)
@@ -1,5 +1,5 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
-.TH FFMPEG2THEORA 1 "June 14, 2005"
+.TH FFMPEG2THEORA 1 "November 27, 2005"
 .\" Please adjust this date whenever revising the manpage.
 .\"
 .\" Some roff macros, for reference:
@@ -13,7 +13,8 @@
 .\" .sp <n>    insert n+1 empty lines
 .\" for manpage-specific macros, see man(7)
 .SH NAME
-ffmpeg2theora \- command-line converter to create Ogg Theora files
+ffmpeg2theora \- command-line converter to create Ogg Theora and Ogg
+Vorbis files.
 .SH SYNOPSIS
 .B ffmpeg2theora
 .RI [ options ] " inputfile" 
@@ -39,7 +40,7 @@
 [0 to 10] Set encoding quality for video (default: 5).
 .TP
 .B \-V, \-\-videobitrate
-[45 to 2000] Set encoding bitrate for video.
+[45 to 2000] Set encoding bitrate for video (in kb/s).
 .TP
 .B \-x, \-\-width
 Scale to given width.
@@ -53,6 +54,11 @@
 .B \-\-crop[top|bottom|left|right]
 Crop input before resizing.
 .TP
+.B \-\-optimize
+Optimize output Theora video, using a full search for motion vectors
+instead of a hierarchical one. This can reduce video bitrate about 5%,
+but it is slower and therefore is disabled by default.
+.TP
 .B \-S, \-\-sharpness
 [0 to 2] Sharpness of images (default: 2).  Note: lower values make the video
 sharper.
@@ -61,13 +67,13 @@
 [8 to 65536] Set keyframe interval (default: 64).
 .TP
 .B \-a, \-\-audioquality
-[-1 to 10] Set encoding quality for audio (default: 1).
+[-2 to 10] Set encoding quality for audio (default: 1).
 .TP
 .B \-A, \-\-audiobitrate
-[45 to 2000] Set encoding bitrate for audio.
+[32 to 2000] Set encoding bitrate for audio (in kb/s).
 .TP
 .B \-H, \-\-samplerate
-Set output samplerate in Hz.
+Set output samplerate (in Hz).
 .TP
 .B \-c, \-\-channels
 Set number of output channels.

Modified: trunk/ffmpeg2theora/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.c	2005-12-06 23:48:24 UTC (rev 10556)
+++ trunk/ffmpeg2theora/ffmpeg2theora.c	2005-12-07 02:32:28 UTC (rev 10557)
@@ -38,10 +38,16 @@
 
 #include "theorautils.h"
 
+#ifdef __linux__
+  #define VIDEO4LINUX_ENABLED
+#endif
+
 #define DEINTERLACE_FLAG     1
 #define SYNC_FLAG            3
 #define NOSOUND_FLAG         4
-#define V4L_FLAG             5
+#ifdef VIDEO4LINUX_ENABLED
+  #define V4L_FLAG           5
+#endif
 #define CROPTOP_FLAG         6
 #define CROPBOTTOM_FLAG      7
 #define CROPRIGHT_FLAG       8
@@ -49,6 +55,7 @@
 #define ASPECT_FLAG         10
 #define INPUTFPS_FLAG       11
 #define AUDIOSTREAM_FLAG    12
+#define OPTIMIZE_FLAG       13
 
 #define V2V_PRESET_PRO 1
 #define V2V_PRESET_PREVIEW 2
@@ -90,6 +97,7 @@
     int video_bitrate;
     int sharpness;
     int keyint;
+    int quick_p;
 
     double force_input_fps;
     int sync;
@@ -177,6 +185,7 @@
         this->video_bitrate=0;
         this->sharpness=2;
         this->keyint=64;
+        this->quick_p=1;
         this->force_input_fps=0;
         this->sync=0;
         this->aspect_numerator=0;
@@ -470,7 +479,7 @@
             info.ti.target_bitrate = this->video_bitrate; 
             info.ti.quality = this->video_quality;
             info.ti.dropframes_p = 0;
-            info.ti.quick_p = 1;
+            info.ti.quick_p = this->quick_p;
             info.ti.keyframe_auto_p = 1;
             info.ti.keyframe_frequency = this->keyint;
             info.ti.keyframe_frequency_force = this->keyint;
@@ -735,10 +744,10 @@
         "v2v presets\n"
         "preview\t\thalf size DV video. encoded with Ogg Theora/Ogg Vorbis\n"
         "\t\t\tVideo: Quality 5;\n"
-        "\t\t\tAudio: Quality 1 - 44,1kHz - Stereo\n\n"
+        "\t\t\tAudio: Quality 1 - Stereo\n\n"
         "pro\t\tfull size DV video. encoded with Ogg Theora/Ogg Vorbis \n"
         "\t\t\tVideo: Quality 7;\n"
-        "\t\t\tAudio: Quality 3 - 48kHz - Stereo\n"
+        "\t\t\tAudio: Quality 3 - Stereo\n"
         "\n");
 }
 
@@ -756,12 +765,13 @@
         "\t --height,-y\t\tscale to given size\n"
         "\t --aspect\t\tdefine frame aspect ratio: i.e. 4:3 or 16:9\n"
         "\t --crop[top|bottom|left|right]\tcrop input before resizing\n"        
+        "\t --optimize      \toptimize video output filesize (very slow)\n"
         "\t --sharpness,-S  \t[0 to 2] sharpness of images (default: 2)\n"
         "\t                 \t { lower values make the video sharper. }\n"
         "\t --keyint,-K      \t[8 to 65536] keyframe interval (default: 64)\n"
-        "\t --audioquality,-a\t[-1 to 10] encoding quality for audio\n"
+        "\t --audioquality,-a\t[-2 to 10] encoding quality for audio\n"
         "\t                 \t (default: 1)\n"
-        "\t --audiobitrate,-A\t[45 to 2000] encoding bitrate for audio\n"
+        "\t --audiobitrate,-A\t[32 to 2000] encoding bitrate for audio\n"
         "\t --samplerate,-H\tset output samplerate in Hz\n"
         "\t --channels,-c\t\tset number of output sound channels\n"
         "\t --nosound\t\tdisable the sound from input\n"
@@ -772,12 +782,14 @@
         "\t\t\t\t '"PACKAGE" -p info' for more informations\n"
     
         "\nInput options:\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 --deinterlace \t\tforce deinterlace\n"
+        "\t\t\t\totherwise only material marked as interlaced \n"
+        "\t\t\t\twill be deinterlaced\n"
         "\t --format,-f\t\tspecify input format\n"
+#ifdef VIDEO4LINUX_ENABLED
         "\t --v4l   /dev/video0\tread data from v4l device /dev/video0\n"
         "\t            \t\tyou have to specifiy an output file with -o\n"
+#endif
         "\t --inputfps [fps]\toverride input fps\n"
         "\t --audiostream streamid\tby default the last audiostream is selected,\n"
         "\t                 \tuse this to select another audio stream\n"
@@ -805,9 +817,11 @@
     
         "\tffmpeg2theora videoclip.avi (will write output to videoclip.ogg)\n\n"
         "\tcat something.dv | ffmpeg2theora -f dv -o output.ogg -\n\n"
+#ifdef VIDEO4LINUX_ENABLED
         "\tLive streaming from V4L Device:\n"
         "\t ffmpeg2theora --v4l /dev/video0 --inputfps 15 -x 160 -y 128 -o - \\ \n"
         "\t\t | oggfwd iccast2server 8000 password /theora.ogg\n\n"
+#endif
         "\tLive encoding from a DV camcorder (needs a fast machine):\n"
         "\t dvgrab - | ffmpeg2theora -f dv -x 352 -y 288 -o output.ogg -\n"
         "\n\tLive encoding and streaming to icecast server:\n"
@@ -848,7 +862,9 @@
       {"samplerate",required_argument,NULL,'H'},
       {"channels",required_argument,NULL,'c'},
       {"nosound",0,&flag,NOSOUND_FLAG},
+#ifdef VIDEO4LINUX_ENABLED
       {"v4l",required_argument,&flag,V4L_FLAG},
+#endif
       {"aspect",required_argument,&flag,ASPECT_FLAG},
       {"v2v-preset",required_argument,NULL,'p'},
       {"nice",required_argument,NULL,'N'},
@@ -861,7 +877,8 @@
       {"starttime",required_argument,NULL,'s'},
       {"endtime",required_argument,NULL,'e'},
       {"sync",0,&flag,SYNC_FLAG},
-  
+      {"optimize",0,&flag,OPTIMIZE_FLAG},
+
       {"artist",required_argument,&metadata_flag,10},
       {"title",required_argument,&metadata_flag,11},
       {"date",required_argument,&metadata_flag,12},
@@ -903,11 +920,17 @@
                             convert->disable_audio=1;
                             flag=-1;
                             break;
+                        case OPTIMIZE_FLAG:
+                            convert->quick_p = 0;
+                            flag = -1;
+                            break;
+#ifdef VIDEO4LINUX_ENABLED
                         case V4L_FLAG:
                             formatParams = malloc(sizeof(AVFormatParameters));
                             formatParams->device = optarg;
                             flag=-1;
                             break;
+#endif
                 /* crop */
                         case CROPTOP_FLAG:
                             convert->frame_topBand=crop_check(convert,"top",optarg);
@@ -998,15 +1021,15 @@
             case 'V':
                 convert->video_bitrate=rint(atof(optarg)*1000);
                 if(convert->video_bitrate<0 || convert->video_bitrate>2000000){
-                    fprintf(stderr,"only values from 0 to 2000000 are valid for video bitrate(in kbps)\n");
+                    fprintf(stderr,"only values from 0 to 2000000 are valid for video bitrate(in kb/s)\n");
                     exit(1);
                 }
                 convert->video_quality=0;
-                break; 
+                break;
             case 'a':
                 convert->audio_quality=atof(optarg);
                 if(convert->audio_quality<-2 || convert->audio_quality>10){
-                    fprintf(stderr,"only values from -1 to 10 are valid for audio quality\n");
+                    fprintf(stderr,"only values from -2 to 10 are valid for audio quality\n");
                     exit(1);
                 }
                 convert->audio_bitrate=0;
@@ -1052,7 +1075,6 @@
                     convert->video_quality = rint(7*6.3);
                     convert->audio_quality = 3.00;
                     convert->channels=2;
-                    convert->sample_rate=48000;
                     convert->sharpness=0;
                 }
                 else if(!strcmp(optarg,"preview")){
@@ -1061,7 +1083,6 @@
                     convert->video_quality = rint(5*6.3);
                     convert->audio_quality = 1.00;
                     convert->channels=2;
-                    convert->sample_rate=44100;
                     convert->sharpness=2;
                 }
                 else{
@@ -1108,7 +1129,7 @@
         optind++;
     }
 
-
+#ifdef VIDEO4LINUX_ENABLED
     if(formatParams != NULL) {
         formatParams->channel = 0;
         formatParams->width = PAL_HALF_WIDTH;
@@ -1126,10 +1147,11 @@
             formatParams->time_base.num = 1000;
 
         }
-        formatParams->standard = "pal";        
+        formatParams->standard = "pal";
         input_fmt = av_find_input_format("video4linux");
         sprintf(inputfile_name,"");
     }
+#endif
 
     //FIXME: is using_stdin still neded? is it needed as global variable?
     using_stdin |= !strcmp(inputfile_name, "pipe:" ) ||

Modified: trunk/ffmpeg2theora/get_ffmpeg_cvs.sh
===================================================================
--- trunk/ffmpeg2theora/get_ffmpeg_cvs.sh	2005-12-06 23:48:24 UTC (rev 10556)
+++ trunk/ffmpeg2theora/get_ffmpeg_cvs.sh	2005-12-07 02:32:28 UTC (rev 10557)
@@ -1,5 +1,9 @@
 #!/bin/sh
+
+#optional, if you have the libs installed:
+#extra="--enable-faad --enable-dts"
+
 cvs -z3 -d:pserver:anonymous at cvs.mplayerhq.hu:/cvsroot/ffmpeg/ co ffmpeg
 cd ffmpeg
-./configure --enable-libogg --enable-theora --enable-a52 --enable-pthreads --enable-gpl
+./configure --enable-libogg --enable-theora --enable-a52 --enable-pthreads --enable-gpl --disable-encoders  $extra
 make 



More information about the commits mailing list