Avidemux Forum

Avidemux => Main version 2.6 => Topic started by: Jan Gruuthuse on February 06, 2017, 01:51:51 PM

Title: h265
Post by: Jan Gruuthuse on February 06, 2017, 01:51:51 PM
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.
Title: Re: h265
Post by: mean on February 06, 2017, 02:19:58 PM
I dont have a h265 enabled nvidia card, so i can't test it
Title: Re: h265
Post by: Jan Gruuthuse on February 06, 2017, 02:44:30 PM
OK, hope you planned one in (nearby) future.
Title: Re: h265
Post by: mean on February 06, 2017, 02:50:45 PM
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
Title: Re: h265
Post by: eumagga0x2a on February 07, 2017, 03:43:07 PM
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).
Title: Re: h265
Post by: mean on February 07, 2017, 05:55:25 PM
The capabilities check might be missing
(like it is done in libva)
Title: Re: h265
Post by: mean on February 08, 2017, 05:48:23 AM
It might work with libva wrapper on top of vdpau
(i.e. select libva and deselect vdpau)
Title: libva: 'vismv' option is deprecated
Post by: Jan Gruuthuse on February 08, 2017, 01:42:59 PM
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
Title: vdpau
Post by: Jan Gruuthuse on February 08, 2017, 01:45:52 PM
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
Title: Re: h265
Post by: mean on February 08, 2017, 02:05:57 PM
It might be 10bits
Title: Re: h265
Post by: eumagga0x2a on February 08, 2017, 03:42:00 PM
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/ (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).
Title: Re: h265
Post by: Jan Gruuthuse on February 08, 2017, 04:59:40 PM
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:
Title: Re: h265
Post by: eumagga0x2a on February 08, 2017, 06:13:34 PM
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.
Title: Re: h265
Post by: mean on February 08, 2017, 07:02:20 PM
+ffmpeg must support it
Title: Re: h265
Post by: eumagga0x2a on February 08, 2017, 09:34:26 PM
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.
Title: Re: h265
Post by: mean on February 09, 2017, 07:27:49 AM
I've commited a quick patch to add hw probe
Not sure how well it works
Title: commit 868f24f: libva
Post by: Jan Gruuthuse on February 09, 2017, 07:44:09 AM
both libva selected display & hw accel:
HEVC-HLG teststream20170101.ts, size: 132500708
found 1 files
Done
[TsPacket] Detecting TS/TS2...
[TsPacket] Score : 188:20, 192:1 out of 20
[TsPacket] Probably TS1 (188)...
[tsDemuxer] Loaded 1
[ADM_PP] 07:42:05-282  Initializing postproc
  [cleanup] 07:42:05-282  Deleting post proc
  [update] 07:42:05-282  updating post proc
  [update] 07:42:05-282  Disabled
  [addFile] 07:42:05-282  Clearing video filters
  [ADM_vf_clearFilters] 07:42:05-282  clear filters
[Editor] *** NO AUDIO ***
[Editor] Decoder FCC: H265 (35363248) [ADM_getDecoder] 07:42:05-282 
Searching decoder in plugins
  [tryCreatingVideoDecoder] 07:42:05-282  No decoder found in plugin
  [ADM_getDecoder] 07:42:05-282  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
  [ADM_coreCodecGetDecoder] 07:42:05-282  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
[lavc] Build: 3741798
[decoderFFH265] 07:42:05-282  [lavc] Initializing H265 decoder with 0 extradata
  [adm_lavLogCallback] 07:42:05-282  [lavc] The 'vismv' option is deprecated, see the codecview filter instead.
  [decoderFFH265] 07:42:05-282  [lavc] Decoder init: AV_CODEC_ID_HEVC video decoder initialized! (HEVC (High Efficiency Video Coding))
  [addReferenceVideo] 07:42:05-282  [editor] Original frame increment 00:00:00,016
  [addReferenceVideo] 07:42:05-282  [Editor] min increment 00:00:00,002
  [addReferenceVideo] 07:42:05-282  [Editor] max increment 00:00:01,084
  [addReferenceVideo] 07:42:05-282  [Editor] About 16683 microseconds per frame
  [getVideoDuration] 07:42:05-282  Found maxPts =00:01:06,485, 0 frames from the end
  [getVideoDuration] 07:42:05-282  Found maxDts =00:01:06,318, 0 frames from the end
  [getVideoDuration] 07:42:05-282  Using PTS..
  [getVideoDuration] 07:42:05-282  Using duration of 00:01:06,485


