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.5k stars 206 forks source link

[Question] Speed up process? #1694

Closed justinglock40 closed 6 months ago

justinglock40 commented 6 months ago

Is there some things I can do to speed up a AAC and English only SRT creations?

Right now a 3GB 1080p H.264 takes about 3-3 1/2 mins to copy the video and ac3 track and create an AAC track and remove all subs except english and make SRT

On a 4K Remux, this process is happening in about 10-15 minutes.

Hardware is a i5-9600K and the processing happens on a NVME PCIE 4 Gen 4. Not true issue, just wondering if something I'm doing is slowing this process down?

[Converter]
ffmpeg = ffmpeg
ffprobe = ffprobe
threads = 0
hwaccels = vaapi
hwaccel-decoders = vaapi
hwdevices = /dev/dri/renderD128
hwaccel-output-format = vaapi:vaapi
output-directory = 
output-format = mkv
output-extension = mkv
temp-extension = 
minimum-size = 0
ignored-extensions = nfo, ds_store
copy-to = 
move-to = 
delete-original = True
process-same-extensions = True
bypass-if-copying-all = False
force-convert = True
post-process = False
wait-post-process = False
detailed-progress = False
opts-separator = ,
preopts = 
postopts = 
regex-directory-replace = [^\w\-_\. ]
output-directory-space-ratio = 0.0

[Permissions]
chmod = 0666
uid = -1
gid = -1

[Metadata]
relocate-moov = False
full-path-guess = True
tag = True
tag-language = eng
download-artwork = poster
sanitize-disposition = 
strip-metadata = False
keep-titles = False

[Video]
codec = copy
max-bitrate = 0
bitrate-ratio = 
crf = -1
crf-profiles = 
preset = 
codec-parameters = 
dynamic-parameters = False
max-width = 0
profile = 
max-level = 0.0
pix-fmt = 
prioritize-source-pix-fmt = True
filter = 
force-filter = False

[HDR]
codec = 
pix-fmt = 
space = bt2020nc
transfer = smpte2084
primaries = bt2020
preset = 
codec-parameters = 
filter = 
force-filter = False
profile = 

[Audio]
codec = copy
languages = 
default-language = eng
first-stream-of-language = False
allow-language-relax = True
relax-to-default = False
channel-bitrate = 80
variable-bitrate = 0
max-bitrate = 0
max-channels = 0
filter = 
profile = 
force-filter = False
sample-rates = 
sample-format = 
copy-original = True
aac-adtstoasc = False
ignored-dispositions = 
force-default = False
unique-dispositions = False
stream-codec-combinations = 
include-original-language = True

[Audio.Sorting]
sorting = language, channels.d, map, d.comment
default-sorting = language, channels.d, map, d.comment
codecs = aac, ac3, dts, truehd

[Universal Audio]
codec = aac
channel-bitrate = 128
variable-bitrate = 0
first-stream-only = true
filter = 
profile = 
force-filter = False

[Audio.ChannelFilters]

[Subtitle]
codec = srt
codec-image-based = 
languages = eng
default-language = eng
first-stream-of-language = False
encoding = 
burn-subtitles = False
burn-dispositions = 
embed-subs = True
embed-image-subs = False
embed-only-internal-subs = True
filename-dispositions = forced
ignore-embedded-subs = False
ignored-dispositions = 
force-default = False
unique-dispositions = False
attachment-codec = 
remove-bitstream-subs = False
include-original-language = False

[Subtitle.Sorting]
sorting = language, d.comment, d.default.d, d.forced.d
burn-sorting = language, d.comment, d.default.d, d.forced.d
codecs = 

[Subtitle.CleanIt]
enabled = False
config-path = 
tags = 

[Subtitle.Subliminal]
download-subs = False
download-hearing-impaired-subs = False
providers = 
download-forced-subs = False
include-hearing-impaired-subs = False

[Subtitle.Subliminal.Auth]
opensubtitles = 
tvsubtitles = 

[Sonarr]
host = localhost
port = 8989
apikey = 
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False
in-progress-check = True

[Radarr]
host = localhost
port = 7878
apikey = 
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False
in-progress-check = True

[Sickbeard]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[Sickrage]
host = localhost
port = 8081
ssl = False
apikey = 
webroot = 
username = 
password = 

[SABNZBD]
convert = True
sickbeard-category = sickbeard
sickrage-category = sickrage
sonarr-category = sonarr
radarr-category = radarr
bypass-category = bypass
output-directory = 
path-mapping = 

[Deluge]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
host = localhost
port = 58846
username = 
password = 
output-directory = 
remove = False
path-mapping = 

[qBittorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
action-before = 
action-after = 
host = localhost
port = 8080
ssl = False
username = 
password = 
output-directory = 
path-mapping = 

[uTorrent]
sickbeard-label = sickbeard
sickrage-label = sickrage
sonarr-label = sonarr
radarr-label = radarr
bypass-label = bypass
convert = True
webui = False
action-before = 
action-after = 
host = localhost
ssl = False
port = 8080
username = 
password = 
output-directory = 
path-mapping = 

[Plex]
host = localhost
port = 32400
refresh = False
token = 
username = 
password = 
servername = 
ssl = True
ignore-certs = False
path-mapping = 

[Subtitle.FFSubsync]
enabled = False
mdhiggins commented 6 months ago

This is more of a general FFMPEG question and maybe not the appropriate place to be asking but I can give some general guidance

Without logs it will be hard to nail down a specific bottleneck but there's always going to be some kind of bottle neck

If you're remuxing everything and doing no transcoding then your HDD (or SSD) read/write speeds will be your main bottle neck

Metadata writing for MKVs does do a second pass and essentially writes the metadata with a full remux transcode as a second step so this can add some time since it essentially has to rewrap the streams in a fresh mkv container, but this is only limited by your drive read/write so should be relatively quick still, mp4's don't have this limitation since they are written by mutagen (though mp4s usually get processed by qtfaststart which also needs to rewrap the file so you come out even)

Transcoding is always where you lose the most speed

Video being the slowest even with hardware transcoding Software video transcoding depending on hardware can take hours Certain filters aren't supported by hardware transcoding so even when using hardware you can have a software layer that slows it down substantially

Then audio FFMPEG audio transcoders are pretty much all single threaded and do not benefit from hardware acceleration so it can take some time for larger sources but still should be measured in minutes not hours, an order of magnitude faster than video

Then subtitles which is almost negligible since its only text based subtitles which takes a few seconds at most

The other thing to consider is source material; Content length/duration and bitrate play a huge role. Higher bitrate means more data. This makes every part of the process take longer. Remuxing will take longer just due to bigger size. Transcoding can take longer for more complicated formats (more audio channels, higher fidelity formats, higher bitrate all make audio transcoding more complicated and time consuming). And higher quality transcoding comes at the cost of time.

You can watch the SMA logs to see if there's a particular spot that things are hanging but the times you are reporting don't seem excessive

I also use a ramdisk for most of my transcoding which speeds things up but you need quite a bit of ram for this approach, but this won't be huge gains over an ssd

justinglock40 commented 6 months ago

OK makes sense then. Thanks!