Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
ffmpeg2theora
Commits
552c1ff2
Commit
552c1ff2
authored
Aug 08, 2009
by
Jan Gerber
Browse files
make --max_size also understand 640x480, patch by Mikael Nordfeldth
parent
11ab72c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/ffmpeg2theora.c
View file @
552c1ff2
...
...
@@ -188,7 +188,8 @@ static ff2theora ff2theora_init() {
this
->
aspect_numerator
=
0
;
this
->
aspect_denominator
=
0
;
this
->
frame_aspect
=
0
;
this
->
max_size
=-
1
;
this
->
max_x
=-
1
;
this
->
max_y
=-
1
;
this
->
deinterlace
=
0
;
// auto by default, if input is flaged as interlaced it will deinterlace.
this
->
soft_target
=
0
;
this
->
buf_delay
=-
1
;
...
...
@@ -703,7 +704,7 @@ void ff2theora_output(ff2theora this) {
}
}
}
if
(
this
->
max_
size
>
0
)
{
if
(
this
->
max_
x
>
0
)
{
int
width
=
display_width
-
this
->
frame_leftBand
-
this
->
frame_rightBand
;
int
height
=
display_height
-
this
->
frame_topBand
-
this
->
frame_bottomBand
;
if
(
sample_aspect_ratio
.
den
!=
0
&&
sample_aspect_ratio
.
num
!=
0
)
{
...
...
@@ -713,13 +714,13 @@ void ff2theora_output(ff2theora this) {
}
if
(
this
->
frame_aspect
==
0
)
this
->
frame_aspect
=
(
float
)
width
/
height
;
if
(
width
>
height
)
{
this
->
picture_width
=
this
->
max_
size
;
this
->
picture_height
=
this
->
max_
size
/
this
->
frame_aspect
;
if
(
width
>
height
&&
this
->
max_x
/
this
->
frame_aspect
<=
this
->
max_y
)
{
this
->
picture_width
=
this
->
max_
x
;
this
->
picture_height
=
this
->
max_
x
/
this
->
frame_aspect
;
this
->
picture_height
=
this
->
picture_height
+
this
->
picture_height
%
2
;
}
else
{
this
->
picture_height
=
this
->
max_
size
;
this
->
picture_width
=
this
->
max_
size
*
this
->
frame_aspect
;
this
->
picture_height
=
this
->
max_
y
;
this
->
picture_width
=
this
->
max_
y
*
this
->
frame_aspect
;
this
->
picture_width
=
this
->
picture_width
+
this
->
picture_width
%
2
;
}
}
...
...
@@ -1788,8 +1789,8 @@ void print_usage() {
" -x, --width scale to given width (in pixels)
\n
"
" -y, --height scale to given height (in pixels)
\n
"
" --max_size scale output frame to be within
g
box of
\n
"
" given size
(in pixels
)
\n
"
" --max_size scale output frame to be within box of
\n
"
" given size
, height optional (%%d[x%%d], i.e. 640x480
)
\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
"
...
...
@@ -2121,7 +2122,9 @@ int main(int argc, char **argv) {
flag
=
-
1
;
break
;
case
MAXSIZE_FLAG
:
convert
->
max_size
=
atoi
(
optarg
);
if
(
sscanf
(
optarg
,
"%dx%d"
,
&
convert
->
max_x
,
&
convert
->
max_y
)
!=
2
)
{
convert
->
max_y
=
convert
->
max_x
=
atoi
(
optarg
);
}
flag
=
-
1
;
break
;
case
INPUTFPS_FLAG
:
...
...
src/ffmpeg2theora.h
View file @
552c1ff2
...
...
@@ -58,7 +58,8 @@ typedef struct ff2theora{
ogg_int32_t
aspect_numerator
;
ogg_int32_t
aspect_denominator
;
double
frame_aspect
;
int
max_size
;
int
max_x
;
int
max_y
;
int
pix_fmt
;
int
video_quality
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment