jellyfin / jellyfin-ffmpeg

FFmpeg for Jellyfin
https://jellyfin.org
Other
438 stars 119 forks source link

8 -> 10 bit conversion failes on hevc_qsv #294

Closed raysv closed 9 months ago

raysv commented 9 months ago

Describe The Bug Just testet ffmpeg-jellyfin6 and h265 encoding. With v6 not possible to convert to p0101e

It do however work for av1_qsv

- Reverting back to jellyfin-ffmpeg5 fixes the issue, but then av1 will not work :)

Expected Behavior To encode the video to 10bit

System (please complete the following information):

Linux Ubuntu 23.10

nyanmisaka commented 9 months ago

I can't get a single issue when transcoding 8-bit HEVC to 10-bit HEVC with hevc_qsv encoder on my Arc A380. Rather than it being a jellyfin-ffmpeg6 issue, this is more like an error in your command line or kernel driver.

# /usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel qsv -hwaccel_output_format qsv  \
# -i /media/Big_Buck_Bunny_1080_10s_30MB.mp4 -an -sn -vf scale_qsv=format=p010 \
# -c:v hevc_qsv -preset veryslow -global_quality 20 -f null -

ffmpeg version 6.0-Jellyfin Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12 (Debian 12.2.0-14)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-ptx-compression --disable-static --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-shared --enable-gmp --enable-gnutls --enable-chromaprint --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libopenmpt --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --enable-libfdk-aac --arch=amd64 --enable-libsvtav1 --enable-libshaderc --enable-libplacebo --enable-vulkan --enable-opencl --enable-vaapi --enable-amf --enable-libvpl --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/Big_Buck_Bunny_1080_10s_30MB.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    encoder         : Lavf58.10.100
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    genre           : Animation
  Duration: 00:00:10.00, start: 0.000000, bitrate: 25169 kb/s
  Stream #0:0[0x1](und): Video: hevc (Main) (hev1 / 0x31766568), yuv420p(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25163 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_qsv) -> hevc (hevc_qsv))
Press [q] to stop, [?] for help
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    title           : Big Buck Bunny, Sunflower version
    artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
    composer        : Sacha Goedegebure
    genre           : Animation
    comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
    encoder         : Lavf60.3.100
  Stream #0:0(und): Video: hevc, qsv(tv, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 30 fps, 30 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.3.100 hevc_qsv
    Side data:
      cpb: bitrate max/min/avg: 0/0/1000000 buffer size: 0 vbv_delay: N/A
frame=  300 fps=262 q=-0.0 Lsize=N/A time=00:00:09.86 bitrate=N/A speed= 8.6x    ts/s speed=N/A
video:9273kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

vainfo

# /usr/lib/jellyfin-ffmpeg/vainfo
Trying display: drm
libva info: VA-API version 1.20.0
libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_20
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.20 (libva 2.20.0)
vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.3.4 (c426dee)
vainfo: Supported profile and entrypoints
      VAProfileNone                   : VAEntrypointVideoProc
      VAProfileNone                   : VAEntrypointStats
      VAProfileMPEG2Simple            : VAEntrypointVLD
      VAProfileMPEG2Main              : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointVLD
      VAProfileH264Main               : VAEntrypointEncSliceLP
      VAProfileH264High               : VAEntrypointVLD
      VAProfileH264High               : VAEntrypointEncSliceLP
      VAProfileJPEGBaseline           : VAEntrypointVLD
      VAProfileJPEGBaseline           : VAEntrypointEncPicture
      VAProfileH264ConstrainedBaseline: VAEntrypointVLD
      VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP
      VAProfileHEVCMain               : VAEntrypointVLD
      VAProfileHEVCMain               : VAEntrypointEncSliceLP
      VAProfileHEVCMain10             : VAEntrypointVLD
      VAProfileHEVCMain10             : VAEntrypointEncSliceLP
      VAProfileVP9Profile0            : VAEntrypointVLD
      VAProfileVP9Profile0            : VAEntrypointEncSliceLP
      VAProfileVP9Profile1            : VAEntrypointVLD
      VAProfileVP9Profile1            : VAEntrypointEncSliceLP
      VAProfileVP9Profile2            : VAEntrypointVLD
      VAProfileVP9Profile2            : VAEntrypointEncSliceLP
      VAProfileVP9Profile3            : VAEntrypointVLD
      VAProfileVP9Profile3            : VAEntrypointEncSliceLP
      VAProfileHEVCMain12             : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointVLD
      VAProfileHEVCMain422_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain422_12         : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointVLD
      VAProfileHEVCMain444            : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_10         : VAEntrypointVLD
      VAProfileHEVCMain444_10         : VAEntrypointEncSliceLP
      VAProfileHEVCMain444_12         : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointVLD
      VAProfileHEVCSccMain            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain10          : VAEntrypointVLD
      VAProfileHEVCSccMain10          : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444         : VAEntrypointVLD
      VAProfileHEVCSccMain444         : VAEntrypointEncSliceLP
      VAProfileAV1Profile0            : VAEntrypointVLD
      VAProfileAV1Profile0            : VAEntrypointEncSliceLP
      VAProfileHEVCSccMain444_10      : VAEntrypointVLD
      VAProfileHEVCSccMain444_10      : VAEntrypointEncSliceLP
