summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg
diff options
context:
space:
mode:
authorJohn Stebbins <[email protected]>2017-11-09 13:43:53 -0800
committerGitHub <[email protected]>2017-11-09 13:43:53 -0800
commit65597ee7f4bfa11838d815fceb6bc6dd24150c1f (patch)
treed044e1fb014797b4526508d4d423194079d746a5 /contrib/ffmpeg
parent86d6345771e3b2fb22255620aa91cf77fdf15f10 (diff)
Add adaptive streaming support (#972)
"Adaptive streaming" allows changing video parameters mid-stream at IDR boundaries. Such changes require new SPS and PPS NALs at the IDR. MP4 supports this with 'avc3' and 'hev1' sample entry types.
Diffstat (limited to 'contrib/ffmpeg')
-rw-r--r--contrib/ffmpeg/A20-avc3-hvc1-override.patch49
-rw-r--r--contrib/ffmpeg/A20-hvc1-override.patch48
2 files changed, 49 insertions, 48 deletions
diff --git a/contrib/ffmpeg/A20-avc3-hvc1-override.patch b/contrib/ffmpeg/A20-avc3-hvc1-override.patch
new file mode 100644
index 000000000..70d67b4a3
--- /dev/null
+++ b/contrib/ffmpeg/A20-avc3-hvc1-override.patch
@@ -0,0 +1,49 @@
+diff -ur libav-12.2.orig/libavformat/isom.c libav-12.2/libavformat/isom.c
+--- libav-12.2.orig/libavformat/isom.c 2017-09-30 11:13:39.000000000 -0700
++++ libav-12.2/libavformat/isom.c 2017-11-01 14:17:30.762856002 -0700
+@@ -152,6 +152,7 @@
+ { AV_CODEC_ID_HEVC, MKTAG('h', 'v', 'c', '1') }, /* HEVC/H.265 which indicates parameter sets shall not be in ES */
+
+ { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '1') }, /* AVC-1/H.264 */
++ { AV_CODEC_ID_H264, MKTAG('a', 'v', 'c', '3') }, /* AVC-1/H.264 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'p') }, /* AVC-Intra 50M 720p24/30/60 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', 'q') }, /* AVC-Intra 50M 720p25/50 */
+ { AV_CODEC_ID_H264, MKTAG('a', 'i', '5', '2') }, /* AVC-Intra 50M 1080p25/50 */
+diff -ur libav-12.2.orig/libavformat/movenc.c libav-12.2/libavformat/movenc.c
+--- libav-12.2.orig/libavformat/movenc.c 2017-09-30 11:13:39.000000000 -0700
++++ libav-12.2/libavformat/movenc.c 2017-11-01 14:20:52.783487291 -0700
+@@ -724,7 +724,10 @@
+
+ avio_wb32(pb, 0);
+ ffio_wfourcc(pb, "hvcC");
+- ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
++ if (track->tag == MKTAG('h','v','c','1'))
++ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 1);
++ else
++ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
+ return update_size(pb, pos);
+ }
+
+@@ -783,7 +786,11 @@
+ if (!ff_codec_get_tag(ff_mp4_obj_type, track->par->codec_id))
+ return 0;
+
+- if (track->par->codec_id == AV_CODEC_ID_H264) tag = MKTAG('a','v','c','1');
++ if (track->par->codec_id == AV_CODEC_ID_H264 &&
++ tag == MKTAG('a','v','c','3')) ;
++ else 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','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_AC3) tag = MKTAG('a','c','-','3');
+ else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
+@@ -4476,7 +4483,7 @@
+ .write_packet = mov_write_packet,
+ .write_trailer = mov_write_trailer,
+ .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE,
+- .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
++ .codec_tag = (const AVCodecTag* const []){ ff_codec_movvideo_tags, ff_codec_movaudio_tags, ff_codec_movsubtitle_tags, 0 },
+ .priv_class = &mp4_muxer_class,
+ };
+ #endif
+Only in libav-12.2/libavformat: movenc.c.orig
diff --git a/contrib/ffmpeg/A20-hvc1-override.patch b/contrib/ffmpeg/A20-hvc1-override.patch
deleted file mode 100644
index 639885ebb..000000000
--- a/contrib/ffmpeg/A20-hvc1-override.patch
+++ /dev/null
@@ -1,48 +0,0 @@
-From cc6cb8d44b50082ae3edfed39f484213590c8777 Mon Sep 17 00:00:00 2001
-From: John Stebbins <[email protected]>
-Date: Sun, 11 Jun 2017 10:19:14 -0700
-Subject: [PATCH] movenc: Allow use of hvc1 tag for h.265
-
-If AVCodecParameters.codec_tag is 'hvc1' use it instead of 'hev1' for
-h.265 streams.
----
- libavformat/movenc.c | 9 +++++++--
- 1 file changed, 7 insertions(+), 2 deletions(-)
-
-diff --git a/libavformat/movenc.c b/libavformat/movenc.c
-index e389029..835f588 100644
---- a/libavformat/movenc.c
-+++ b/libavformat/movenc.c
-@@ -726,7 +726,10 @@ static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
-
- avio_wb32(pb, 0);
- ffio_wfourcc(pb, "hvcC");
-- ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
-+ if (track->tag == MKTAG('h','v','c','1'))
-+ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 1);
-+ else
-+ ff_isom_write_hvcc(pb, track->vos_data, track->vos_len, 0);
- return update_size(pb, pos);
- }
-
-@@ -786,6 +789,8 @@ static int mp4_get_codec_tag(AVFormatContext *s, MOVTrack *track)
- return 0;
-
- 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','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_AC3) tag = MKTAG('a','c','-','3');
- else if (track->par->codec_id == AV_CODEC_ID_DIRAC) tag = MKTAG('d','r','a','c');
-@@ -4496,7 +4501,7 @@ AVOutputFormat ff_mp4_muxer = {
- .write_packet = mov_write_packet,
- .write_trailer = mov_write_trailer,
- .flags = AVFMT_GLOBALHEADER | AVFMT_ALLOW_FLUSH | AVFMT_TS_NEGATIVE,
-- .codec_tag = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
-+ .codec_tag = (const AVCodecTag* const []){ ff_codec_movvideo_tags, ff_codec_movaudio_tags, ff_codec_movsubtitle_tags, 0 },
- .priv_class = &mp4_muxer_class,
- };
- #endif
---
-2.9.3
-