[xiph-commits] r13371 - trunk/ffmpeg2theora

j at svn.xiph.org j at svn.xiph.org
Fri Jul 27 06:03:35 PDT 2007


Author: j
Date: 2007-07-27 06:03:34 -0700 (Fri, 27 Jul 2007)
New Revision: 13371

Modified:
   trunk/ffmpeg2theora/ffmpeg2theora.c
   trunk/ffmpeg2theora/theorautils.c
   trunk/ffmpeg2theora/theorautils.h
Log:
use new speedlevel option

Modified: trunk/ffmpeg2theora/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/ffmpeg2theora.c	2007-07-27 03:33:55 UTC (rev 13370)
+++ trunk/ffmpeg2theora/ffmpeg2theora.c	2007-07-27 13:03:34 UTC (rev 13371)
@@ -59,6 +59,7 @@
 #define AUDIOSTREAM_FLAG    12
 #define VHOOK_FLAG          13
 #define FRONTEND_FLAG       14
+#define SPEEDLEVEL_FLAG     15
 
 #define V2V_PRESET_PRO 1
 #define V2V_PRESET_PREVIEW 2
@@ -106,7 +107,6 @@
     int video_bitrate;
     int sharpness;
     int keyint;
-    int quick_p;
 
     double force_input_fps;
     int sync;
@@ -269,7 +269,6 @@
         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;
@@ -588,7 +587,6 @@
             info.ti.target_bitrate = this->video_bitrate; 
             info.ti.quality = this->video_quality;
             info.ti.dropframes_p = 0;
-            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;
@@ -961,7 +959,9 @@
         "Video output options:\n"
         "  -v, --videoquality     [0 to 10] encoding quality for video (default: 5)\n"
         "  -V, --videobitrate     [1 to 16778] encoding bitrate for video (kb/s)\n"
-        "      --optimize         optimize video output filesize (slower)\n"
+        "      --optimize         optimize video output filesize (slower) (same as speedlevel 0)\n"
+        "      --speedlevel       [0 2] encoding is faster with higher values the cost is quality and bandwith\n"
+        "                               this puts the encoder in VBR mode, bitrate settings no longer work\n"
         "  -x, --width            scale to given width (in pixels)\n"
         "  -y, --height           scale to given height (in pixels)\n"
         "      --aspect           define frame aspect ratio: i.e. 4:3 or 16:9\n"
@@ -1099,6 +1099,7 @@
       {"endtime",required_argument,NULL,'e'},
       {"sync",0,&flag,SYNC_FLAG},
       {"optimize",0,&flag,OPTIMIZE_FLAG},
+      {"speedlevel",required_argument,&flag,SPEEDLEVEL_FLAG},
       {"frontend",0,&flag,FRONTEND_FLAG},
 
       {"artist",required_argument,&metadata_flag,10},
@@ -1152,9 +1153,13 @@
                             flag = -1;
                             break;
                         case OPTIMIZE_FLAG:
-                            convert->quick_p = 0;
+                            info.speed_level = 0;
                             flag = -1;
                             break;
+                        case SPEEDLEVEL_FLAG:
+                          info.speed_level = atoi(optarg);
+                            flag = -1;
+                            break;
                         case FRONTEND_FLAG:
                             info.frontend = 1;
                             flag = -1;

Modified: trunk/ffmpeg2theora/theorautils.c
===================================================================
--- trunk/ffmpeg2theora/theorautils.c	2007-07-27 03:33:55 UTC (rev 13370)
+++ trunk/ffmpeg2theora/theorautils.c	2007-07-27 13:03:34 UTC (rev 13371)
@@ -57,6 +57,7 @@
     info->videopage = NULL;
     info->start_time = time(NULL);
     info->duration = -1;
+    info->speed_level = -1;
     
     info->v_pkg=0;
     info->a_pkg=0;
@@ -160,6 +161,14 @@
     if(!info->audio_only){
         ogg_stream_init (&info->to, rand ());    /* oops, add one ot the above */
         theora_encode_init (&info->td, &info->ti);
+        
+        if(info->speed_level >= 0) {
+          int max_speed_level;
+          theora_control(&info->td, TH_ENCCTL_GET_SPLEVEL_MAX, &max_speed_level, sizeof(int));
+          if(info->speed_level > max_speed_level)
+            info->speed_level = max_speed_level;
+          theora_control(&info->td, TH_ENCCTL_SET_SPLEVEL, &info->speed_level, sizeof(int));
+        }
     }
     /* init theora done */
 

Modified: trunk/ffmpeg2theora/theorautils.h
===================================================================
--- trunk/ffmpeg2theora/theorautils.h	2007-07-27 03:33:55 UTC (rev 13370)
+++ trunk/ffmpeg2theora/theorautils.h	2007-07-27 13:03:34 UTC (rev 13371)
@@ -54,6 +54,7 @@
     /* theora settings */
     theora_info ti;
     theora_comment tc;
+    int speed_level;
 
     /* state info */    
     theora_state td;



More information about the commits mailing list