aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorKongqun Yang <yangkongqun@gmail.com>2016-06-15 13:53:01 -0700
committerRonald S. Bultje <rsbultje@gmail.com>2016-06-17 10:36:09 -0400
commit54327c2b3449942e6e701331a7330e5d8db265ac (patch)
treeacfcaef8db155b501d56bd9e7576aa9f58fcc672 /libavformat/movenc.c
parent7f1b503ec218a6194f6b2008d8e4d0110301fef4 (diff)
downloadffmpeg-54327c2b3449942e6e701331a7330e5d8db265ac.tar.gz
Add experimental support for vp9 in iso-bmff
Implemented according to the draft specification "VP Codec ISO Media File Format Binding": http://www.webmproject.org/vp9/#draft-vp-codec-iso-media-file-format-binding '-strict -2' is required to use this feature. Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2f00091b63..837e1e5fa3 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -49,6 +49,7 @@
#include "hevc.h"
#include "rtpenc.h"
#include "mov_chan.h"
+#include "vpcc.h"
static const AVOption options[] = {
{ "movflags", "MOV muxer flags", offsetof(MOVMuxContext, flags), AV_OPT_TYPE_FLAGS, {.i64 = 0}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
@@ -1039,6 +1040,17 @@ static int mov_write_avcc_tag(AVIOContext *pb, MOVTrack *track)
return update_size(pb, pos);
}
+static int mov_write_vpcc_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track)
+{
+ int64_t pos = avio_tell(pb);
+
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "vpcC");
+ avio_wb32(pb, 0); /* version & flags */
+ ff_isom_write_vpcc(s, pb, track->par);
+ return update_size(pb, pos);
+}
+
static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
{
int64_t pos = avio_tell(pb);
@@ -1143,6 +1155,7 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
if (track->par->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1');
else if (track->par->codec_id == AV_CODEC_ID_HEVC) tag = MKTAG('h','e','v','1');
+ else if (track->par->codec_id == AV_CODEC_ID_VP9) tag = MKTAG('v','p','0','9');
else if (track->par->codec_id == AV_CODEC_ID_AC3) tag = MKTAG('a','c','-','3');
else if (track->par->codec_id == AV_CODEC_ID_EAC3) tag = MKTAG('e','c','-','3');
else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
@@ -1758,6 +1771,8 @@ static int mov_write_video_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *tr
mov_write_avcc_tag(pb, track);
if (track->mode == MODE_IPOD)
mov_write_uuid_tag_ipod(pb);
+ } else if (track->par->codec_id == AV_CODEC_ID_VP9) {
+ mov_write_vpcc_tag(mov->fc, pb, track);
} else if (track->par->codec_id == AV_CODEC_ID_VC1 && track->vos_len > 0)
mov_write_dvc1_tag(pb, track);
else if (track->par->codec_id == AV_CODEC_ID_VP6F ||
@@ -5369,6 +5384,17 @@ static int mov_write_header(AVFormatContext *s)
pix_fmt == AV_PIX_FMT_MONOWHITE ||
pix_fmt == AV_PIX_FMT_MONOBLACK;
}
+ if (track->mode == MODE_MP4 &&
+ track->par->codec_id == AV_CODEC_ID_VP9) {
+ if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(s, AV_LOG_ERROR,
+ "VP9 in MP4 support is experimental, add "
+ "'-strict %d' if you want to use it.\n",
+ FF_COMPLIANCE_EXPERIMENTAL);
+ ret = AVERROR_EXPERIMENTAL;
+ goto error;
+ }
+ }
} else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
track->timescale = st->codecpar->sample_rate;
if (!st->codecpar->frame_size && !av_get_bits_per_sample(st->codecpar->codec_id)) {