[xiph-commits] r15517 - in trunk/ffmpeg2theora: . src

j at svn.xiph.org j at svn.xiph.org
Mon Nov 10 09:40:17 PST 2008


Author: j
Date: 2008-11-10 09:40:17 -0800 (Mon, 10 Nov 2008)
New Revision: 15517

Modified:
   trunk/ffmpeg2theora/
   trunk/ffmpeg2theora/src/ffmpeg2theora.c
   trunk/ffmpeg2theora/src/ffmpeg2theora.h
Log:
new option --xy to set max with/height and keep aspect ratio


Property changes on: trunk/ffmpeg2theora
___________________________________________________________________
Name: bzr:revision-info
   - timestamp: 2008-11-10 18:38:03.456000090 +0100
committer: j
properties: 
	branch-nick: ffmpeg2theora

   + timestamp: 2008-11-10 18:39:21.171999931 +0100
committer: j
properties: 
	branch-nick: ffmpeg2theora

Name: bzr:file-ids
   - ffmpegrev	ffmpegrev-20081001111044-cwcrhwl3ry0mnhdq-1

   + src/ffmpeg2theora.c	6863 at 0101bb08-14d6-0310-b084-bc0e0c8e3800:trunk%2Fffmpeg2theora:ffmpeg2theora.c
src/ffmpeg2theora.h	ffmpeg2theora.h-20080523174200-q6z54q34pgkgpz50-1

Name: bzr:text-parents
   - ffmpegrev	j-20081001111423-31lxb69fs7023eqi

   + src/ffmpeg2theora.c	j-20081105204931-zah2kekajc2u9czu
src/ffmpeg2theora.h	j-20081010134449-4i1ak9vg1yv4ix53

Name: bzr:revision-id:v3-single1-dHJ1bmsvZmZtcGVnMnRoZW9yYQ..
   - 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
204 j-20080527100851-2v5eyxxrq1riqi50
205 j-20080527101341-9ynbgth2b15jw792
206 j-20080527205556-19tffvfrxgt3khld
207 j-20080527205840-zeestdde3v1zks9k
208 j-20080527210129-e73y56uwmzbcid00
209 j-20080527211813-5ll680ed1q4byp16
210 j-20080528102006-aeippim0tn70mz3f
211 j-20080528104907-40kiidjojvta8j61
212 j-20080528111329-vkqbt7xkat2o9h4z
213 j-20080529102940-q9xdwm5v9espzomv
214 j-20080529111405-nmh99aon1kmh22qm
215 j-20080530094948-ncq064s4uggd9z95
216 j-20080530095056-hko2vjfwipikwjyu
217 j-20080530171822-bab8sy8lpotf8081
218 j-20080603170442-v0pxspvfcucvsaex
219 j-20080617110355-xwbeg1xidmv8fubp
220 j-20080617110518-khqlhaan52kz3lii
221 j-20080723194934-63m20dc3zmkhwj4o
222 j-20080724140108-ntgbrk6913nvtk4b
223 j-20080802221321-3fcp0s6rehryx0n5
224 j-20080802221340-0s6mh8llk6nyon5d
225 j-20080901112127-tyeax385hwukjt13
226 j-20080915075112-fg3yc8radbplosnc
227 j-20080921103515-w89p8jqwt3oq5u20
228 j-20080921103703-prnl3ls2f6u4g177
229 j-20080921104137-otk3xx827h5cofwl
230 j-20080921104242-dswny7jm93stokej
231 j-20081001102101-rl2rf1x9u8e5zrqk
232 j-20081001103246-0uwni13nt5b2mqyw
233 j-20081001104039-68e6rbv58e743plv
234 j-20081001111423-31lxb69fs7023eqi
235 j-20081001112345-eo9e3eheszd68pkb
236 j-20081002180939-vwdafec5iu2ihyq6
237 j-20081003143408-49wdpdkvhnf719rq
238 j-20081003153911-nh2fzqikxgbm7tuk
239 j-20081006092929-7kh3399r2tkat0x8
240 j-20081006120928-dqhlormykse02wss
241 j-20081010131634-o5sswtynyozb0dmb
242 j-20081010134449-4i1ak9vg1yv4ix53
243 j-20081010154655-55t7kuwhmo8964ya
244 j-20081010171055-w0wdhrrxucgdpvn1
245 j-20081016143100-chii7fl38ao2h6rd
246 j-20081105200328-iez493l5o7o333ae
247 j-20081105202607-3vjd88uf5rgna3pi
248 j-20081105204931-zah2kekajc2u9czu
249 j-20081110173803-i116mo4960rnmsqt

   + 191 j-20080517230830-he5x8v2m8yrfiw35
