News:

--

Main Menu

h265

Started by Jan Gruuthuse, February 06, 2017, 01:51:51 PM

Previous topic - Next topic

Jan Gruuthuse

Can you confirm h265 (HW Accel) development:
- currently is libva based?
- libvdpau is to follow?

reason to ask: current playback is very slow with 4K h265 within avidemux playback. Looks like slow motion.

mean

I dont have a h265 enabled nvidia card, so i can't test it

Jan Gruuthuse

OK, hope you planned one in (nearby) future.

mean

you could try, it's not that difficult
You need to change both in avidemux_core and in avidemux/qt5/hwCodec
basically adding a case H265 right below H264

Should be mostly copy/paste

eumagga0x2a

I really wish it were. Simply applying something like

diff --git a/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp b/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp
index 49f8c8f..4a8bf6a 100644
--- a/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp
+++ b/avidemux/common/ADM_videoCodec/src/ADM_ffmpeg_vdpau.cpp
@@ -59,8 +59,9 @@ typedef enum
{
     ADM_VDPAU_INVALID=0,
     ADM_VDPAU_H264=1,
-    ADM_VDPAU_MPEG2=2,
-    ADM_VDPAU_VC1=3
+    ADM_VDPAU_H265=2,
+    ADM_VDPAU_MPEG2=3,
+    ADM_VDPAU_VC1=4
}ADM_VDPAU_TYPE;

