th0ma7 / synology

Synology personnal hack, info, tools & source code
220 stars 67 forks source link

Codec HEVC/h.265 #17

Closed yann29800 closed 2 years ago

yann29800 commented 2 years ago

Bonjour, L'intégration du codec h.265 est elle présente dans votre package ffmpeg actuel pour Synology? Merci Yannick

th0ma7 commented 2 years ago

Pour la toutes les architectures sur DSM6 et DSM7 oui

yann29800 commented 2 years ago

Etrange. Lorsque je fais un ffmpeg -encoders je n'ai pas libx265 dans la liste. D'ailleurs un ffmpeg -h encoder=hevc retourne ceci : Codec 'hevc' is known to FFmpeg, but no encoders for it are available. FFmpeg might need to be recompiled with additional external libraries.

th0ma7 commented 2 years ago

J'ai présumé x265 vs svt-hevc. svt-hevc est uniquement présent sous architecture x64 par contre x265 est disponible pour toutes les archtectures. Cependant ton NAS vient avec un ffmpeg par défaut fourni par Synology. Si tu veux utiliser le ffmpeg de SynoCommunity et non pas celui par défaut tu dois utiliser son chemin complet:

$ /var/packages/ffmpeg/target/bin/ffmpeg -version
ffmpeg version 4.4.2-45 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
configuration: --target-os=linux --cross-prefix=/home/spksrc/ffmpeg-codec2/spksrc/toolchain/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --prefix=/var/packages/ffmpeg/target --extra-cflags=-I/home/spksrc/ffmpeg-codec2/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/include --extra-ldflags=-L/home/spksrc/ffmpeg-codec2/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/lib --extra-libs='-lxml2 -ldl' --pkg-config=/usr/bin/pkg-config --ranlib=/home/spksrc/ffmpeg-codec2/spksrc/toolchain/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ranlib --enable-cross-compile --enable-rpath --enable-pic --enable-shared --enable-gpl --enable-version3 --enable-avresample --disable-debug --disable-static --disable-doc --extra-version=45 --extra-cflags=-DSYNO_VIDEOSTATION --extra-cflags=-fno-if-conversion --extra-cflags=-O3 --extra-cflags=-Wno-deprecated-declarations --enable-libcodec2 --enable-libxml2 --enable-demuxer=dash --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopenjpeg --enable-libmp3lame --enable-libbluray --enable-libspeex --enable-libtheora --enable-libcaca --enable-libdc1394 --enable-libvorbis --enable-libwebp --enable-libzmq --enable-gnutls --enable-libopus --enable-libsoxr --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librabbitmq --enable-libzvbi --enable-libx264 --enable-libx265 --enable-libvpx --enable-libshine --enable-chromaprint --enable-libdav1d --enable-frei0r --enable-librist --enable-libzimg --enable-libfdk-aac --enable-nonfree --enable-libass --enable-libaom --enable-libsvtav1 --enable-libsvthevc --arch=x86_64 --enable-vaapi --enable-libmfx --enable-libdrm
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100

VS celui par défaut sur le NAS (dans mon cas DSM6.2.4 sur architecture x64):

$ which ffmpeg
/bin/ffmpeg
$ ffmpeg -version
ffmpeg version 2.7.7 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
configuration: --prefix=/usr --incdir='${prefix}/include/ffmpeg' --arch=i686 --target-os=linux --cross-prefix=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --enable-cross-compile --enable-optimizations --enable-pic --enable-gpl --enable-shared --disable-static --enable-version3 --enable-nonfree --enable-libfaac --enable-encoders --enable-pthreads --disable-bzlib --disable-protocol=rtp --disable-muxer=image2 --disable-muxer=image2pipe --disable-swscale-alpha --disable-ffserver --disable-ffplay --disable-doc --disable-devices --disable-bzlib --disable-altivec --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libmp3lame --disable-vaapi --disable-decoder=amrnb --disable-decoder=ac3 --disable-decoder=ac3_fixed --disable-encoder=zmbv --disable-encoder=dca --disable-encoder=ac3 --disable-encoder=ac3_fixed --disable-encoder=eac3 --disable-decoder=dca --disable-decoder=eac3 --disable-decoder=truehd --disable-decoder=hevc --disable-muxer=hevc --disable-demuxer=hevc --disable-parser=hevc --cc=/usr/local/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ccache-gcc --enable-yasm --enable-libx264 --enable-encoder=libx264
libavutil      54. 27.100 / 54. 27.100
libavcodec     56. 41.100 / 56. 41.100
libavformat    56. 36.100 / 56. 36.100
libavdevice    56.  4.100 / 56.  4.100
libavfilter     5. 16.101 /  5. 16.101
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  2.100 /  1.  2.100
libpostproc    53.  3.100 / 53.  3.100