suppose you're after this info?
without the previously diff or should it be included into build?
Title: commit 868f24f: vdpau
Post by: Jan Gruuthuse on February 09, 2017, 07:50:28 AM
both libvdpau selected display & hw accel:
[TsPacket] Detecting TS/TS2...
[TsPacket] Score : 188:20, 192:1 out of 20
[TsPacket] Probably TS1 (188)...
[tsDemuxer] Loaded 1
[ADM_PP] 07:48:32-656  Initializing postproc
  [cleanup] 07:48:32-656  Deleting post proc
  [update] 07:48:32-656  updating post proc
  [update] 07:48:32-656  Disabled
  [addFile] 07:48:32-656  Clearing video filters
  [ADM_vf_clearFilters] 07:48:32-656  clear filters
[Editor] *** NO AUDIO ***
[Editor] Decoder FCC: H265 (35363248) [ADM_getDecoder] 07:48:32-656 
Searching decoder in plugins
  [tryCreatingVideoDecoder] 07:48:32-656  No decoder found in plugin
  [ADM_getDecoder] 07:48:32-656  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
  [ADM_coreCodecGetDecoder] 07:48:32-656  Searching decoder in coreVideoCodec(3840 x 2160, extradataSize:0)...
[lavc] Build: 3741798
[decoderFFH265] 07:48:32-656  [lavc] Initializing H265 decoder with 0 extradata
  [adm_lavLogCallback] 07:48:32-656  [lavc] The 'vismv' option is deprecated, see the codecview filter instead.
  [decoderFFH265] 07:48:32-656  [lavc] Decoder init: AV_CODEC_ID_HEVC video decoder initialized! (HEVC (High Efficiency Video Coding))


suppose you're after this info?
without the previously diff or should it be included into build?
Title: Re: h265
Post by: eumagga0x2a on February 09, 2017, 09:31:08 AM
Quote from: Jan Gruuthuse on February 09, 2017, 07:50:28 AM
suppose you're after this info?

