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
23f0e2ed
Commit
23f0e2ed
authored
Sep 27, 2014
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avformat/movenc: AVC Intra support
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
9a3653c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
4 deletions
+60
-4
movenc.c
libavformat/movenc.c
+60
-4
No files found.
libavformat/movenc.c
View file @
23f0e2ed
...
@@ -1017,6 +1017,60 @@ static int mov_get_mpeg2_xdcam_codec_tag(AVFormatContext *s, MOVTrack *track)
...
@@ -1017,6 +1017,60 @@ static int mov_get_mpeg2_xdcam_codec_tag(AVFormatContext *s, MOVTrack *track)
return
tag
;
return
tag
;
}
}
static
int
mov_get_h264_codec_tag
(
AVFormatContext
*
s
,
MOVTrack
*
track
)
{
int
tag
=
track
->
enc
->
codec_tag
;
int
interlaced
=
track
->
enc
->
field_order
>
AV_FIELD_PROGRESSIVE
;
AVStream
*
st
=
track
->
st
;
int
rate
=
av_q2d
(
find_fps
(
s
,
st
));
if
(
!
tag
)
tag
=
MKTAG
(
'a'
,
'v'
,
'c'
,
'i'
);
//fallback tag
if
(
track
->
enc
->
pix_fmt
==
AV_PIX_FMT_YUV420P10
)
{
if
(
track
->
enc
->
width
==
960
&&
track
->
enc
->
height
==
720
)
{
if
(
!
interlaced
)
{
if
(
rate
==
24
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'p'
);
else
if
(
rate
==
25
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'q'
);
else
if
(
rate
==
30
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'p'
);
else
if
(
rate
==
50
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'q'
);
else
if
(
rate
==
60
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'p'
);
}
}
else
if
(
track
->
enc
->
width
==
1440
&&
track
->
enc
->
height
==
1080
)
{
if
(
!
interlaced
)
{
if
(
rate
==
24
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'3'
);
else
if
(
rate
==
25
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'2'
);
else
if
(
rate
==
30
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'3'
);
}
else
{
if
(
rate
==
50
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'5'
);
else
if
(
rate
==
60
)
tag
=
MKTAG
(
'a'
,
'i'
,
'5'
,
'6'
);
}
}
}
else
if
(
track
->
enc
->
pix_fmt
==
AV_PIX_FMT_YUV422P10
)
{
if
(
track
->
enc
->
width
==
1280
&&
track
->
enc
->
height
==
720
)
{
if
(
!
interlaced
)
{
if
(
rate
==
24
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'p'
);
else
if
(
rate
==
25
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'q'
);
else
if
(
rate
==
30
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'p'
);
else
if
(
rate
==
50
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'q'
);
else
if
(
rate
==
60
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'p'
);
}
}
else
if
(
track
->
enc
->
width
==
1920
&&
track
->
enc
->
height
==
1080
)
{
if
(
!
interlaced
)
{
if
(
rate
==
24
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'3'
);
else
if
(
rate
==
25
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'2'
);
else
if
(
rate
==
30
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'3'
);
}
else
{
if
(
rate
==
25
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'5'
);
else
if
(
rate
==
50
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'5'
);
else
if
(
rate
==
60
)
tag
=
MKTAG
(
'a'
,
'i'
,
'1'
,
'6'
);
}
}
}
return
tag
;
}
static
const
struct
{
static
const
struct
{
enum
AVPixelFormat
pix_fmt
;
enum
AVPixelFormat
pix_fmt
;
uint32_t
tag
;
uint32_t
tag
;
...
@@ -1080,6 +1134,8 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
...
@@ -1080,6 +1134,8 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
tag
=
mov_get_rawvideo_codec_tag
(
s
,
track
);
tag
=
mov_get_rawvideo_codec_tag
(
s
,
track
);
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
)
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_MPEG2VIDEO
)
tag
=
mov_get_mpeg2_xdcam_codec_tag
(
s
,
track
);
tag
=
mov_get_mpeg2_xdcam_codec_tag
(
s
,
track
);
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_H264
)
tag
=
mov_get_h264_codec_tag
(
s
,
track
);
else
if
(
track
->
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
else
if
(
track
->
enc
->
codec_type
==
AVMEDIA_TYPE_VIDEO
)
{
tag
=
ff_codec_get_tag
(
ff_codec_movvideo_tags
,
track
->
enc
->
codec_id
);
tag
=
ff_codec_get_tag
(
ff_codec_movvideo_tags
,
track
->
enc
->
codec_id
);
if
(
!
tag
)
{
// if no mac fcc found, try with Microsoft tags
if
(
!
tag
)
{
// if no mac fcc found, try with Microsoft tags
...
@@ -1294,7 +1350,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
...
@@ -1294,7 +1350,7 @@ static int mov_write_video_tag(AVIOContext *pb, MOVTrack *track)
mov_write_avid_tag
(
pb
,
track
);
mov_write_avid_tag
(
pb
,
track
);
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_HEVC
)
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_HEVC
)
mov_write_hvcc_tag
(
pb
,
track
);
mov_write_hvcc_tag
(
pb
,
track
);
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_H264
)
{
else
if
(
track
->
enc
->
codec_id
==
AV_CODEC_ID_H264
&&
!
TAG_IS_AVCI
(
track
->
tag
)
)
{
mov_write_avcc_tag
(
pb
,
track
);
mov_write_avcc_tag
(
pb
,
track
);
if
(
track
->
mode
==
MODE_IPOD
)
if
(
track
->
mode
==
MODE_IPOD
)
mov_write_uuid_tag_ipod
(
pb
);
mov_write_uuid_tag_ipod
(
pb
);
...
@@ -3508,7 +3564,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -3508,7 +3564,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
samples_in_chunk
=
1
;
samples_in_chunk
=
1
;
/* copy extradata if it exists */
/* copy extradata if it exists */
if
(
trk
->
vos_len
==
0
&&
enc
->
extradata_size
>
0
)
{
if
(
trk
->
vos_len
==
0
&&
enc
->
extradata_size
>
0
&&
!
TAG_IS_AVCI
(
trk
->
tag
)
)
{
trk
->
vos_len
=
enc
->
extradata_size
;
trk
->
vos_len
=
enc
->
extradata_size
;
trk
->
vos_data
=
av_malloc
(
trk
->
vos_len
);
trk
->
vos_data
=
av_malloc
(
trk
->
vos_len
);
memcpy
(
trk
->
vos_data
,
enc
->
extradata
,
trk
->
vos_len
);
memcpy
(
trk
->
vos_data
,
enc
->
extradata
,
trk
->
vos_len
);
...
@@ -3524,7 +3580,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
...
@@ -3524,7 +3580,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
}
av_log
(
s
,
AV_LOG_WARNING
,
"aac bitstream error
\n
"
);
av_log
(
s
,
AV_LOG_WARNING
,
"aac bitstream error
\n
"
);
}
}
if
(
enc
->
codec_id
==
AV_CODEC_ID_H264
&&
trk
->
vos_len
>
0
&&
*
(
uint8_t
*
)
trk
->
vos_data
!=
1
)
{
if
(
enc
->
codec_id
==
AV_CODEC_ID_H264
&&
trk
->
vos_len
>
0
&&
*
(
uint8_t
*
)
trk
->
vos_data
!=
1
&&
!
TAG_IS_AVCI
(
trk
->
tag
)
)
{
/* from x264 or from bytestream h264 */
/* from x264 or from bytestream h264 */
/* nal reformating needed */
/* nal reformating needed */
if
(
trk
->
hint_track
>=
0
&&
trk
->
hint_track
<
mov
->
nb_streams
)
{
if
(
trk
->
hint_track
>=
0
&&
trk
->
hint_track
<
mov
->
nb_streams
)
{
...
@@ -4227,7 +4283,7 @@ static int mov_write_header(AVFormatContext *s)
...
@@ -4227,7 +4283,7 @@ static int mov_write_header(AVFormatContext *s)
if
(
st
->
codec
->
extradata_size
)
{
if
(
st
->
codec
->
extradata_size
)
{
if
(
st
->
codec
->
codec_id
==
AV_CODEC_ID_DVD_SUBTITLE
)
if
(
st
->
codec
->
codec_id
==
AV_CODEC_ID_DVD_SUBTITLE
)
mov_create_dvd_sub_decoder_specific_info
(
track
,
st
);
mov_create_dvd_sub_decoder_specific_info
(
track
,
st
);
else
{
else
if
(
!
TAG_IS_AVCI
(
track
->
tag
))
{
track
->
vos_len
=
st
->
codec
->
extradata_size
;
track
->
vos_len
=
st
->
codec
->
extradata_size
;
track
->
vos_data
=
av_malloc
(
track
->
vos_len
);
track
->
vos_data
=
av_malloc
(
track
->
vos_len
);
memcpy
(
track
->
vos_data
,
st
->
codec
->
extradata
,
track
->
vos_len
);
memcpy
(
track
->
vos_data
,
st
->
codec
->
extradata
,
track
->
vos_len
);
...
...
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