Ci-bas le ffmpeg x64 que je fais pour SynoCommunity sur mon NAS :

$ /var/packages/ffmpeg/target/bin/ffmpeg  -h encoder=hevc 
ffmpeg version 4.4.2-45 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 4.9.3 (crosstool-NG 1.20.0) 20150311 (prerelease)
  configuration: --target-os=linux --cross-prefix=/home/spksrc/ffmpeg-codec2/spksrc/toolchain/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu- --prefix=/var/packages/ffmpeg/target --extra-cflags=-I/home/spksrc/ffmpeg-codec2/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/include --extra-ldflags=-L/home/spksrc/ffmpeg-codec2/spksrc/spk/ffmpeg/work-x64-6.1/install/var/packages/ffmpeg/target/lib --extra-libs='-lxml2 -ldl' --pkg-config=/usr/bin/pkg-config --ranlib=/home/spksrc/ffmpeg-codec2/spksrc/toolchain/syno-x64-6.1/work/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu-ranlib --enable-cross-compile --enable-rpath --enable-pic --enable-shared --enable-gpl --enable-version3 --enable-avresample --disable-debug --disable-static --disable-doc --extra-version=45 --extra-cflags=-DSYNO_VIDEOSTATION --extra-cflags=-fno-if-conversion --extra-cflags=-O3 --extra-cflags=-Wno-deprecated-declarations --enable-libcodec2 --enable-libxml2 --enable-demuxer=dash --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libopenjpeg --enable-libmp3lame --enable-libbluray --enable-libspeex --enable-libtheora --enable-libcaca --enable-libdc1394 --enable-libvorbis --enable-libwebp --enable-libzmq --enable-gnutls --enable-libopus --enable-libsoxr --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librabbitmq --enable-libzvbi --enable-libx264 --enable-libx265 --enable-libvpx --enable-libshine --enable-chromaprint --enable-libdav1d --enable-frei0r --enable-librist --enable-libzimg --enable-libfdk-aac --enable-nonfree --enable-libass --enable-libaom --enable-libsvtav1 --enable-libsvthevc --arch=x86_64 --enable-vaapi --enable-libmfx --enable-libdrm
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Encoder libx265 [libx265 H.265 / HEVC]:
    General capabilities: delay threads 
    Threading capabilities: other
    Supported pixel formats: yuv420p yuvj420p yuv422p yuvj422p yuv444p yuvj444p gbrp yuv420p10le yuv422p10le yuv444p10le gbrp10le yuv420p12le yuv422p12le yuv444p12le gbrp12le gray gray10le gray12le
libx265 AVOptions:
  -crf               <float>      E..V....... set the x265 crf (from -1 to FLT_MAX) (default -1)
  -qp                <int>        E..V....... set the x265 qp (from -1 to INT_MAX) (default -1)
  -forced-idr        <boolean>    E..V....... if forcing keyframes, force them as IDR frames (default false)
  -preset            <string>     E..V....... set the x265 preset
  -tune              <string>     E..V....... set the x265 tune parameter
  -profile           <string>     E..V....... set the x265 profile
  -x265-params       <dictionary> E..V....... set the x265 configuration using a :-separated list of key=value parameters

Encoder libsvt_hevc [SVT-HEVC(Scalable Video Technology for HEVC) encoder]:
    General capabilities: delay 
    Threading capabilities: none
    Supported pixel formats: yuv420p yuv420p10le yuv422p yuv422p10le yuv444p yuv444p10le
