Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
Commits
b1cc12d0
Commit
b1cc12d0
authored
Apr 09, 2013
by
Nicolas George
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ffmpeg: make -aspect work with -vcodec copy.
parent
b42827ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
ffmpeg.texi
doc/ffmpeg.texi
+4
-0
ffmpeg.c
ffmpeg.c
+8
-1
ffmpeg_opt.c
ffmpeg_opt.c
+13
-13
No files found.
doc/ffmpeg.texi
View file @
b1cc12d0
...
...
@@ -468,6 +468,10 @@ form @var{num}:@var{den}, where @var{num} and @var{den} are the
numerator and denominator of the aspect ratio. For example "4:3",
"16:9", "1.3333", and "1.7777" are valid argument values.
If used together with @option
{
-vcodec copy
}
, it will affect the aspect ratio
stored at container level, but not the aspect ratio stored in encoded
frames, if it exists.
@item -vn (@emph
{
output
}
)
Disable video recording.
...
...
ffmpeg.c
View file @
b1cc12d0
...
...
@@ -2224,7 +2224,14 @@ static int transcode_init(void)
codec
->
width
=
icodec
->
width
;
codec
->
height
=
icodec
->
height
;
codec
->
has_b_frames
=
icodec
->
has_b_frames
;
if
(
!
codec
->
sample_aspect_ratio
.
num
)
{
if
(
ost
->
frame_aspect_ratio
.
num
)
{
// overridden by the -aspect cli option
codec
->
sample_aspect_ratio
=
ost
->
st
->
sample_aspect_ratio
=
av_mul_q
(
ost
->
frame_aspect_ratio
,
(
AVRational
){
codec
->
height
,
codec
->
width
});
av_log
(
NULL
,
AV_LOG_WARNING
,
"Overriding aspect ratio "
"with stream copy may produce invalid files
\n
"
);
}
else
if
(
!
codec
->
sample_aspect_ratio
.
num
)
{
codec
->
sample_aspect_ratio
=
ost
->
st
->
sample_aspect_ratio
=
ist
->
st
->
sample_aspect_ratio
.
num
?
ist
->
st
->
sample_aspect_ratio
:
...
...
ffmpeg_opt.c
View file @
b1cc12d0
...
...
@@ -1168,7 +1168,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
AVStream
*
st
;
OutputStream
*
ost
;
AVCodecContext
*
video_enc
;
char
*
frame_rate
=
NULL
;
char
*
frame_rate
=
NULL
,
*
frame_aspect_ratio
=
NULL
;
ost
=
new_output_stream
(
o
,
oc
,
AVMEDIA_TYPE_VIDEO
,
source_index
);
st
=
ost
->
st
;
...
...
@@ -1180,10 +1180,21 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
exit
(
1
);
}
MATCH_PER_STREAM_OPT
(
frame_aspect_ratios
,
str
,
frame_aspect_ratio
,
oc
,
st
);
if
(
frame_aspect_ratio
)
{
AVRational
q
;
if
(
av_parse_ratio
(
&
q
,
frame_aspect_ratio
,
255
,
0
,
NULL
)
<
0
||
q
.
num
<=
0
||
q
.
den
<=
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Invalid aspect ratio: %s
\n
"
,
frame_aspect_ratio
);
exit
(
1
);
}
ost
->
frame_aspect_ratio
=
q
;
}
if
(
!
ost
->
stream_copy
)
{
const
char
*
p
=
NULL
;
char
*
frame_size
=
NULL
;
char
*
frame_
aspect_ratio
=
NULL
,
*
frame_
pix_fmt
=
NULL
;
char
*
frame_pix_fmt
=
NULL
;
char
*
intra_matrix
=
NULL
,
*
inter_matrix
=
NULL
;
int
do_pass
=
0
;
int
i
;
...
...
@@ -1194,17 +1205,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in
exit
(
1
);
}
MATCH_PER_STREAM_OPT
(
frame_aspect_ratios
,
str
,
frame_aspect_ratio
,
oc
,
st
);
if
(
frame_aspect_ratio
)
{
AVRational
q
;
if
(
av_parse_ratio
(
&
q
,
frame_aspect_ratio
,
255
,
0
,
NULL
)
<
0
||
q
.
num
<=
0
||
q
.
den
<=
0
)
{
av_log
(
NULL
,
AV_LOG_FATAL
,
"Invalid aspect ratio: %s
\n
"
,
frame_aspect_ratio
);
exit
(
1
);
}
ost
->
frame_aspect_ratio
=
q
;
}
video_enc
->
bits_per_raw_sample
=
frame_bits_per_raw_sample
;
MATCH_PER_STREAM_OPT
(
frame_pix_fmts
,
str
,
frame_pix_fmt
,
oc
,
st
);
if
(
frame_pix_fmt
&&
*
frame_pix_fmt
==
'+'
)
{
...
...
Write
Preview
Markdown
is supported
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