[FFmpeg-devel] [RFC PATCH 0/4] Add hevc alpha layer basic decoding support
Zhao Zhili
quinkblack at foxmail.com
Thu Jan 5 18:14:12 EET 2023
From: Zhao Zhili <zhilizhao at tencent.com>
This is a POC for adding hevc alpha layer decoding support. I'd like to
know:
1. Is there any plan/interesting to add fullly support inside our hevc
decoder? If the answer is yes, then the patchset is less useful.
2. What does the current method break?
3. Any idea to improve the method? It's kind of missing the point of
hevc multi-layer extension to use multiple decoder instances. It's
not easy to use.
1. Don't drop nal->nuh_layer_id > 0 until decoder.
2. Make hevcdec able to decode a selected layer.
3. Make hevc_metadata bsf able to extract a selected layer.
Now it's able to use two decoders to decode the base layer and alpha
layer, and then combine the results, e.g.,
./ffmpeg -i alpha.mp4 \
-strict -2 -nuh_layer_id 1 -i alpha.mp4 \
-frames 60 \
-filter_complex '[0:v][1:v]alphamerge[vout]' \
-map '[vout]' -an test-%d.png
It only works with software decoder.
hevc_metadata can be used together with hardware decoder. The following
example is how to extract the alpha layer and rewrite as base layer:
./ffmpeg -i alpha.mp4 \
-an -c:v copy \
-bsf:v hevc_metadata=nuh_layer_id=1 \
test.mp4
Zhao Zhili (4):
avcodec/hevc_parse: keep nal->nuh_layer_id > 0
avcodec/cbs_h2645: keep nal->nuh_layer_id > 0
avcodec/hevcdec: add nuh_layer_id option
avcodec/h265_metadata_bsf: add nuh_layer_id option
doc/bitstream_filters.texi | 5 +++++
libavcodec/cbs_h2645.c | 3 ---
libavcodec/h265_metadata_bsf.c | 25 +++++++++++++++++++++++++
libavcodec/hevc_parse.c | 2 --
libavcodec/hevcdec.c | 20 +++++++++++++++++++-
libavcodec/version.h | 2 +-
6 files changed, 50 insertions(+), 7 deletions(-)
--
2.25.1
More information about the ffmpeg-devel
mailing list