[FFmpeg-user] vp8 with alpha video decoding

Gabriele Salvati gabriele.salvati at quixant.com
Mon Sep 12 18:14:33 EEST 2016


Hi,

I'm trying to decode a vp8 encoded video with alpha channel. I clone ffmpeg from git and configured with the following options:


./configure --prefix="${HOME}/ffmpeg_build_git" --pkg-config-flags=--static --extra-cflags=-I"${HOME}/ffmpeg_build_git/include" --extra-ldflags=-L"${HOME}/ffmpeg_build_git/lib" --bindir="${HOME}/ffmpeg_build_git/bin" --enable-gpl --enable-yasm --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-nonfree --disable-doc --enable-vaapi --enable-vda --enable-vdpau --enable-decoder=h264_vdpau --enable-hardcoded-tables --enable-hwaccel=h264_vaapi --enable-hwaccel=h264_vdpau --enable-libx264


After that I run the command:


./ffmpeg -i ~/Desktop/png/filmato_01_alfa.png -c:v libvpx -pix_fmt yuva420p -metadata:s:v:0 alpha_mode="1" output.webm


to encode a vp8 video, I obtain the following output:


ffmpeg version N-81641-ga50ca6b Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/home/qmax/ffmpeg_build_git --pkg-config-flags=--static --extra-cflags=-I/home/qmax/ffmpeg_build_git/include --extra-ldflags=-L/home/qmax/ffmpeg_build_git/lib --bindir=/home/qmax/ffmpeg_build_git/bin --enable-gpl --enable-yasm --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-nonfree --disable-doc --enable-vaapi --enable-vda --enable-vdpau --enable-decoder=h264_vdpau --enable-hardcoded-tables --enable-hwaccel=h264_vaapi --enable-hwaccel=h264_vdpau --enable-libx264
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.103 / 57. 48.103
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from '/home/qmax/Desktop/png/filmato_01_alfa.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, rgba(pc), 1280x720 [SAR 1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[libvpx @ 0x2d2ace0] v1.3.0
[webm @ 0x2d29080] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, webm, to 'output.webm':
  Metadata:
    encoder         : Lavf57.48.103
    Stream #0:0: Video: vp8 (libvpx), yuva420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      alpha_mode      : 1
      encoder         : Lavc57.55.101 libvpx
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> vp8 (libvpx))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=0.0 Lsize=      69kB time=00:00:00.00 bitrate=562384.0kbits/s speed=0.00144x
video:34kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 101.311569%

I would use ffmpeg to decode this video when i run:

~/ffmpeg_build_git/bin/ffmpeg -i ./output.webm  -f null - -benchmark

ffmpeg version N-81641-ga50ca6b Copyright (c) 2000-2016 the FFmpeg developers

  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/home/qmax/ffmpeg_build_git --pkg-config-flags=--static --extra-cflags=-I/home/qmax/ffmpeg_build_git/include --extra-ldflags=-L/home/qmax/ffmpeg_build_git/lib --bindir=/home/qmax/ffmpeg_build_git/bin --enable-gpl --enable-yasm --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-nonfree --disable-doc --enable-vaapi --enable-vda --enable-vdpau --enable-decoder=h264_vdpau --enable-hardcoded-tables --enable-hwaccel=h264_vaapi --enable-hwaccel=h264_vdpau --enable-libx264
  libavutil      55. 29.100 / 55. 29.100
  libavcodec     57. 55.101 / 57. 55.101
  libavformat    57. 48.103 / 57. 48.103
  libavdevice    57.  0.102 / 57.  0.102
  libavfilter     6. 62.100 /  6. 62.100
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, matroska,webm, from './output.webm':
  Metadata:
    encoder         : Lavf57.48.103
  Duration: 00:00:00.04, start: 0.000000, bitrate: 14059 kb/s
    Stream #0:0: Video: vp8, yuv420p, 1280x720, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      alpha_mode      : 1
[null @ 0x27019e0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Output #0, null, to 'pipe:':
  Metadata:
    encoder         : Lavf57.48.103
    Stream #0:0: Video: wrapped_avframe, yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc (default)
    Metadata:
      alpha_mode      : 1
      encoder         : Lavc57.55.101 wrapped_avframe
Stream mapping:
  Stream #0:0 -> #0:0 (vp8 (native) -> wrapped_avframe (native))
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A speed= 5.8x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
bench: utime=0.004s
bench: maxrss=18300kB

The input stream has yuv420p pixel format rather than yuva420p.

By analyzing the source code in libavcodec/libvpxdec.c in the function vpx_decode there is a reference to the alpha channel that is set in:
planes[3] =
ctx->has_alpha_channel ? img_alpha->planes[VPX_PLANE_Y] : NULL;
 linesizes[3] =
            ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0;

________________________________

Le informazioni contenute in questo messaggio e negli eventuali allegati sono confidenziali e ad uso esclusivo del destinatario indicato. Qualora non fossero a Lei destinati o abbia ricevuto questa comunicazione per errore, La preghiamo di tener presente che qualsiasi divulgazione, distribuzione o duplicazione delle informazioni in essa contenute è strettamente proibita e può essere illegale. La informiamo che deve darci tempestiva comunicazione della ricezione del messaggio e distruggerlo immediatamente. I contenuti possono essere soggetti ad accordi di non- divulgazione e riservatezza. Le opinioni e i punti di vista espressi in questo messaggio di posta elettronica sono propri dell'autore e potrebbero non corrispondere a opinioni e punti di vista di Quixant. Nessuna informazione contenuta in questo messaggio può essere interpretata come modifica dei termini di qualsiasi accordo contrattuale scritto, esistente tra Quixant Plc (comprese le sue controllate) e qualsiasi persona fisica o giuridica.


More information about the ffmpeg-user mailing list