summaryrefslogtreecommitdiffstats
path: root/contrib/ffmpeg/A20-avc3-hvc1-override.patch
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/A20-avc3-hvc1-override.patch
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/A20-avc3-hvc1-override.patch')
-rw-r--r--contrib/ffmpeg/A20-avc3-hvc1-override.patch49
1 files changed, 49 insertions, 0 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