[FFmpeg-devel] avformat/mov: add VP8 codec support

Submitted by James Almer on Feb. 6, 2018, 1:39 a.m.

Details

Message ID 20180206013952.8912-1-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer Feb. 6, 2018, 1:39 a.m.
Demuxing only. Muxing is disabled as altref frame handling is not
defined, and there's no way to know the presence of such frames
during stream initialization.

Based on a patch by Steven Liu.

Fixes ticket #7000

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/isom.c   | 1 +
 libavformat/mov.c    | 1 +
 libavformat/movenc.c | 6 ++++++
 3 files changed, 8 insertions(+)

Comments

Carl Eugen Hoyos Feb. 7, 2018, 12:25 a.m.
2018-02-06 2:39 GMT+01:00 James Almer <jamrial@gmail.com>:
> Demuxing only. Muxing is disabled as altref frame handling is not
> defined, and there's no way to know the presence of such frames
> during stream initialization.

strict -2?

> +            if (track->par->codec_id == AV_CODEC_ID_VP8) {
> +                /* altref frames handling is not defined in the spec as of version v1.0,
> +                 * so just forbid muxing VP8 streams altogether */
> +                av_log(s, AV_LOG_ERROR, "VP8 muxing is currently not supported.\n");
> +                return AVERROR(EINVAL);

Could be PATCHWELCOME.

Feel free to push, thank you, Carl Eugen
James Almer Feb. 7, 2018, 2:12 a.m.
On 2/6/2018 9:25 PM, Carl Eugen Hoyos wrote:
> 2018-02-06 2:39 GMT+01:00 James Almer <jamrial@gmail.com>:
>> Demuxing only. Muxing is disabled as altref frame handling is not
>> defined, and there's no way to know the presence of such frames
>> during stream initialization.
> 
> strict -2?

Allowing muxing something that's explicitly listed as not supported by
the current spec will come bite us at a later point, so I'd rather not.

> 
>> +            if (track->par->codec_id == AV_CODEC_ID_VP8) {
>> +                /* altref frames handling is not defined in the spec as of version v1.0,
>> +                 * so just forbid muxing VP8 streams altogether */
>> +                av_log(s, AV_LOG_ERROR, "VP8 muxing is currently not supported.\n");
>> +                return AVERROR(EINVAL);
> 
> Could be PATCHWELCOME.

Alright.

> 
> Feel free to push, thank you, Carl Eugen

Pushed, thanks.

Patch hide | download patch | download mbox

diff --git a/libavformat/isom.c b/libavformat/isom.c
index 9d9f85885b..59502a8b3f 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -186,6 +186,7 @@  const AVCodecTag ff_codec_movvideo_tags[] = {
     { AV_CODEC_ID_H264, MKTAG('x', 'a', 'l', 'g') }, /* XAVC-L HD422 produced by FCP */
     { AV_CODEC_ID_H264, MKTAG('a', 'v', 'l', 'g') }, /* Panasonic P2 AVC-LongG */
 
+    { AV_CODEC_ID_VP8,  MKTAG('v', 'p', '0', '8') }, /* VP8 */
     { AV_CODEC_ID_VP9,  MKTAG('v', 'p', '0', '9') }, /* VP9 */
 
     { AV_CODEC_ID_MPEG1VIDEO, MKTAG('m', '1', 'v', ' ') },
diff --git a/libavformat/mov.c b/libavformat/mov.c
index d16b431e03..acfbfc5324 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2397,6 +2397,7 @@  static int mov_finalize_stsd_codec(MOVContext *c, AVIOContext *pb,
     case AV_CODEC_ID_EAC3:
     case AV_CODEC_ID_MPEG1VIDEO:
     case AV_CODEC_ID_VC1:
+    case AV_CODEC_ID_VP8:
     case AV_CODEC_ID_VP9:
         st->need_parsing = AVSTREAM_PARSE_FULL;
         break;
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index f7079f3df7..6913fce470 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6074,6 +6074,12 @@  static int mov_init(AVFormatContext *s)
                         pix_fmt == AV_PIX_FMT_MONOWHITE ||
                         pix_fmt == AV_PIX_FMT_MONOBLACK;
             }
+            if (track->par->codec_id == AV_CODEC_ID_VP8) {
+                /* altref frames handling is not defined in the spec as of version v1.0,
+                 * so just forbid muxing VP8 streams altogether */
+                av_log(s, AV_LOG_ERROR, "VP8 muxing is currently not supported.\n");
+                return AVERROR(EINVAL);
+            }
             if (track->par->codec_id == AV_CODEC_ID_VP9) {
                 if (track->mode != MODE_MP4) {
                     av_log(s, AV_LOG_ERROR, "VP9 only supported in MP4.\n");