Opened 6 years ago

Closed 3 years ago

#3271 closed enhancement (fixed)

Allow using additional pixel formats with libvpx-vp9

Reported by: GreatEmerald Owned by:
Priority: wish Component: avcodec
Version: git-master Keywords: libvpx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Currently ffmpeg assumes that libvpx is only capable of yuv420p pixel format. However, libvpx-vp9 with Profile 1 allows additional pixel formats - yuv422p and yuv444p, and possibly also yuva422p and yuva444p (the libvpx code states that they also support alpha in Profile 1). So these pixel formats should be made available.

The code comments for that can be found here (line 1133):
https://chromium.googlesource.com/webm/libvpx/+/2344e3a2e1600a2a31e63d2a82a9bbd0b91912b0/vp9/encoder/vp9_bitstream.c
The announcement of yuv444p support can be found here:
https://groups.google.com/a/webmproject.org/forum/?fromgroups=#!topic/webm-discuss/UzoX7owhwB0

Change History (7)

comment:1 Changed 6 years ago by cehoyos

  • Component changed from undetermined to avcodec
  • Keywords libvpx added
  • Priority changed from normal to wish
  • Status changed from new to open
  • Version changed from 2.1.1 to git-master

comment:2 Changed 5 years ago by GreatEmerald

Still happens in libavcodec 55.52.102.

comment:3 Changed 5 years ago by SocDemScum

libavcodec 56.19.100 produces an error saying that yuv420p colour spaces can only be used on profile 0 and 2, when telling it to use profile 1 and a yuv444p colour space.

ffmpeg version N-68877-gd02d4d0 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan  5 2015 19:27:15 with gcc 4.8 (Debian 4.8.2-1)
  configuration: --cpu=native --disable-everything --enable-encoder=libvpx_vp9 --enable-encoder=libx264 --enable-encoder=libx265 --enable-encoder=libopus --enable-encoder=flac --enable-encoder=alac --enable-encoder=aac --enable-encoder=png --enable-encoder=rawvideo --enable-decoder=vp9 --enable-decoder=h264 --enable-decoder=hevc --enable-decoder=opus --enable-decoder=flac --enable-decoder=alac --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=png --enable-muxer=mpegts --enable-muxer=matroska --enable-muxer=flac --enable-muxer=mp4 --enable-muxer=image2 --enable-muxer=yuv4mpegpipe --enable-demuxer=mpegts --enable-demuxer=matroska --enable-demuxer=flac --enable-demuxer=mov --enable-demuxer=wav --enable-demuxer=image2 --enable-protocol=udp --enable-protocol=file --enable-filter=aresample --enable-filter=crop --enable-filter=scale --enable-gpl --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --disable-ffprobe --disable-ffserver
  libavutil      54. 16.100 / 54. 16.100
  libavcodec     56. 19.100 / 56. 19.100
  libavformat    56. 18.100 / 56. 18.100
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  6.100 /  5.  6.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'a.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    creation_time   : 2014-11-29 01:06:17
  Duration: 00:03:38.85, start: 0.000000, bitrate: 1959 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x534 [SAR 1:1 DAR 640:267], 1765 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 191 kb/s (default)
    Metadata:
      creation_time   : 2014-11-29 01:06:20
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
File 'a.mkv' already exists. Overwrite ? [y/N] y
Incompatible pixel format 'yuv444p' for codec 'libvpx-vp9', auto-selecting format 'yuv420p'
[libvpx-vp9 @ 0x1aaada0] v1.3.0-5204-g2fe1bfa
[libvpx-vp9 @ 0x1aaada0] Failed to set VP8E_SET_CPUUSED codec control: Invalid parameter
[libvpx-vp9 @ 0x1aaada0]   Additional information: cpu_used out of range [-8..8]
[libvpx-vp9 @ 0x1aaada0] Failed to set VP8E_SET_NOISE_SENSITIVITY codec control: Unspecified internal error
[libvpx-vp9 @ 0x1aaada0]   Additional information: cpu_used out of range [-8..8]
[alac @ 0x1ad35a0] encoding as 24 bits-per-sample
Output #0, matroska, to 'a.mkv':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isommp42
    encoder         : Lavf56.18.100
    Stream #0:0(und): Video: vp9 (libvpx-vp9) (VP90 / 0x30395056), yuv420p, 1280x534 [SAR 1:1 DAR 640:267], q=-1--1, 200 kb/s, 23.98 fps, 1k tbn, 23.98 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc56.19.100 libvpx-vp9
    Stream #0:1(und): Audio: alac ([255][255][255][255] / 0xFFFFFFFF), 44100 Hz, stereo, s32p (24 bit), 128 kb/s (default)
    Metadata:
      creation_time   : 2014-11-29 01:06:20
      handler_name    : IsoMedia File Produced by Google, 5-11-2011
      encoder         : Lavc56.19.100 alac
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> vp9 (libvpx-vp9))
  Stream #0:1 -> #0:1 (aac (native) -> alac (native))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x1aaada0] Error encoding frame: Invalid parameter
[libvpx-vp9 @ 0x1aaada0]   Additional information: 4:2:0 color space requires profile 0 or 2
Video encoding failed
Conversion failed!
Last edited 5 years ago by SocDemScum (previous) (diff)

comment:4 Changed 4 years ago by cehoyos

Is this still a valid ticket for yuva4xxp or was alpha abandoned for vp9?

comment:5 Changed 3 years ago by jzern

Alpha never made it to the final vp9 bitstream, but can be done in the same way as vp8 -- encoding and muxing the alpha plane separately.

comment:6 Changed 3 years ago by cdlvcdlv

I've made vp8/webm videos with alpha using ffmpeg with this command:

ffmpeg -i INPUT -c:v libvpx -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" OUTPUT.webm

But when I try

ffmpeg -i INPUT -c:v libvpx-vp9 -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" OUTPUT.webm

ffmpeg complains and changes the pixel format

Incompatible pixel format 'yuva420p' for codec 'libvpx-vp9', auto-selecting form at 'yuv420p'

Nevertheless, it seems there is a little utility to make vp9 videos. I've not tested it to see whether it works using Chrome but, as a part of chromium, we could assume compatibility.

https://chromium.googlesource.com/webm/webm-tools/+/master/alpha_encoder/

The README tells about VP8 only, but in the source code you can see the options:

printf(" -c codec (vp8 or vp9). default is vp8\n");

comment:7 Changed 3 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from open to closed

Implemented by Vignesh Venkatasubramanian in acca56d9629b7fc158ce188190d22314c3d92c39

Note: See TracTickets for help on using tickets.