Not exactly. Thanks to [vdpau] Probe hw capabilities (experimental) (https://github.com/mean00/avidemux2/commit/868f24f0e70e6b8a559c467407af145eb23eb1bc), Avidemux correctly refuses to try to decode a h265 video via VDPAU on my hardware:

  [vdpauGetFormat] 09:14:34-620  HEVC:Not supported by HW

Now you should load an 8 bit h265 video and test if Avidemux tries to decode it via VDPAU in hardware.

Quotewithout the previously diff or should it be included into build?

Without.
Title: Re: h265
Post by: Jan Gruuthuse on February 09, 2017, 02:35:56 PM
h265 in mkv container, don't have original h265 8-bit in mpeg-ts:
[ADM_PP] 14:32:42-409  Initializing postproc
  [cleanup] 14:32:42-409  Deleting post proc
  [update] 14:32:42-409  updating post proc
  [update] 14:32:42-409  Disabled
  [addFile] 14:32:42-409  Clearing video filters
  [ADM_vf_clearFilters] 14:32:42-409  clear filters
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_Mad.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_ima_adpcm.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_ms_adpcm.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_a52.so score 100
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_opencore_amrwb.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_dca.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_opencore_amrnb.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_lav.so score 50
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_opus.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_vorbis.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_faad.so score 0
  [ADM_ad_searchCodec] 14:32:42-409  [ADM_ad_plugin]Format 0x2000 : probing libADM_ad_ulaw.so score 0
No accelerated IMDCT transform found
  [ADM_edAudioTrackFromVideo] 14:32:42-410  Creating edAudio from video track 0 at 3d04910
[Editor] Decoder FCC: HEVC (43564548) [ADM_getDecoder] 14:32:42-410 
Searching decoder in plugins
  [tryCreatingVideoDecoder] 14:32:42-410  No decoder found in plugin
  [ADM_getDecoder] 14:32:42-410  Searching decoder in coreVideoCodec(4096 x 1720, extradataSize:131)...
  [ADM_coreCodecGetDecoder] 14:32:42-410  Searching decoder in coreVideoCodec(4096 x 1720, extradataSize:131)...
[lavc] Build: 3741798
[decoderFFH265] 14:32:42-410  [lavc] Initializing H265 decoder with 131 extradata
  [adm_lavLogCallback] 14:32:42-410  [lavc] The 'vismv' option is deprecated, see the codecview filter instead.
  [decoderFFH265] 14:32:42-410  [lavc] Decoder init: AV_CODEC_ID_HEVC video decoder initialized! (HEVC (High Efficiency Video Coding))
  [addReferenceVideo] 14:32:42-410  [editor] Original frame increment 00:00:00,041
  [addReferenceVideo] 14:32:42-410  [Editor] min increment 00:00:00,041
  [addReferenceVideo] 14:32:42-410  [Editor] max increment 00:00:00,042
  [addReferenceVideo] 14:32:42-410  [Editor] About 41666 microseconds per frame
  [addReferenceVideo] 14:32:42-410  The first frame has a PTS >0, adjusting to 417 ms
  [updateStartTime] 14:32:42-410  Using pts2=00:00:00,417 to get dts, as this video does not start at zero
  [ADM_verifyDts] 14:32:42-410  Verifying DTS....
  [ADM_verifyDts] 14:32:42-410  Checking from 1 to 17620
  [ADM_verifyDts] 14:32:42-410  Pass 2..
  [ADM_verifyDts] 14:32:42-410  DTS verified
[Editor] B- frame possible with that codec
[addFile] 14:32:42-410  [Editor] Not H264
  [checkForDoubledFps] 14:32:42-410  Checking for doubled FPS.., time increment ceiling = 74998
  [checkForDoubledFps] 14:32:42-411  Checking DTS...
  [checkTiming] 14:32:42-411  Good : 1
  [checkTiming] 14:32:42-411  Bad  : 17618
  [checkForDoubledFps] 14:32:42-411  Checking PTS...
  [checkTiming] 14:32:42-411  Good : 0
  [checkTiming] 14:32:42-411  Bad  : 17619
  [checkForDoubledFps] 14:32:42-411  Cannot halve fps
  [renderDisplayResize] 14:32:42-411  Render to 4096x1720 zoom=1, old one =0 x 0, zoom=2, render=(nil)
  [init] 14:32:42-411  [Vdpau]Init
  [init] 14:32:42-411  [VDpau] Allocating surfaces 4096 x1720 , 4096 x 1728, 2048 x x860
  [mixerCreate] 14:32:42-417  Creating vdpauMixer with width=4096, height=1728 color=0
  [mixerCreate] 14:32:42-417  Vdpau Mixer : Enabling 0 features
  [spawnRenderer] 14:32:42-417  VDPAU init ok
Title: Re: h265
Post by: eumagga0x2a on February 09, 2017, 02:45:34 PM
Quote from: Jan Gruuthuse on February 09, 2017, 02:35:56 PM
h265 in mkv container, don't have original h265 8-bit in mpeg-ts:
It doesn't matter where the video comes from. Please provide the output of ffprobe for this video.

Quote
[Editor] Decoder FCC: HEVC (43564548) [ADM_getDecoder] 14:32:42-410 
Searching decoder in plugins
  [tryCreatingVideoDecoder] 14:32:42-410  No decoder found in plugin
  [ADM_getDecoder] 14:32:42-410  Searching decoder in coreVideoCodec(4096 x 1720, extradataSize:131)...
  [ADM_coreCodecGetDecoder] 14:32:42-410  Searching decoder in coreVideoCodec(4096 x 1720, extradataSize:131)...
[lavc] Build: 3741798
[decoderFFH265] 14:32:42-410  [lavc] Initializing H265 decoder with 131 extradata
  [adm_lavLogCallback] 14:32:42-410  [lavc] The 'vismv' option is deprecated, see the codecview filter instead.
  [decoderFFH265] 14:32:42-410  [lavc] Decoder init: AV_CODEC_ID_HEVC video decoder initialized! (HEVC (High Efficiency Video Coding))
  [addReferenceVideo] 14:32:42-410  [editor] Original frame increment 00:00:00,041
  [addReferenceVideo] 14:32:42-410  [Editor] min increment 00:00:00,041
  [addReferenceVideo] 14:32:42-410  [Editor] max increment 00:00:00,042
  [addReferenceVideo] 14:32:42-410  [Editor] About 41666 microseconds per frame
  [addReferenceVideo] 14:32:42-410  The first frame has a PTS >0, adjusting to 417 ms
  [updateStartTime] 14:32:42-410  Using pts2=00:00:00,417 to get dts, as this video does not start at zero
  [ADM_verifyDts] 14:32:42-410  Verifying DTS....
  [ADM_verifyDts] 14:32:42-410  Checking from 1 to 17620
  [ADM_verifyDts] 14:32:42-410  Pass 2..
  [ADM_verifyDts] 14:32:42-410  DTS verified
[Editor] B- frame possible with that codec
[addFile] 14:32:42-410  [Editor] Not H264
  [checkForDoubledFps] 14:32:42-410  Checking for doubled FPS.., time increment ceiling = 74998
  [checkForDoubledFps] 14:32:42-411  Checking DTS...
  [checkTiming] 14:32:42-411  Good : 1
  [checkTiming] 14:32:42-411  Bad  : 17618
  [checkForDoubledFps] 14:32:42-411  Checking PTS...
  [checkTiming] 14:32:42-411  Good : 0
  [checkTiming] 14:32:42-411  Bad  : 17619
  [checkForDoubledFps] 14:32:42-411  Cannot halve fps
  [renderDisplayResize] 14:32:42-411  Render to 4096x1720 zoom=1, old one =0 x 0, zoom=2, render=(nil)
  [init] 14:32:42-411  [Vdpau]Init
  [init] 14:32:42-411  [VDpau] Allocating surfaces 4096 x1720 , 4096 x 1728, 2048 x x860
  [mixerCreate] 14:32:42-417  Creating vdpauMixer with width=4096, height=1728 color=0
  [mixerCreate] 14:32:42-417  Vdpau Mixer : Enabling 0 features
  [spawnRenderer] 14:32:42-417  VDPAU init ok


You've cut the log just short of the lines where it starts to become interesting  :(

edit: Relevant entries are prepended with [vdpauGetFormat] and [canSupportThis].
Title: Re: h265
Post by: Jan Gruuthuse on February 09, 2017, 04:19:33 PM
Paint event
[refresh] 16:14:01-925  [Vdpau]Rrefresh
[RDR] Resizing to 2048 x 860
[renderCompleteRedrawRequest] 16:14:01-933  RedrawRequest
Paint event
[refresh] 16:14:01-951  [Vdpau]Rrefresh
Paint event
[refresh] 16:14:01-951  [Vdpau]Rrefresh
Paint event
[refresh] 16:14:01-951  [Vdpau]Rrefresh
  [paintGL] 16:14:01-957  Painting dummy openGl widget
  [A_ResetMarkers] 16:14:01-971  Video Total duration : 00:12:14,583 ms
  [rewind] 16:14:01-971  Rewinding
  [switchToSegment] 16:14:01-971  Trying to switch to seg 0 with startTime in reference pic= 0 ms
  [seektoTime] 16:14:01-971  First frame of the new segment is a keyframe at 417ms
  [DecodePictureUpToIntra] 16:14:01-971   DecodeUpToInta 0 ref:0
[edCache] Flush
[vdpauGetFormat] 16:14:01-973  [vdpau]: GetFormat
  [vdpauGetFormat] 16:14:01-973  [vdpau]: Evaluating 53
  [vdpauGetFormat] 16:14:01-973  [vdpau]: Evaluating 109
  [parseHwAccel] 16:14:01-973  Trying h263_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =5 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying h264_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =28 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying h264_vdpau, hwPixFmt=109, wantedPixFmt 109, hwCodecId =28 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying hevc_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =174 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying hevc_vdpau, hwPixFmt=109, wantedPixFmt 109, hwCodecId =174 : wantedCodecID=174
  [vdpauGetFormat] 16:14:01-973  Found matching hw accelerator : hevc_vdpau
  [vdpauGetFormat] 16:14:01-973  Successfully setup hw accel
  [canSupportThis] 16:14:01-973  This is supported by VDPAU
  [lookup] 16:14:01-973  Matching hw accel : vdpau
  [initVdpContext] 16:14:01-973  Init VDP context ok
  [decoderFFVDPAU] 16:14:01-973  Successfully setup hw accel
  [ADM_FFgetFormat] 16:14:01-973  Using vdpau as hw accel (ctx=0x3822460, accel=0x37cc940)


ffprobe 'Tears of Steel.mkv'
ffprobe version 2.8.10-0ubuntu0.16.04.1 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
  configuration: --prefix=/usr --extra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, matroska,webm, from '/media/jan/Houden/Demo/hevc x264 4K & SD/hevc/hevc 4K 08-bit 4096x1720 24fps (2.40:1) Tears of Steel.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.1
    creation_time   : 2014-03-24 10:14:59
  Duration: 00:12:14.17, start: 0.000000, bitrate: 2657 kb/s
    Stream #0:0(eng): Video: hevc (Main), yuv420p(tv), 4096x1714, SAR 1:1 DAR 2048:857, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)
    Stream #0:2(hrv): Subtitle: subrip
    Stream #0:3(cze): Subtitle: subrip
    Stream #0:4(dan): Subtitle: subrip
    Stream #0:5(ger): Subtitle: subrip
    Stream #0:6(eng): Subtitle: subrip (default)
    Stream #0:7(spa): Subtitle: subrip
    Stream #0:8(fre): Subtitle: subrip
    Stream #0:9(gre): Subtitle: subrip
    Stream #0:10(heb): Subtitle: subrip
    Stream #0:11(hun): Subtitle: subrip
    Stream #0:12(ind): Subtitle: subrip
    Stream #0:13(ita): Subtitle: subrip
    Stream #0:14(jpn): Subtitle: subrip
    Stream #0:15(dut): Subtitle: subrip
    Stream #0:16(nor): Subtitle: subrip
    Stream #0:17(per): Subtitle: subrip
    Stream #0:18(pol): Subtitle: subrip
    Stream #0:19(por): Subtitle: subrip
    Stream #0:20(rus): Subtitle: subrip
    Stream #0:21(chi): Subtitle: subrip
Title: Re: h265
Post by: eumagga0x2a on February 09, 2017, 05:18:50 PM
Quote from: Jan Gruuthuse on February 09, 2017, 04:19:33 PM

[vdpauGetFormat] 16:14:01-973  [vdpau]: GetFormat
  [vdpauGetFormat] 16:14:01-973  [vdpau]: Evaluating 53
  [vdpauGetFormat] 16:14:01-973  [vdpau]: Evaluating 109
  [parseHwAccel] 16:14:01-973  Trying h263_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =5 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying h264_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =28 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying h264_vdpau, hwPixFmt=109, wantedPixFmt 109, hwCodecId =28 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying hevc_vaapi, hwPixFmt=53, wantedPixFmt 109, hwCodecId =174 : wantedCodecID=174
  [parseHwAccel] 16:14:01-973  Trying hevc_vdpau, hwPixFmt=109, wantedPixFmt 109, hwCodecId =174 : wantedCodecID=174
  [vdpauGetFormat] 16:14:01-973  Found matching hw accelerator : hevc_vdpau
  [vdpauGetFormat] 16:14:01-973  Successfully setup hw accel
  [canSupportThis] 16:14:01-973  This is supported by VDPAU
  [lookup] 16:14:01-973  Matching hw accel : vdpau
  [initVdpContext] 16:14:01-973  Init VDP context ok
  [decoderFFVDPAU] 16:14:01-973  Successfully setup hw accel
  [ADM_FFgetFormat] 16:14:01-973  Using vdpau as hw accel (ctx=0x3822460, accel=0x37cc940)


ffprobe 'Tears of Steel.mkv'
ffprobe version 2.8.10-0ubuntu0.16.04.1 Copyright (c) 2007-2016 the FFmpeg developers
[...]
Input #0, matroska,webm, from '/media/jan/Houden/Demo/hevc x264 4K & SD/hevc/hevc 4K 08-bit 4096x1720 24fps (2.40:1) Tears of Steel.mkv':
  Metadata:
    encoder         : libebml v1.3.0 + libmatroska v1.4.1
    creation_time   : 2014-03-24 10:14:59
  Duration: 00:12:14.17, start: 0.000000, bitrate: 2657 kb/s
    Stream #0:0(eng): Video: hevc (Main), yuv420p(tv), 4096x1714, SAR 1:1 DAR 2048:857, 24 fps, 24 tbr, 1k tbn, 1k tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 448 kb/s (default)


Excellent, thanks. Decoding 8 bit h265 via VDPAU works  :)