raysv commented 9 months ago

It's the ARC 380 I'm useing aswell. But strange that it works perfectly with jellyfin-ffmpeg5, but as soon as i upgrade to ffmpeg6 it errors out :)

Don't have access to that server right now, so can post the the parameters used and logs later today.

raysv commented 9 months ago

vainfo:

libva info: VA-API version 1.20.0 libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so libva info: Found init function __vaDriverInit_1_20 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.20 (libva 2.20.0) vainfo: Driver version: Intel iHD driver for Intel(R) Gen Graphics - 23.3.4 (c426dee) vainfo: Supported profile and entrypoints VAProfileNone : VAEntrypointVideoProc VAProfileNone : VAEntrypointStats VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSliceLP VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSliceLP VAProfileJPEGBaseline : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointEncPicture VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSliceLP VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSliceLP VAProfileHEVCMain10 : VAEntrypointVLD VAProfileHEVCMain10 : VAEntrypointEncSliceLP VAProfileVP9Profile0 : VAEntrypointVLD VAProfileVP9Profile0 : VAEntrypointEncSliceLP VAProfileVP9Profile1 : VAEntrypointVLD VAProfileVP9Profile1 : VAEntrypointEncSliceLP VAProfileVP9Profile2 : VAEntrypointVLD VAProfileVP9Profile2 : VAEntrypointEncSliceLP VAProfileVP9Profile3 : VAEntrypointVLD VAProfileVP9Profile3 : VAEntrypointEncSliceLP VAProfileHEVCMain12 : VAEntrypointVLD VAProfileHEVCMain422_10 : VAEntrypointVLD VAProfileHEVCMain422_10 : VAEntrypointEncSliceLP VAProfileHEVCMain422_12 : VAEntrypointVLD VAProfileHEVCMain444 : VAEntrypointVLD VAProfileHEVCMain444 : VAEntrypointEncSliceLP VAProfileHEVCMain444_10 : VAEntrypointVLD VAProfileHEVCMain444_10 : VAEntrypointEncSliceLP VAProfileHEVCMain444_12 : VAEntrypointVLD VAProfileHEVCSccMain : VAEntrypointVLD VAProfileHEVCSccMain : VAEntrypointEncSliceLP VAProfileHEVCSccMain10 : VAEntrypointVLD VAProfileHEVCSccMain10 : VAEntrypointEncSliceLP VAProfileHEVCSccMain444 : VAEntrypointVLD VAProfileHEVCSccMain444 : VAEntrypointEncSliceLP VAProfileAV1Profile0 : VAEntrypointVLD VAProfileAV1Profile0 : VAEntrypointEncSliceLP VAProfileHEVCSccMain444_10 : VAEntrypointVLD VAProfileHEVCSccMain444_10 : VAEntrypointEncSliceLP

I'm using the following output arguments: -global_quality 20 -look_ahead 1 -look_ahead_depth 100 -g 240 -tune film -pix_fmt p010e -profile: main10

Getting this message:

3-10-18T12:33:26.215Z Stream #0:0(zxx): Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)

63

2023-10-18T12:33:26.215Z Metadata:

64

2023-10-18T12:33:26.215Z title : MPEG-4 AVC Video / 30069 kbps / 1080p / 23.976 fps / 16:9 / High Profile 4.1

65

2023-10-18T12:33:26.215Z BPS : 29531341

66

2023-10-18T12:33:26.215Z NUMBER_OF_FRAMES: 97296

67

2023-10-18T12:33:26.215Z NUMBER_OF_BYTES : 14979972165

68

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_APP: mkvmerge v79.0 ('Funeral Pyres') 64-bit

69

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_DATE_UTC: 2023-10-06 02:02:33

70

2023-10-18T12:33:26.215Z _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

71

2023-10-18T12:33:26.215Z DURATION : 01:07:38.053000000

72

2023-10-18T12:33:26.215Z Stream #0:1(eng): Audio: truehd, 48000 Hz, 5.1(side), s32 (24 bit) (default)

73

2023-10-18T12:33:26.215Z Metadata:

74

2023-10-18T12:33:26.215Z title : Dolby TrueHD Audio / 5.1 / 48 kHz / 3056 kbps / 24-bit

75

2023-10-18T12:33:26.215Z BPS : 3055982

76

2023-10-18T12:33:26.215Z NUMBER_OF_FRAMES: 4869665

77

2023-10-18T12:33:26.215Z NUMBER_OF_BYTES : 1550167640

78

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_APP: mkvmerge v79.0 ('Funeral Pyres') 64-bit

79

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_DATE_UTC: 2023-10-06 02:02:33

80

2023-10-18T12:33:26.215Z _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

81