192 j-20080518224037-pkmoctzf4qce7tog
193 j-20080518224409-6hbfp3k2ssn6egqa
194 j-20080520111939-dhi52qwbqe7a47cu
195 j-20080523092252-gj9k9db0s67vl7dw
196 j-20080523092420-l0850yrq1qkgz9t0
197 j-20080523093057-l5g0ezzy5geu0pey
198 j-20080523094343-kcno1dm2e1lr38q4
199 j-20080523163006-kjl6ewea5sxawmq2
200 j-20080523165904-l2vm52qae0hlqkhp
201 j-20080523175432-2ed953iktnl8c7cr
202 j-20080525100939-7oja8pk08v9fquiw
203 j-20080526111321-nhzaqh6ivzn0vs7b
204 j-20080527100851-2v5eyxxrq1riqi50
205 j-20080527101341-9ynbgth2b15jw792
206 j-20080527205556-19tffvfrxgt3khld
207 j-20080527205840-zeestdde3v1zks9k
208 j-20080527210129-e73y56uwmzbcid00
209 j-20080527211813-5ll680ed1q4byp16
210 j-20080528102006-aeippim0tn70mz3f
211 j-20080528104907-40kiidjojvta8j61
212 j-20080528111329-vkqbt7xkat2o9h4z
213 j-20080529102940-q9xdwm5v9espzomv
214 j-20080529111405-nmh99aon1kmh22qm
215 j-20080530094948-ncq064s4uggd9z95
216 j-20080530095056-hko2vjfwipikwjyu
217 j-20080530171822-bab8sy8lpotf8081
218 j-20080603170442-v0pxspvfcucvsaex
219 j-20080617110355-xwbeg1xidmv8fubp
220 j-20080617110518-khqlhaan52kz3lii
221 j-20080723194934-63m20dc3zmkhwj4o
222 j-20080724140108-ntgbrk6913nvtk4b
223 j-20080802221321-3fcp0s6rehryx0n5
224 j-20080802221340-0s6mh8llk6nyon5d
225 j-20080901112127-tyeax385hwukjt13
226 j-20080915075112-fg3yc8radbplosnc
227 j-20080921103515-w89p8jqwt3oq5u20
228 j-20080921103703-prnl3ls2f6u4g177
229 j-20080921104137-otk3xx827h5cofwl
230 j-20080921104242-dswny7jm93stokej
231 j-20081001102101-rl2rf1x9u8e5zrqk
232 j-20081001103246-0uwni13nt5b2mqyw
233 j-20081001104039-68e6rbv58e743plv
234 j-20081001111423-31lxb69fs7023eqi
235 j-20081001112345-eo9e3eheszd68pkb
236 j-20081002180939-vwdafec5iu2ihyq6
237 j-20081003143408-49wdpdkvhnf719rq
238 j-20081003153911-nh2fzqikxgbm7tuk
239 j-20081006092929-7kh3399r2tkat0x8
240 j-20081006120928-dqhlormykse02wss
241 j-20081010131634-o5sswtynyozb0dmb
242 j-20081010134449-4i1ak9vg1yv4ix53
243 j-20081010154655-55t7kuwhmo8964ya
244 j-20081010171055-w0wdhrrxucgdpvn1
245 j-20081016143100-chii7fl38ao2h6rd
246 j-20081105200328-iez493l5o7o333ae
247 j-20081105202607-3vjd88uf5rgna3pi
248 j-20081105204931-zah2kekajc2u9czu
249 j-20081110173803-i116mo4960rnmsqt
250 j-20081110173921-b79zigtpvfvowzd6


Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.c
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.c	2008-11-10 17:39:54 UTC (rev 15516)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.c	2008-11-10 17:40:17 UTC (rev 15517)
@@ -59,6 +59,7 @@
   CROPRIGHT_FLAG,
   CROPLEFT_FLAG,
   ASPECT_FLAG,