The last remaining wish would be support for VDP_DECODER_PROFILE_HEVC_MAIN_10 when supported both by drivers and hardware.
Title: Re: h265
Post by: mean on February 09, 2017, 05:44:18 PM
and ffmpeg
Title: not opening: 4k hevc 8 bit
Post by: Jan Gruuthuse on February 10, 2017, 11:19:13 AM
Avidemux 2.6.18 commit 821a60b fflibs 3.0.6
Simple loading:
file: /media/jan/Houden/Demo/hevc x264 4K & SD/hevc/hevc 4K 08-bit 3840x2160 Mpeg-h part2-Hevc LG_4K_View-the-Feeling.mp4, size: 363741648
found 1 files
Done
[TsDemuxerer] Reading Video
[indexFile] Cannot find section Video,[Video]
*
[tsDemux] Cannot read Video section of /media/jan/Houden/Demo/hevc x264 4K & SD/hevc/hevc 4K 08-bit 3840x2160 Mpeg-h part2-Hevc LG_4K_View-the-Feeling.mp4.idx2
[tsDemuxer] Loaded 0


ffprobe LG_4K_View-the-Feeling.mp4
  Duration: 00:01:56.84, start: 4200.000000, bitrate: 24904 kb/s
  Program 1
    Stream #0:0[0x1011]: Video: hevc (Main) (HEVC / 0x43564548), yuv420p(tv), 3840x2160 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc
    Stream #0:1[0x1100](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 176 kb/s