libsvt_hevc AVOptions:
  -asm_type          <boolean>    E..V....... Assembly instruction set type [0: C Only, 1: Auto] (default true)
  -aud               <boolean>    E..V....... Include Access Unit Delimiter (default false)
  -bl_mode           <boolean>    E..V....... Random Access Prediction Structure type setting (default false)
  -forced-idr        <int>        E..V....... If forcing keyframes, force them as IDR frames. (from -1 to INT_MAX) (default -1)
  -hielevel          <int>        E..V....... Hierarchical prediction levels setting (from 0 to 3) (default 3 level)
     flat            0            E..V.......
     1 level         1            E..V.......
     2 level         2            E..V.......
     3 level         3            E..V.......
  -la_depth          <int>        E..V....... Look ahead distance [0, 256] (from -1 to 256) (default -1)
  -level             <int>        E..V....... Set level (level_idc) (from 0 to 255) (default 0)
  -preset            <int>        E..V....... Encoding preset [0, 12] (from 0 to 12) (default 7)
  -profile           <int>        E..V....... Profile setting, Main Still Picture Profile not supported (from 1 to 4) (default 1)
  -qp                <int>        E..V....... QP value for intra frames (from 0 to 51) (default 32)
  -rc                <int>        E..V....... Bit rate control mode (from 0 to 1) (default cqp)
     cqp             0            E..V.......
     vbr             1            E..V.......
  -sc_detection      <boolean>    E..V....... Scene change detection (default true)
  -socket            <int>        E..V....... Target CPU socket to use.  -1 use all available (from -1 to 1) (default -1)
  -thread_count      <int>        E..V....... Number of threads [0: Auto, 96: Min] (from 0 to INT_MAX) (default 0)
  -tier              <int>        E..V....... Set tier (general_tier_flag) (from 0 to 1) (default main)
     main            0            E..V.......
     high            1            E..V.......
  -tune              <int>        E..V....... Quality tuning mode (from 0 to 2) (default oq)
     sq              0            E..V....... Visually optimized mode
     oq              1            E..V....... PSNR / SSIM optimized mode
     vmaf            2            E..V....... VMAF optimized mode
  -hdr               <int>        E..V....... High dynamic range input (HDR10) (from 0 to 1) (default 0)
  -umv               <boolean>    E..V....... Enables or disables unrestricted motion vectors (default true)
  -tile_row_cnt      <int>        E..V....... tile count in the row (from 1 to 16) (default 1)
  -tile_col_cnt      <int>        E..V....... tile count in the column (from 1 to 16) (default 1)
  -tile_slice_mode   <boolean>    E..V....... per slice per tile, only valid for multi-tile (default false)
  -pred_struct       <int>        E..V....... The prediction structure (from 0 to 2) (default 2)
  -vid_info          <boolean>    E..V....... Enables or disables sending a vui structure in the HEVC Elementary bitstream. (default false)

Encoder hevc_qsv [HEVC (Intel Quick Sync Video acceleration)]:
    General capabilities: delay hybrid 
    Threading capabilities: none
    Supported hardware devices: qsv qsv qsv 
    Supported pixel formats: nv12 p010le qsv
hevc_qsv encoder AVOptions:
  -async_depth       <int>        E..V....... Maximum processing parallelism (from 1 to INT_MAX) (default 4)
  -avbr_accuracy     <int>        E..V....... Accuracy of the AVBR ratecontrol (from 0 to INT_MAX) (default 0)
  -avbr_convergence  <int>        E..V....... Convergence of the AVBR ratecontrol (from 0 to INT_MAX) (default 0)
  -preset            <int>        E..V....... (from 1 to 7) (default medium)
     veryfast        7            E..V.......
     faster          6            E..V.......
     fast            5            E..V.......
     medium          4            E..V.......
     slow            3            E..V.......
     slower          2            E..V.......
     veryslow        1            E..V.......
  -rdo               <int>        E..V....... Enable rate distortion optimization (from -1 to 1) (default -1)
  -max_frame_size    <int>        E..V....... Maximum encoded frame size in bytes (from -1 to 65535) (default -1)
  -max_slice_size    <int>        E..V....... Maximum encoded slice size in bytes (from -1 to 65535) (default -1)
  -bitrate_limit     <int>        E..V....... Toggle bitrate limitations (from -1 to 1) (default -1)
  -mbbrc             <int>        E..V....... MB level bitrate control (from -1 to 1) (default -1)
  -extbrc            <int>        E..V....... Extended bitrate control (from -1 to 1) (default -1)
  -adaptive_i        <int>        E..V....... Adaptive I-frame placement (from -1 to 1) (default -1)
  -adaptive_b        <int>        E..V....... Adaptive B-frame placement (from -1 to 1) (default -1)
  -b_strategy        <int>        E..V....... Strategy to choose between I/P/B-frames (from -1 to 1) (default -1)
  -forced_idr        <boolean>    E..V....... Forcing I frames as IDR frames (default false)
  -low_power         <boolean>    E..V....... enable low power mode(experimental: many limitations by mfx version, BRC modes, etc.) (default auto)
  -idr_interval      <int>        E..V....... Distance (in I-frames) between IDR frames (from -1 to INT_MAX) (default 0)
     begin_only      -1           E..V....... Output an IDR-frame only at the beginning of the stream
  -load_plugin       <int>        E..V....... A user plugin to load in an internal session (from 0 to 2) (default hevc_hw)
     none            0            E..V.......
     hevc_sw         1            E..V.......
     hevc_hw         2            E..V.......
  -load_plugins      <string>     E..V....... A :-separate list of hexadecimal plugin UIDs to load in an internal session (default "")
  -profile           <int>        E..V....... (from 0 to INT_MAX) (default unknown)
     unknown         0            E..V.......
     main            1            E..V.......
     main10          2            E..V.......
     mainsp          3            E..V.......
     rext            4            E..V.......
  -gpb               <boolean>    E..V....... 1: GPB (generalized P/B frame); 0: regular P frame (default true)
  -tile_cols         <int>        E..V....... Number of columns for tiled encoding (from 0 to 65535) (default 0)
  -tile_rows         <int>        E..V....... Number of rows for tiled encoding (from 0 to 65535) (default 0)