2023-10-18T12:33:26.215Z DURATION : 01:07:38.054000000

82

2023-10-18T12:33:26.215Z Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s

83

2023-10-18T12:33:26.215Z Metadata:

84

2023-10-18T12:33:26.215Z title : Compatibility Track / Dolby Digital Audio / 5.1 / 48 kHz / 640 kbps

85

2023-10-18T12:33:26.215Z BPS : 640000

86

2023-10-18T12:33:26.215Z NUMBER_OF_FRAMES: 126815

87

2023-10-18T12:33:26.215Z NUMBER_OF_BYTES : 324646400

88

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_APP: mkvmerge v79.0 ('Funeral Pyres') 64-bit

89

2023-10-18T12:33:26.215Z _STATISTICS_WRITING_DATE_UTC: 2023-10-06 02:02:33

90

2023-10-18T12:33:26.215Z _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

91

2023-10-18T12:33:26.215Z DURATION : 01:07:38.080000000

92

2023-10-18T12:33:26.215Z libva info: VA-API version 1.20.0

93

2023-10-18T12:33:26.215Z libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so

94

2023-10-18T12:33:26.215Z libva info: Found init function __vaDriverInit_1_20

95

2023-10-18T12:33:26.215Z libva info: va_openDriver() returns 0

96

2023-10-18T12:33:26.215Z libva info: VA-API version 1.20.0

97

2023-10-18T12:33:26.215Z libva info: Trying to open /usr/lib/jellyfin-ffmpeg/lib/dri/iHD_drv_video.so

98

2023-10-18T12:33:26.215Z libva info: Found init function __vaDriverInit_1_20

99

2023-10-18T12:33:26.215Z libva info: va_openDriver() returns 0

100

2023-10-18T12:33:26.215Z Stream mapping:

101

2023-10-18T12:33:26.215Z Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))

102

2023-10-18T12:33:26.215Z Stream #0:1 -> #0:1 (copy)

103

2023-10-18T12:33:26.215Z Stream #0:2 -> #0:2 (copy)

104

2023-10-18T12:33:26.215Z Press [q] to stop, [?] for help

105

2023-10-18T12:33:26.215Z Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'

106

2023-10-18T12:33:26.215Z Error reinitializing filters!

107

2023-10-18T12:33:26.215Z Failed to inject frame into filter network: Function not implemented

108

2023-10-18T12:33:26.215Z Error while processing the decoded data for stream #0:0

109

2023-10-18T12:33:26.215Z Conversion failed!

110

2023-10-18T12:33:26.215Z

111

2023-10-18T12:33:26.215Z DSw_05mhj:Node[Deadalus]:Worker[wee-weasel]:Running FFmpeg failed

112

2023-10-18T12:33:26.215Z DSw_05mhj:Node[Deadalus]:Worker[wee-weasel]:[-error-]

113

2023-10-18T12:33:26.215Z DSw_05mhj:Node[Deadalus]:Worker[wee-weasel]:Error: FFmpeg failed

114

2023-10-18T12:33:26.215Z DSw_05mhj:Node[Deadalus]:Worker[wee-weasel]:"FFmpeg failed"

115

2023-10-18T12:33:26.215Z DSw_05mhj:Node[Deadalus]:Worker[wee-weasel]:"Error: FFmpeg failed\n at

raysv commented 9 months ago

Error message: 2023-10-18T12:33:26.215Z Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0'

nyanmisaka commented 9 months ago

Impossible to convert between the formats supported by the filter 'Parsed_null_0' and the filter 'auto_scale_0' This indicates a pipeline error in your command line.

It looks you are not using our FFmpeg in Jellyfin. The QSV command line of FFmpeg 6.0 is not fully compatible with FFmpeg 5.0, so tell the maintainer of that application to fix compatibility with FFmpeg 6.0.

raysv commented 9 months ago

Weel, this is jellyfin-ffmpeg, did just run it thru tdarr to be able to copy paste the error since i'm not able to copy paste it from the server. the same error comes with running it ouside of tdarr aswell, even with the command you did use.

raysv commented 9 months ago

Weel, this is jellyfin-ffmpeg, did just run it thru tdarr to be able to copy paste the error since i'm not able to copy paste it from the server. the same error comes with running it ouside of tdarr aswell, even with the command you did use.

nyanmisaka commented 9 months ago

I'm using the following output arguments: -global_quality 20 -look_ahead 1 -look_ahead_depth 100 -g 240 -tune film -pix_fmt p010e -profile: main10

This is not enough to form a usable QSV transcoding command line, it is only part of the encoder parameters.

My guess is that you are mixing the hardware texture of the decoder output -hwaccel qsv -hwaccel_output_format qsv with the forced software filter -pix_fmt p010. This is not allowed in FFmpeg 6.0.

raysv commented 9 months ago

You are probably right, managed to get your line to work now, So indeed correct! Ill revert back to ffmpeg5 for a while since im using the same ffmpeg for tdarr and jellyfin :)

Thanks for the help :D much appriciated!