download 346 MB @ demo-uhd3d.com: LG 4K - View the Feeling (http://demo-uhd3d.com/fiche.php?cat=uhd&id=101)
Title: Re: h265
Post by: eumagga0x2a on February 10, 2017, 04:47:41 PM
This is not really related to the topic (support for hw-accelerated decoding of HEVC via VDPAU), the MpegTS demuxer has difficulties to analyse this transport stream (this is not a mp4 file). FFmpeg complains about invalid timestamps in the video stream, but mpv manages to play the sample nevertheless (like a slide show due to slow CPU, of course).

Avidemux succeeds loading another Ultra-HD HEVC demo: http://demo-uhd3d.com/fiche.php?cat=uhd&id=45 (http://demo-uhd3d.com/fiche.php?cat=uhd&id=45), but crashes with a floating point exception (division by zero in avidemux_core/ADM_coreUtils/src/ADM_infoExtractorH265.cpp:224) loading a real-life DVB-T2 sample ("Das Erste HD" from http://forum.kodi.tv/showthread.php?tid=228769&pid=2333904#pid2333904 (http://forum.kodi.tv/showthread.php?tid=228769&pid=2333904#pid2333904)).
Title: Re: h265
Post by: mean on February 10, 2017, 05:33:55 PM
The HEVC/TS parser is incomplete
Additionnaly, the decoder in ffmpeg is not as robust as usual
Title: Re: h265
Post by: eumagga0x2a on February 11, 2017, 12:20:52 PM
Quote from: mean on February 09, 2017, 05:44:18 PM
and ffmpeg

This boils down to the question: does 3.0.6 support hevc 10 bit decoding via VDPAU or not?

Thank you very much for the hard work you put into h265 TS demuxing and hw decoding support! With terrestrial TV broadcasting in Germany switching to h265 by the end of March, this work is highly appreciated.
Title: Re: h265
Post by: Jan Gruuthuse on February 11, 2017, 01:57:42 PM
Probably not:
QuoteDXVA2-accelerated HEVC Main10 decoding
Quote10-bit depth support in native utvideo decoder
QuoteCUDA CUVID H264/HEVC decoder
source: June 27th, 2016, FFmpeg 3.1 "Laplace" (http://ffmpeg-users.933282.n4.nabble.com/ffmpeg-x265-profile-Main10-td4671490.html)

QuoteCUVID, which is also called nvdec by Nvidia now, can be used for decoding on Windows and Linux. In combination with nvenc it offers full hardware transcoding.
QuoteThe full set of codecs being available only on Pascal hardware, which adds VP9 and 10 bit support.

source: wiki: HWAccelIntro: CUDA/CUVID/NvDecode (https://trac.ffmpeg.org/wiki/HWAccelIntro#CUDACUVIDNvDecode)
Title: Re: h265
Post by: eumagga0x2a on February 11, 2017, 06:58:11 PM
Jan, I just saw

static int vdpau_hevc_init(AVCodecContext *avctx)
{
    VdpDecoderProfile profile;
    uint32_t level = avctx->level;

    switch (avctx->profile) {
    case FF_PROFILE_HEVC_MAIN:
        profile = VDP_DECODER_PROFILE_HEVC_MAIN;
        break;
    case FF_PROFILE_HEVC_MAIN_10:
        profile = VDP_DECODER_PROFILE_HEVC_MAIN_10;
        break;
    case FF_PROFILE_HEVC_MAIN_STILL_PICTURE:
        profile = VDP_DECODER_PROFILE_HEVC_MAIN_STILL;
        break;
    default:
        return AVERROR(ENOTSUP);
    }

    return ff_vdpau_common_init(avctx, profile, level);
}


in buildCore/ffmpeg/source/libavcodec/vdpau_hevc.c:403 with the bundled ffmpeg-3.0.6, which I interpreted as an indication that given driver and hardware support the ffmpeg in Avidemux would be capable of using VDPAU to decode 10 bit HEVC videos. CUDA CUVID decoding added in 3.2 is another matter alltogether IMVHO.
Title: Re: h265
Post by: Jan Gruuthuse on February 12, 2017, 05:37:46 AM
I could not find out, if this is still an issue:
QuoteSetting profiles
Currently, ffmpeg ââ,¬â€¹does not support setting profiles (main, high, ...) via the profile:v option, as libx264 does. However, the profile options can be set manually, as shown ââ,¬â€¹in this Super User post.
source: wiki:Encode/H.265 (https://trac.ffmpeg.org/wiki/Encode/H.265)
Title: Re: h265
Post by: Jan Gruuthuse on February 19, 2017, 10:56:20 AM
10-bit would this also require 10-bit build: x265 libx265 libx265-dev?
Apparently stock 16.04 is 8-bit build.
bad news:
Quotedisplay: :0   screen: 0
API version: 1
Information string: NVIDIA VDPAU Driver Shared Library  375.39  Tue Jan 31 19:41:00 PST 2017

Video surface:

name   width height types
-------------------------------------------
420     4096  4096  NV12 YV12
422     4096  4096  UYVY YUYV

Decoder capabilities:

name                        level macbs width height
----------------------------------------------------
MPEG1                           0 65536  4080  4080
MPEG2_SIMPLE                    3 65536  4080  4080
MPEG2_MAIN                      3 65536  4080  4080
H264_BASELINE                  41 65536  4096  4096
H264_MAIN                      41 65536  4096  4096
H264_HIGH                      41 65536  4096  4096
VC1_SIMPLE                      1  8190  2048  2048
VC1_MAIN                        2  8190  2048  2048
VC1_ADVANCED                    4  8190  2048  2048
MPEG4_PART2_SP                  3  8192  2048  2048
MPEG4_PART2_ASP                 5  8192  2048  2048
DIVX4_QMOBILE                   0  8192  2048  2048
DIVX4_MOBILE                    0  8192  2048  2048
DIVX4_HOME_THEATER              0  8192  2048  2048
DIVX4_HD_1080P                  0  8192  2048  2048
DIVX5_QMOBILE                   0  8192  2048  2048
DIVX5_MOBILE                    0  8192  2048  2048
DIVX5_HOME_THEATER              0  8192  2048  2048
DIVX5_HD_1080P                  0  8192  2048  2048
H264_CONSTRAINED_BASELINE      41 65536  4096  4096
H264_EXTENDED                  41 65536  4096  4096
H264_PROGRESSIVE_HIGH          41 65536  4096  4096
H264_CONSTRAINED_HIGH          41 65536  4096  4096
H264_HIGH_444_PREDICTIVE       41 65536  4096  4096
HEVC_MAIN                      153 36864  4096  2304
HEVC_MAIN_10                   --- not supported ---
HEVC_MAIN_STILL                --- not supported ---
HEVC_MAIN_12                   --- not supported ---
HEVC_MAIN_444                  --- not supported ---
Title: Re: h265
Post by: Jan Gruuthuse on February 19, 2017, 04:05:15 PM
For developers: devtalk nvidia: VDPAU: Expose HEVC Main10 support where available on-die (https://devtalk.nvidia.com/default/topic/940228/linux/vdpau-expose-hevc-main10-support-where-available-on-die)
Title: Re: h265
Post by: eumagga0x2a on February 19, 2017, 07:24:16 PM
I've already posted this link on the first page of this topic in http://avidemux.org/smif/index.php/topic,17453.msg79264.html#msg79264 (http://avidemux.org/smif/index.php/topic,17453.msg79264.html#msg79264).

libx265 (this is an encoder) is completely unrelated to the topic. HEVC 10-bit decoding is not supported by your graphics card in the first place.
Title: Re: h265
Post by: Jan Gruuthuse on February 20, 2017, 05:13:41 AM
Gtx 960 does support hdr (10-bit)
https://developer.nvidia.com/getting-know-new-hdr
https://uk.hardware.info/reviews/5890/2/test-the-geforce-gtx-960-is-the-best-htpc-gpu-of-this-moment-h265-on-the-gtx-960-innpractice

It is nvidia driver in relation to vdpau that doesn't for now.
The topic is only h265, (codec, used both ways: (de/en)coding
Title: Re: h265
Post by: eumagga0x2a on February 20, 2017, 08:27:31 AM
Quote from: eumagga0x2a on February 10, 2017, 04:47:41 PM
Avidemux [...] crashes with a floating point exception (division by zero in avidemux_core/ADM_coreUtils/src/ADM_infoExtractorH265.cpp:224) loading a real-life DVB-T2 sample ("Das Erste HD" from http://forum.kodi.tv/showthread.php?tid=228769&pid=2333904#pid2333904 (http://forum.kodi.tv/showthread.php?tid=228769&pid=2333904#pid2333904)).

This is fixed by [h265 extractor] be resilient to missing timeframe info in sps (https://github.com/mean00/avidemux2/commit/e628c9c69a966a7ceceefb0e67a85ccc946e72df), thanks!

Quote from: Jan Gruuthuse on February 20, 2017, 05:13:41 AM
Gtx 960 does support hdr (10-bit) [...]

It is nvidia driver in relation to vdpau that doesn't for now.

You are right, my bad. GTX 960 is feature set F, I've confused it with GTX 980 which is only feature set E.
Title: Re: h265
Post by: Jan Gruuthuse on February 20, 2017, 11:00:17 AM
not on h265, but 10-bit:
QuoteNVIDIA Geforce graphics cards have offered 10-bit per color out to a full screen Direct X surface since the Geforce 200 series GPUs.  Due to the way most applications use traditional Windows API functions to create the application UI and viewport display, this method is not used for professional applications such as Adobe Premiere Pro and Adobe Photoshop.  These programs use OpenGL 10-bit per color buffers which require an NVIDIA Quadro GPU with DisplayPort connector.  A small number of monitors support 10-bit per color with Quadro graphics cards over DVI.
source: 10-bit per color support on NVIDIA Geforce GPUs Updated 08/02/2011 (http://nvidia.custhelp.com/app/answers/detail/a_id/3011/kw/10-bit%20color/session/L3RpbWUvMTQ4NzU4ODIxOC9zaWQvU2JCdmNJYm4%3D)