mdhiggins / sickbeard_mp4_automator

Automatically convert video files to a standardized format with metadata tagging to create a beautiful and uniform media library
MIT License
1.51k stars 201 forks source link

No device available for decoder: device type qsv needed for codec h264_qsv. #1523

Closed JasonMeudt closed 2 years ago

JasonMeudt commented 2 years ago

Switching over from Win to Ubuntu, I am getting the following error(s) in my SMA log when using my postSonarr.sh script.. I am using the 4.4.1 Jellyfin FFMPEG build. Funny thing is that using manual.py works just great...

WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".

and

[h264_qsv @ 0x55f603a5e240] No device available for decoder: device type qsv needed for codec h264_qsv.

2022-01-23 10:48:57 - resources.readsettings - INFO - /usr/bin/python3
2022-01-23 10:48:57 - resources.readsettings - INFO - Loading config file /media/data/git-clone/sickbeard_mp4_automator1/config/autoProcess.ini.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Processing /media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Input Data
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - {
    "format": "mov,mp4,m4a,3gp,3g2,mj2",
    "format-fullname": "QuickTime / MOV",
    "video": {
        "index": 0,
        "codec": "h264",
        "bitrate": 2249717,
        "pix_fmt": "yuv420p",
        "profile": "high",
        "fps": 23.976023976023978,
        "framedata": {
            "pix_fmt": "yuv420p",
            "color_space": "bt709",
            "color_primaries": "bt709",
            "color_transfer": "bt709",
            "side_data_list": [
                {
                    "side_data_type": "H.26[45] User Data Unregistered SEI message"
                }
            ]
        },
        "dimensions": "1920x1072",
        "level": 4.1,
        "field_order": "unknown"
    },
    "audio": [
        {
            "index": 1,
            "codec": "aac",
            "bitrate": 384003,
            "channels": 6,
            "samplerate": 48000,
            "language": "und",
            "disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired"
        }
    ],
    "subtitle": [],
    "attachment": []
}
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Reading video stream.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Video codec detected: h264.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Pix Fmt: yuv420p.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Profile: high.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Video codec parameters None.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Creating hevcqsv video stream from source stream 0.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Reading audio streams.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - The following stream indexes have been identified as being copies: [] [stream-codec-combinations].
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Audio detected for stream 1 - aac und 6 channel.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Creating ac3 audio stream from source stream 1.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Creating aac audio stream from source audio stream 1 [universal-audio].
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Found 0 streams that can be removed from the output file since they will dupcliates [stream-codec-combinations].
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Default audio stream set to und ac3 6 channel stream [default-more-channels: True].
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Reading subtitle streams.
2022-01-23 10:48:57 - resources.mediaprocessor - INFO - Scanned for external subtitles and found 0 results in your approved languages.
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - qsv hwaccel is supported by this ffmpeg build and will be used [hwaccels].
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - h264_qsv decoder is also supported by this ffmpeg build and will also be used [hwaccel-decoders].
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - Output Data
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - {
    "source": [
        "/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4"
    ],
    "format": "mp4",
    "video": {
        "codec": "hevcqsv",
        "map": 0,
        "bitrate": 2142.4267,
        "crf": 23,
        "maxrate": null,
        "bufsize": null,
        "level": 0.0,
        "profile": "main",
        "preset": null,
        "pix_fmt": null,
        "field_order": "unknown",
        "width": null,
        "filter": null,
        "params": null,
        "framedata": {
            "pix_fmt": "yuv420p",
            "color_space": "bt709",
            "color_primaries": "bt709",
            "color_transfer": "bt709",
            "side_data_list": [
                {
                    "side_data_type": "H.26[45] User Data Unregistered SEI message"
                }
            ]
        },
        "title": "FHD",
        "debug": "video.profile"
    },
    "audio": [
        {
            "map": 1,
            "codec": "aac",
            "channels": 2,
            "bitrate": 256,
            "quality": 0,
            "profile": null,
            "samplerate": null,
            "sampleformat": "",
            "filter": "dynaudnorm,pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE",
            "language": "und",
            "disposition": "-default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
            "title": "Stereo",
            "debug": "universal-audio"
        },
        {
            "map": 1,
            "codec": "ac3",
            "channels": 6,
            "bitrate": 768,
            "profile": null,
            "quality": 0,
            "filter": "dynaudnorm",
            "samplerate": null,
            "sampleformat": "",
            "language": "und",
            "disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired",
            "bsf": null,
            "title": "5.1 Channel",
            "debug": "audio"
        }
    ],
    "subtitle": [],
    "attachment": []
}
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - Preopts
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - [
    "-hwaccel",
    "qsv",
    "-vcodec",
    "h264_qsv"
]
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - Postopts
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - [
    "-threads",
    "0",
    "-metadata:g",
    "encoding_tool=SMA"
]
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - Starting conversion.
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - FFmpeg command:
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - ======================
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - /usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel qsv -vcodec h264_qsv -i "/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4.original" -map_metadata -1 -vcodec hevc_qsv -map 0:0 -crf 23 -metadata:s:v BPS=2142000 -metadata:s:v BPS-eng=2142000 -metadata:s:v title=FHD -metadata:s:v handler_name=FHD -profile:v main -x265-params colorprim=bt709:transfer=bt709:colormatrix=bt709 -tag:v hvc1 -c:a:0 aac -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -filter:a:0 dynaudnorm,pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=und -disposition:a:0 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -c:a:1 ac3 -map 0:1 -ac:a:1 6 -b:a:1 768k -metadata:s:a:1 BPS=768000 -metadata:s:a:1 BPS-eng=768000 -filter:a:1 dynaudnorm -metadata:s:a:1 "title=5.1 Channel" -metadata:s:a:1 "handler_name=5.1 Channel" -metadata:s:a:1 language=und -disposition:a:1 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y "/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4"
2022-01-23 10:48:58 - resources.mediaprocessor - INFO - ======================
2022-01-23 10:48:58 - resources.mediaprocessor - ERROR - Error converting file, FFMPEG error.
Traceback (most recent call last):
  File "/media/data/git-clone/sickbeard_mp4_automator1/resources/mediaprocessor.py", line 1825, in convert
    for timecode, debug in conv:
  File "/media/data/git-clone/sickbeard_mp4_automator1/converter/__init__.py", line 330, in convert
    for timecode, debug in self.ffmpeg.convert(outfile,
  File "/media/data/git-clone/sickbeard_mp4_automator1/converter/ffmpeg.py", line 735, in convert
    raise FFMpegConvertError('Exited with code %d' % p.returncode, cmd,
converter.ffmpeg.FFMpegConvertError: <unprintable FFMpegConvertError object>
2022-01-23 10:48:58 - resources.mediaprocessor - ERROR - /usr/lib/jellyfin-ffmpeg/ffmpeg -hwaccel qsv -vcodec h264_qsv -i /media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4.original -map_metadata -1 -vcodec hevc_qsv -map 0:0 -crf 23 -metadata:s:v BPS=2142000 -metadata:s:v BPS-eng=2142000 -metadata:s:v title=FHD -metadata:s:v handler_name=FHD -profile:v main -x265-params colorprim=bt709:transfer=bt709:colormatrix=bt709 -tag:v hvc1 -c:a:0 aac -map 0:1 -ac:a:0 2 -b:a:0 256k -metadata:s:a:0 BPS=256000 -metadata:s:a:0 BPS-eng=256000 -filter:a:0 dynaudnorm,pan=stereo|FL=0.5*FC+0.707*FL+0.707*BL+0.5*LFE|FR=0.5*FC+0.707*FR+0.707*BR+0.5*LFE -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=und -disposition:a:0 -default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -strict experimental -c:a:1 ac3 -map 0:1 -ac:a:1 6 -b:a:1 768k -metadata:s:a:1 BPS=768000 -metadata:s:a:1 BPS-eng=768000 -filter:a:1 dynaudnorm -metadata:s:a:1 title=5.1 Channel -metadata:s:a:1 handler_name=5.1 Channel -metadata:s:a:1 language=und -disposition:a:1 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y /media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4
2022-01-23 10:48:58 - resources.mediaprocessor - ERROR - ffmpeg version 4.4.1-Jellyfin Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.3.0-17ubuntu1~20.04)
  configuration: --prefix=/usr/lib/jellyfin-ffmpeg --target-os=linux --extra-version=Jellyfin --disable-doc --disable-ffplay --disable-shared --disable-libxcb --disable-sdl2 --disable-xlib --enable-lto --enable-gpl --enable-version3 --enable-static --enable-gmp --enable-gnutls --enable-libdrm --enable-libass --enable-libfreetype --enable-libfribidi --enable-libfontconfig --enable-libbluray --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libdav1d --enable-libwebp --enable-libvpx --enable-libx264 --enable-libx265 --enable-libzvbi --enable-libzimg --arch=amd64 --enable-opencl --enable-vaapi --enable-amf --enable-libmfx --enable-vdpau --enable-ffnvcodec --enable-cuda --enable-cuda-llvm --enable-cuvid --enable-nvdec --enable-nvenc
  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
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv".
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4.original':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.67.100
  Duration: 01:25:03.10, start: 0.000000, bitrate: 2639 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1072 [SAR 1:1 DAR 120:67], 2249 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 384 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption x265-params (set the x265 configuration using a :-separated list of key=value parameters) specified for output file #0 (/media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Device creation failed: -542398533.
[h264_qsv @ 0x55f603a5e240] No device available for decoder: device type qsv needed for codec h264_qsv.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
  Stream #0:1 -> #0:2 (aac (native) -> ac3 (native))
Device setup failed for decoder on input stream #0:0 : Generic error in an external library

2022-01-23 10:48:58 - resources.mediaprocessor - ERROR - /media/wd1/Videos/Christmas Movies/A Christmas Detour (2015)/A Christmas Detour (2015) [WEBRip-1080p].mp4 deleted.
2022-01-23 10:48:58 - RadarrPostProcess - INFO - Processing returned False.
2022-01-23 10:48:58 - RadarrPostProcess - ERROR - Error processing file.
Traceback (most recent call last):
  File "/media/data/git-clone/sickbeard_mp4_automator1/postRadarr.py", line 301, in <module>
    sys.exit(1)
SystemExit: 1
mdhiggins commented 2 years ago

This is an FFMPEG error related to hardware decoding, not really related to the script specifically

[h264_qsv @ 0x55f603a5e240] No device available for decoder: device type qsv needed for codec h264_qsv.
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_qsv) -> hevc (hevc_qsv))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
  Stream #0:1 -> #0:2 (aac (native) -> ac3 (native))
Device setup failed for decoder on input stream #0:0 : Generic error in an external library

Specifically related to your hardware decoder. If you're using the decoder with manual.py and it's working fine, then it's probably a permission issue. You're not explicitly setting a device here so it's using the default but you need to make sure whatever user Radarr is running under has permission to access your hardware acceleration device

The warning WARNING: defaulting hwaccel_output_format to qsv for compatibility with old commandlines. This behaviour is DEPRECATED and will be removed in the future. Please explicitly set "-hwaccel_output_format qsv". can be fixed by setting your format in autoProcess.ini

hwaccel-output-format = qsv:qsv

The default device is usually /dev/dri/renderD128 to help point you in the right direction for permission fixing

JasonMeudt commented 2 years ago

While I am sure that there are a TON of needs for permissions, as a new user to *nix, there is always something 'wrong' and it can almost always be traced back to improper permissions...

That said, radarr needed to be added to the render group via:

sudo usermod -a -G render radarr

For the next newbie who has not grasped the nuances in permissions...

Thanks for being so gentle!