Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#2253 closed enhancement (fixed)

Support for VP8 and VP9 video codec — at Version 7

Reported by: ming Owned by: ming
Priority: normal Milestone: release-2.10
Component: pjmedia-videodev Version: trunk
Keywords: Cc:
Backport to 1.x milestone: Backported: no

Description (last modified by nanang)

Add support for VP8 and VP9 video codec using libvpx.

During our testing, for the same bitrate, VP8 quality seems to be better than H264, but the encoding speed is noticeably slower. For VP9 however, as documented by several other sources as well [1][2], the encoding speed is much much slower, even though we have followed the recommended setting for "Real-time CBR Encoding and Streaming" from their doc here. Because of this, VP9 is currently by default disabled. To enable it, you can set PJMEDIA_HAS_VPX_CODEC_VP9 compile-time macro.

[1] https://blogs.gnome.org/rbultje/2014/02/22/the-worlds-fastest-vp9-decoder-ffvp9/
[2] https://www.streamingmedia.com/Articles/ReadArticle.aspx?ArticleID=111334

Steps to use VP8/VP9

  1. Download libvpx.
  2. Build and install. General build steps can be found in libvpx README file.
    • For Android, these steps can be used:
      export NDK=/path/to/Android-NDK
      export HOST_TAG=linux-x86_64 # adjust to your building host
      
      export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG
      export AR=$TOOLCHAIN/bin/aarch64-linux-android-ar
      export AS=$TOOLCHAIN/bin/aarch64-linux-android-as
      export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
      export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++
      export LD=$TOOLCHAIN/bin/aarch64-linux-android-ld
      export RANLIB=$TOOLCHAIN/bin/aarch64-linux-android-ranlib
      export STRIP=$TOOLCHAIN/bin/aarch64-linux-android-strip
      
      ./configure --target=arm64-android-gcc --enable-pic --disable-examples \
                  --disable-tools --disable-docs --enable-realtime-only \
                  --disable-install-bins --disable-unit-tests --disable-webm-io \
                  --disable-libyuv \
                  --prefix=/path/to/target/installation
      
  3. Libvpx will then be autodetected by PJSIP configure script (alternatively, you can specify --with-vpx option).

Change History (7)

comment:1 Changed 4 years ago by ming

  • Owner set to ming
  • Resolution set to fixed
  • Status changed from new to closed

In 6110:

Fixed #2253: Support for VP8 and VP9 video codec

comment:2 Changed 4 years ago by riza

In 6147:

Re #2253:

  • Add vpx.h/vpx.c to Visual Studio project files
  • Fix compile error/warning from Visual Studio

comment:3 Changed 4 years ago by ming

In 6149:

Re #2253
Fix vpx fmtp apply:

  • Only adjust the frame rate if it exceeds max-fr
  • Maintain aspect ratio when adjusting resolution

comment:4 Changed 4 years ago by ming

In 6150:

Re #2253: Apply local fmtp setting

comment:5 Changed 4 years ago by ming

In 6151:

Re #2253: Changed keyframe max distance to a max of 60s

comment:6 Changed 4 years ago by ming

In 6153:

Re #2253: Check for insufficient buffer if remote is sending higher res than we can handle.

comment:7 Changed 4 years ago by nanang

  • Description modified (diff)
Note: See TracTickets for help on using tickets.