#ifdef USE_VDPAU
@@ -222,6 +223,7 @@ static enum AVPixelFormat vdpauGetFormat(struct AVCodecContext *avctx,  const en
             switch(avctx->codec_id)
             {
                 FMT_V_CHECK(H264,H264)
+                FMT_V_CHECK(HEVC,H264)
                 FMT_V_CHECK(MPEG1VIDEO,MPEG1)
                 FMT_V_CHECK(MPEG2VIDEO,MPEG2)
                 FMT_V_CHECK(WMV3,WMV3)
@@ -291,6 +293,11 @@ decoderFFVDPAU::decoderFFVDPAU(struct AVCodecContext *avctx,decoderFF *parent) :
                  name="h264";
                  vdpDecoder=VDP_DECODER_PROFILE_H264_HIGH;
                  break;
+            case AV_CODEC_ID_HEVC:
+                 vdpauType=ADM_VDPAU_H265;
+                 name="h265";
+                 vdpDecoder=VDP_DECODER_PROFILE_HEVC_MAIN;
+                 break;
             case AV_CODEC_ID_VC1:
                   vdpauType=ADM_VDPAU_VC1;
                   name="vc1";


(I haven't found any locations in core which might be relevant, there is some dead code in avidemux_core/ADM_coreVideoCodec/src/ADM_codecSearch.cpp in ADM_coreCodecGetDecoder and that's it) makes Avidemux blindly try to decode h265 via VDPAU and subsequently crash (my Kepler NVIDIA graphics card doesn't have a HEVC decoder either and I am utterly reluctant to switch to the current generation due to worse or completely missing support in the nouveau driver).

mean

The capabilities check might be missing
(like it is done in libva)

mean

It might work with libva wrapper on top of vdpau
(i.e. select libva and deselect vdpau)

Jan Gruuthuse

#7
after applying above diff using seting libva for display and HW Accel:
with HEVC-HLG teststream20170101.ts
[Editor] Decoder FCC: H265 (35363248) [ADM_getDecoder] 13:38:33-806 
Searching decoder in plugins
  [tryCreatingVideoDecoder] 13:38:33-806  No decoder found in plugin
  [ADM_getDecoder] 13:38:33-806  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
  [ADM_coreCodecGetDecoder] 13:38:33-806  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
[lavc] Build: 3741798
[decoderFFH265] 13:38:33-806  [lavc] Initializing H265 decoder with 0 extradata
  [adm_lavLogCallback] 13:38:33-806  [lavc] The 'vismv' option is deprecated, see the codecview filter instead.
  [decoderFFH265] 13:38:33-806  [lavc] Decoder init: AV_CODEC_ID_HEVC video decoder initialized! (HEVC (High Efficiency Video Coding))
  [addReferenceVideo] 13:38:33-806  [editor] Original frame increment 00:00:00,016
  [addReferenceVideo] 13:38:33-806  [Editor] min increment 00:00:00,002
  [addReferenceVideo] 13:38:33-806  [Editor] max increment 00:00:01,084
  [addReferenceVideo] 13:38:33-806  [Editor] About 16683 microseconds per frame
  [getVideoDuration] 13:38:33-806  Found maxPts =00:01:06,485, 0 frames from the end
  [getVideoDuration] 13:38:33-806  Found maxDts =00:01:06,318, 0 frames from the end
  [getVideoDuration] 13:38:33-806  Using PTS..
  [getVideoDuration] 13:38:33-806  Using duration of 00:01:06,485

Jan Gruuthuse

#8
using seting vdpau for display and HW Accel:
with HEVC-HLG teststream20170101.ts
[vdpauGetFormat] 13:43:51-972  [vdpau]: GetFormat
  [vdpauGetFormat] 13:43:51-972  No matching colrospace compatible hw accelerator found
  [canSupportThis] 13:43:51-972  LibVA not enabled
  [lookup] 13:43:51-972  No Matching Hw accel
  [ADM_FFgetFormat] 13:43:51-972  No Hw Accel for that

mean


eumagga0x2a

10 bit HEVC support seems to be slowly coming to VDPAU users on NVIDIA hardware: https://devtalk.nvidia.com/default/topic/940228/vdpau-expose-hevc-main10-support-where-available-on-die/. This means, simply replacing

+                 vdpDecoder=VDP_DECODER_PROFILE_HEVC_MAIN;

in the patch with

+                 vdpDecoder=VDP_DECODER_PROFILE_HEVC_MAIN_10;

won't make it work for you now (if the reason was a 10 bit video and not a mistake in the code).

Jan Gruuthuse

HEVC mpeg-ts details (10bit)
General
ID                                       : 1049 (0x419)
Complete name                            : HEVC-HLG teststream20170101.ts
Format                                   : MPEG-TS
File size                                : 126 MiB
Duration                                 : 1mn 5s
Overall bit rate mode                    : Variable
Overall bit rate                         : 15.8 Mbps

Video
ID                                       : 33 (0x21)
Menu ID                                  : 301 (0x12D)
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L5.1@Main
Codec ID                                 : 36
Duration                                 : 15h 25mn
Width                                    : 3 840 pixels
Height                                   : 2 160 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 59.940 (60000/1001) fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Writing library                          : ATEME Titan File 3.7.7 (4.7.7.1)
Color range                              : Limited
Color primaries                          : BT.2020
Transfer characteristics                 : BT.2020
Matrix coefficients                      : BT.2020 non-constant

Audio
ID                                       : 36 (0x24)
Menu ID                                  : 301 (0x12D)
Format                                   : AAC
Format/Info                              : Advanced Audio Codec
Format version                           : Version 4
Format profile                           : LC
Muxing mode                              : ADTS
Codec ID                                 : 15
Duration                                 : 1mn 5s
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Frame rate                               : 46.875 fps (1024 spf)
Compression mode                         : Lossy
Delay relative to video                  : 8ms

Menu
ID                                       : 32 (0x20)
Menu ID                                  : 301 (0x12D)
Duration                                 : 1mn 5s
List                                     : 33 (0x21) (HEVC) / 36 (0x24) (AAC)

Card supports:

eumagga0x2a

As suspected, the stream is 10 bit which is not supported by the NVIDIA binary driver at least (some support might have been added in 370.xx and later) and probably by the hardware as well.

mean

+ffmpeg must support it

eumagga0x2a

I assume the bundled ffmpeg supports it (I got the string from grepping the buildCore/ffmpeg directory, it is used in vdpau_hevc_init in libavcodec/vdpau_hevc.c:413).

The devtalk discussion suggests a recent AMD card might be a better platform to work on VDPAU support.