+  XY_FLAG,
   INPUTFPS_FLAG,
   AUDIOSTREAM_FLAG,
   SUBTITLES_FLAG,
@@ -167,6 +168,7 @@
         this->aspect_numerator=0;
         this->aspect_denominator=0;
         this->frame_aspect=0;
+        this->xy_max=-1;
         this->deinterlace=0; // auto by default, if input is flaged as interlaced it will deinterlace.
         this->vhook=0;
         this->framerate_new.num = -1;
@@ -456,6 +458,24 @@
             }
 
         }
+        if(this->xy_max > 0){
+          int width = venc->width-this->frame_leftBand-this->frame_rightBand;
+          int height = venc->height-this->frame_topBand-this->frame_bottomBand;
+          if(venc->sample_aspect_ratio.den!=0 && venc->sample_aspect_ratio.num!=0) {
+            height = ((float)venc->sample_aspect_ratio.den/venc->sample_aspect_ratio.num) * height;
+          }
+          if(this->frame_aspect == 0)
+            this->frame_aspect = (float)width/height;
+          if(width > height) {
+            this->picture_width = this->xy_max;
+            this->picture_height = this->xy_max / this->frame_aspect;
+            this->picture_height = this->picture_height + this->picture_height%2;
+          } else {
+            this->picture_height = this->xy_max;
+            this->picture_width = this->xy_max * this->frame_aspect;
+            this->picture_width = this->picture_width + this->picture_width%2;
+          }
+        }
         if(this->picture_height==0 &&
             (this->frame_leftBand || this->frame_rightBand || this->frame_topBand || this->frame_bottomBand) ){
             this->picture_height=venc->height-
@@ -1161,6 +1181,8 @@
         "      --speedlevel       [0 2] encoding is faster with higher values the cost is quality and bandwidth\n"
         "  -x, --width            scale to given width (in pixels)\n"
         "  -y, --height           scale to given height (in pixels)\n"
+        "      --xy               scale output frame to be withing box of \n"
+        "                         given size (in pixels)\n"
         "      --aspect           define frame aspect ratio: i.e. 4:3 or 16:9\n"
         "  -F, --framerate        output framerate e.g 25:2 or 16\n"
         "      --croptop, --cropbottom, --cropleft, --cropright\n"
@@ -1281,6 +1303,7 @@
       {"format",required_argument,NULL,'f'},
       {"width",required_argument,NULL,'x'},
       {"height",required_argument,NULL,'y'},
+      {"xy",required_argument,&flag,XY_FLAG},
       {"videoquality",required_argument,NULL,'v'},
       {"videobitrate",required_argument,NULL,'V'},
       {"audioquality",required_argument,NULL,'a'},
@@ -1422,6 +1445,10 @@
                             convert->frame_aspect = aspect_check(optarg);
                             flag = -1;
                             break;
+                        case XY_FLAG:
+                            convert->xy_max = atoi(optarg);
+                            flag = -1;
+                            break;
                         case INPUTFPS_FLAG:
                             convert->force_input_fps = get_framerate(optarg);
                             flag = -1;

Modified: trunk/ffmpeg2theora/src/ffmpeg2theora.h
===================================================================
--- trunk/ffmpeg2theora/src/ffmpeg2theora.h	2008-11-10 17:39:54 UTC (rev 15516)
+++ trunk/ffmpeg2theora/src/ffmpeg2theora.h	2008-11-10 17:40:17 UTC (rev 15517)
@@ -53,6 +53,7 @@
     ogg_int32_t aspect_numerator;
     ogg_int32_t aspect_denominator;
     double    frame_aspect;
+    int xy_max;
 
     int pix_fmt;
     int video_quality;



More information about the commits mailing list