Encoder hevc_vaapi [H.265/HEVC (VAAPI)]:
    General capabilities: dr1 delay hardware 
    Threading capabilities: none
    Supported hardware devices: vaapi 
    Supported pixel formats: vaapi_vld
h265_vaapi AVOptions:
  -low_power         <boolean>    E..V....... Use low-power encoding mode (only available on some platforms; may not support all encoding features) (default false)
  -idr_interval      <int>        E..V....... Distance (in I-frames) between IDR frames (from 0 to INT_MAX) (default 0)
  -b_depth           <int>        E..V....... Maximum B-frame reference depth (from 1 to INT_MAX) (default 1)
  -async_depth       <int>        E..V....... Maximum processing parallelism. Increase this to improve single channel performance (from 0 to 64) (default 4)
  -rc_mode           <int>        E..V....... Set rate control mode (from 0 to 6) (default auto)
     auto            0            E..V....... Choose mode automatically based on other parameters
     CQP             1            E..V....... Constant-quality
     CBR             2            E..V....... Constant-bitrate
     VBR             3            E..V....... Variable-bitrate
     ICQ             4            E..V....... Intelligent constant-quality
     QVBR            5            E..V....... Quality-defined variable-bitrate
     AVBR            6            E..V....... Average variable-bitrate
  -qp                <int>        E..V....... Constant QP (for P-frames; scaled by qfactor/qoffset for I/B) (from 0 to 52) (default 0)
  -aud               <boolean>    E..V....... Include AUD (default false)
  -profile           <int>        E..V....... Set profile (general_profile_idc) (from -99 to 255) (default -99)
     main            1            E..V.......
     main10          2            E..V.......
     rext            4            E..V.......
  -tier              <int>        E..V....... Set tier (general_tier_flag) (from 0 to 1) (default main)
     main            0            E..V.......
     high            1            E..V.......
  -level             <int>        E..V....... Set level (general_level_idc) (from -99 to 255) (default -99)
     1               30           E..V.......
     2               60           E..V.......
     2.1             63           E..V.......
     3               90           E..V.......
     3.1             93           E..V.......
     4               120          E..V.......
     4.1             123          E..V.......
     5               150          E..V.......
     5.1             153          E..V.......
     5.2             156          E..V.......
     6               180          E..V.......
     6.1             183          E..V.......
     6.2             186          E..V.......
  -sei               <flags>      E..V....... Set SEI to include (default hdr)
     hdr                          E..V....... Include HDR metadata for mastering display colour volume and content light level information
  -tiles             <image_size> E..V....... Tile columns x rows
yann29800 commented 2 years ago

Ok merci pour ton retour, cela fonctionne super bien, merci pour ton travail. Je vais enfin pouvoir gagner de la place sur mon NAS à qualité quasi équivalente en passant du codec h264 à h265.