Open laryan61 opened 9 months ago
I updated to the latest release of SMA. Then made the following edits to my .ini file. SMA now is working will with h264 input files and using my nVidia GPU for down scaling video files. But its not working for h265 input files, see below.
[Converter]
ffmpeg = /usr/local/bin/ffmpeg
ffprobe = /usr/local/bin/ffprobe
threads = 0
hwaccels = cuda, cuvid
hwaccel-decoders = h264_cuda, h264_cuvid, hevc_cuda, hevc_nvenc, mjpeg_cuvid, mpeg1_cuvid, mpeg2_cuvid, mpeg4_cuvid, vc1_cuvid
hwdevices =
hwaccel-output-format = cuda:cuda
output-directory = /media/data1/work
output-directory-space-ratio = 0.0
output-format = mp4
output-extension = mp4
temp-extension = rokuize
minimum-size = 50
ignored-extensions = nfo, ds_store
copy-to =
move-to = /media/data1/tvprocess
delete-original = True
process-same-extensions = True
bypass-if-copying-all = False
force-convert = False
post-process = False
wait-post-process = False
detailed-progress = True
opts-separator = ,
preopts =
postopts =
regex-directory-replace = [^\w\-_\. ]
[Permissions]
chmod = 0664
uid = -1
gid = -1
[Metadata]
relocate-moov = True
full-path-guess = True
tag = True
tag-language = eng
download-artwork = False
sanitize-disposition =
strip-metadata = True
keep-titles = False
[Video]
codec = h264_nvenc, h264, x264
max-bitrate = 2800
bitrate-ratio =
crf = -1
crf-profiles =
preset =
codec-parameters =
dynamic-parameters = False
max-width = 1280
profile = main
max-level = 4.1
pix-fmt =
prioritize-source-pix-fmt = True
filter =
force-filter = true
[HDR]
codec =
pix-fmt =
space = bt2020nc
transfer = smpte2084
primaries = bt2020
preset =
codec-parameters =
filter =
force-filter = False
profile =
[Audio]
codec = aac,ac3
languages = eng
default-language = eng
include-original-language = True
first-stream-of-language = False
channel-bitrate = 128
variable-bitrate = 0
max-bitrate = 0
max-channels = 0
filter = volume=5dB
profile =
force-filter = False
sample-rates =
sample-format =
copy-original = False
aac-adtstoasc = False
ignored-dispositions =
force-default = False
unique-dispositions = False
stream-codec-combinations =
[Audio.Sorting]
sorting = language, channels.d, map, d.comment
default-sorting = channels.d, map, d.comment
codecs =
[Universal Audio]
codec = aac
channel-bitrate = 128
variable-bitrate = 0
first-stream-only = False
filter =
profile =
force-filter = False
[Audio.ChannelFilters]
[Subtitle]
codec = mov_text
codec-image-based =
languages = eng
default-language = eng
include-original-language = False
first-stream-of-language = False
encoding =
burn-subtitles = False
burn-dispositions =
embed-subs = True
embed-image-subs = False
embed-only-internal-subs = False
filename-dispositions = forced
ignore-embedded-subs = False
ignored-dispositions =
force-default = False
unique-dispositions = False
attachment-codec =
remove-bitstream-subs = False
[Subtitle.Sorting]
sorting = language, d.comment, d.default.d, d.forced.d
codecs =
burn-sorting = language, d.comment, d.default.d, d.forced.d
[Subtitle.CleanIt]
enabled = False
config-path =
tags =
[Subtitle.FFSubsync]
enabled = False
[Subtitle.Subliminal]
download-subs = False
download-forced-subs = False
include-hearing-impaired-subs = False
providers =
[Subtitle.Subliminal.Auth]
opensubtitles =
tvsubtitles =
=== the screen output.
Processing The Dukes of Hazzard Season 07 Episode 15 - Strange Visitor to Hazzard
Input Data
{
"format": "matroska,webm",
"format-fullname": "Matroska / WebM",
"video": {
"index": 0,
"codec": "hevc",
"bitrate": 6809455,
"pix_fmt": "yuv420p10le",
"profile": "main10",
"fps": 23.976023976023978,
"framedata": {
"pix_fmt": "yuv420p10le",
"color_space": "bt709",
"color_primaries": "bt709",
"color_transfer": "bt709",
"side_data_list": [
{
"side_data_type": "H.26[45] User Data Unregistered SEI message"
},
{
"side_data_type": "H.26[45] User Data Unregistered SEI message"
}
]
},
"dimensions": "1920x1080",
"level": 4.0,
"field_order": "unknown"
},
"audio": [
{
"index": 1,
"codec": "aac",
"bitrate": 160357,
"channels": 2,
"samplerate": 48000,
"language": "eng",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions"
}
],
"subtitle": [],
"attachment": []
}
Reading video stream.
Video codec detected: hevc.
Pix Fmt: yuv420p10le.
Profile: main10.
Pix-fmt adjusted to yuv420p in order to maintain compatible bit-depth <=8.
Video codec parameters None.
Creating h264_nvenc video stream from source stream 0.
Reading audio streams.
The following stream indexes have been identified as being copies: [] [stream-codec-combinations].
Audio detected for stream 1 - aac eng 2 channel.
Creating copy audio stream from source stream 1.
Found 0 streams that can be removed from the output file since they will be duplicates [stream-codec-combinations].
Final sorting:
['0->0']
Final sorting:
['0->0']
Default audio stream set to eng copy 2 channel stream [audio-default-sorting: ['channels.d', 'map', 'd.comment']].
Reading subtitle streams.
Scanned for external subtitles and found 0 results in your approved languages.
Final sorting:
[]
cuda hwaccel is supported by this ffmpeg build and will be used [hwaccels].
Output Data
{
"source": [
"/media/data1/tvdl/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).mkv"
],
"format": "mp4",
"video": {
"codec": "h264_nvenc",
"map": 0,
"bitrate": 2800,
"crf": -1,
"maxrate": null,
"bufsize": null,
"level": 4.1,
"profile": "main",
"preset": null,
"pix_fmt": "yuv420p",
"field_order": "unknown",
"width": 1280,
"filter": null,
"params": null,
"framedata": null,
"bsf": null,
"debug": "video.max-bitrate.max-width.profile",
"title": "HD"
},
"audio": [
{
"map": 1,
"codec": "copy",
"channels": 2,
"bitrate": 256,
"profile": null,
"quality": 0,
"filter": null,
"samplerate": null,
"sampleformat": "",
"language": "eng",
"disposition": "+default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions",
"bsf": null,
"debug": "universal-audio",
"title": "Stereo"
}
],
"subtitle": [],
"attachment": []
}
Preopts
[
"-hwaccel",
"cuda",
"-hwaccel_output_format",
"cuda"
]
Postopts
[
"-threads",
"0",
"-metadata:g",
"encoding_tool=SMA"
]
Starting conversion.
FFmpeg command:
======================
/usr/local/bin/ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i "/media/data1/tvdl/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).mkv" -map_metadata -1 -vcodec h264_nvenc -map 0:0 -pix_fmt yuv420p -vb 2800k -metadata:s:v BPS=2800000 -metadata:s:v BPS-eng=2800000 -metadata:s:v title=HD -metadata:s:v handler_name=HD -profile:v main -level 4.1 -tag:v avc1 -vf scale_npp=w=1280:h=720 -c:a:0 copy -map 0:1 -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=eng -disposition:a:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y "/media/data1/work/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).rokuize"
======================
[ ] 0% Error converting file, FFMPEG error.
Traceback (most recent call last):
File "/home/xbmc/rokuize/resources/mediaprocessor.py", line 2316, in convert
for timecode, debug in conv:
File "/home/xbmc/rokuize/converter/__init__.py", line 329, in convert
for timecode, debug in self.ffmpeg.convert(outfile,
File "/home/xbmc/rokuize/converter/ffmpeg.py", line 798, in convert
raise FFMpegConvertError('Exited with code %d' % p.returncode, cmd,
converter.ffmpeg.FFMpegConvertError: <unprintable FFMpegConvertError object>
/usr/local/bin/ffmpeg -hwaccel cuda -hwaccel_output_format cuda -i /media/data1/tvdl/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).mkv -map_metadata -1 -vcodec h264_nvenc -map 0:0 -pix_fmt yuv420p -vb 2800k -metadata:s:v BPS=2800000 -metadata:s:v BPS-eng=2800000 -metadata:s:v title=HD -metadata:s:v handler_name=HD -profile:v main -level 4.1 -tag:v avc1 -vf scale_npp=w=1280:h=720 -c:a:0 copy -map 0:1 -metadata:s:a:0 title=Stereo -metadata:s:a:0 handler_name=Stereo -metadata:s:a:0 language=eng -disposition:a:0 +default-dub-original-comment-lyrics-karaoke-forced-hearing_impaired-visual_impaired-captions -f mp4 -threads 0 -metadata:g encoding_tool=SMA -y /media/data1/work/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).rokuize
ffmpeg version N-113564-g3372876888 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.2)
configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-iconv --enable-version3 --enable-ffnvcodec --enable-nvdec --enable-gnutls --enable-fontconfig --enable-gmp --enable-zlib --enable-cuda --enable-cuvid --enable-nvenc
libavutil 58. 36.101 / 58. 36.101
libavcodec 60. 39.100 / 60. 39.100
libavformat 60. 20.100 / 60. 20.100
libavdevice 60. 4.100 / 60. 4.100
libavfilter 9. 17.100 / 9. 17.100
libswscale 7. 6.100 / 7. 6.100
libswresample 4. 13.100 / 4. 13.100
libpostproc 57. 4.100 / 57. 4.100
Input #0, matroska,webm, from '/media/data1/tvdl/The Dukes of Hazzard - S07E15 - Strange Visitor to Hazzard (1080p x265 EDGE2020).mkv':
Metadata:
encoder : libebml v1.4.2 + libmatroska v1.6.4
creation_time : 2022-02-05T02:57:31.000000Z
Duration: 00:48:24.97, start: 0.000000, bitrate: 6972 kb/s
Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
BPS : 6809455
DURATION : 00:48:24.944000000
NUMBER_OF_FRAMES: 69649
NUMBER_OF_BYTES : 2472635832
_STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-02-05 02:57:31
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream #0:1(eng): Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
BPS : 160357
DURATION : 00:48:24.917000000
NUMBER_OF_FRAMES: 136168
NUMBER_OF_BYTES : 58228244
_STATISTICS_WRITING_APP: mkvmerge v64.0.0 ('Willows') 64-bit
_STATISTICS_WRITING_DATE_UTC: 2022-02-05 02:57:31
_STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES
Stream mapping:
Stream #0:0 -> #0:0 (hevc (native) -> h264 (h264_nvenc))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Impossible to convert between the formats supported by the filter 'Parsed_scale_npp_0' and the filter 'auto_scale_0'
[vf#0:0 @ 0x557ae3f47000] Error reinitializing filters!
[vf#0:0 @ 0x557ae3f47000] Task finished with error code: -38 (Function not implemented)
[vf#0:0 @ 0x557ae3f47000] Terminating thread with return code -38 (Function not implemented)
[vost#0:0/h264_nvenc @ 0x557ae3f483c0] Could not open encoder before EOF
[vost#0:0/h264_nvenc @ 0x557ae3f483c0] Task finished with error code: -22 (Invalid argument)
[vost#0:0/h264_nvenc @ 0x557ae3f483c0] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 0x557ae3f5fcc0] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!
Suggestions?
Does it work without the scaler? Looks like it might be that filter that's throwing an error. Try adjusting your settings so you're not resizing the video
You're also converting from a 10 bit color format to 8 bit here which could be why you're seeing a difference
If you can provide a ffmpeg command that works for your hardware I can potentially guide you on what settings you need to adjust to achieve a similar output
Thanks for following up. It will be a day or two before I can test your suggestion.
This is the command that works to convert hevc/h265 to h264 and scale to 720p using my nVidia card. I've attached my autoprocess.ini file for your review. autoprocess.ini.txt
/usr/local/bin/ffmpeg -benchmark -hwaccel cuda -hwaccel_output_format cuda -i "/tvdl/video-file.1080p.HEVC.x265.mkv" -vf scale_cuda=-2:720 -c:v hevc_nvenc "/work/video-file.720p.x264.mp4"
Looks like SMA is defaulting to using scale_npp and you're using scale_cuda
If you set your encoder to h265_nvenc_cuda
it should switch this
I didn't previously have one for h264 but I just added h264_nvenc_cuda
as well
efc0f4103de293ce05afef25fc4837fa380a1565
Also, in your sample you are encoding to hevc not h264, so this is entirely different compared to your autoProcess config where you're converting to h264 which might account for some differences as well
But I would recommend either
[Video]
codec = h264_nvenc_cuda, h264
or if you're trying to convert to hevc
[Video]
codec = h265_nvenc_cuda, h264
Using SMA, just downloaded and installed it a few days ago, so a recent version.
My system is Linux Mint 20.2 Graphic card: nVidia TU116 [GeForce GTX 1660 Ti]
I built the ffmpeg using the following. ./configure --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-gpl --enable-gnutls --enable-libaom --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree --enable-nvenc --enable-cuvid
I only use your manual.py script, calling it from inside my own script the loops the media files, doing some "other" things before and after your script. As it is now it does process my 1080p media down to 720p, with my preferred bitrate, but it seems really slow. I doesn't look like its using my Nvidia GPU at all. Suggestions to allow your script & ffmpeg to utilize my gpu? Is there something I'm missing from my ffmpeg build? Any guidance would be helpful.
I've attached several file for your reference.
sma-codec-list.txt hwaccels-list.txt decoder-list.txt autoprocess.ini.txt sma.log.txt