[FFmpeg-devel] [PATCH] vp9: use superframe split BSF

James Almer jamrial at gmail.com
Wed Nov 29 17:31:41 EET 2017


On 11/29/2017 12:24 PM, wm4 wrote:
> webm usually has invisible superframes merged with normal frames.
> (vpxenc muxes them in this form, which is evidence enough that this is
> the standard webm packet format. It's rather unclear whether ffmpeg is
> even allowed to remux them with split packets.)

It is currently, since the vp9 parser splits them not just for the
decoder but for everything else as well. But by default, thanks to
autoinserted bsfs, libavformat muxers will try to merge them back
without the user explicitly asking for it.

That's why i sent a patch to make said autoinserted bsfs on muxers non
optional, but it's kinda hard to enforce without making the muxers abort
if the needed bsfs are not compiled in, since they are in a different
library.

> 
> The vp9 decoder needs them to be in separate packets for multithreading
> to work. Add the BSF to the decoder, so the conversion happens
> automatically.
> 
> This contains the important part of fa1749dd34c55fb9, which
> was apparently skipped in commit d417e95af76. This restores Libav API
> compatibility.

The parser currently handles this, but i agree that ideally that should
be done by the bsf and exclusively within the decoder, so no split
packets will find their way into muxers.

> ---
>  libavcodec/version.h | 2 +-
>  libavcodec/vp9.c     | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 55bb5c5e01..d67b689142 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -29,7 +29,7 @@
>  
>  #define LIBAVCODEC_VERSION_MAJOR  58
>  #define LIBAVCODEC_VERSION_MINOR   6
> -#define LIBAVCODEC_VERSION_MICRO 101
> +#define LIBAVCODEC_VERSION_MICRO 102
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>                                                 LIBAVCODEC_VERSION_MINOR, \
> diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c
> index 1ea2869c4c..6241f01de1 100644
> --- a/libavcodec/vp9.c
> +++ b/libavcodec/vp9.c
> @@ -1795,6 +1795,7 @@ AVCodec ff_vp9_decoder = {
>      .init_thread_copy      = ONLY_IF_THREADS_ENABLED(vp9_decode_init_thread_copy),
>      .update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context),
>      .profiles              = NULL_IF_CONFIG_SMALL(ff_vp9_profiles),
> +    .bsfs                  = "vp9_superframe_split",
>      .hw_configs            = (const AVCodecHWConfigInternal*[]) {
>  #if CONFIG_VP9_DXVA2_HWACCEL
>                                 HWACCEL_DXVA2(vp9),
> 



More information about the ffmpeg-devel mailing list