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.53k stars 200 forks source link

Conversion Assistance/Error #1603

Closed CanisHelix closed 2 years ago

CanisHelix commented 2 years ago

Describe the bug

[aac @ 0x6166840] Qavg: 1318.428
[aac @ 0x6166840] 2 frames left in the queue on closing

Error occurrring and failing to convert mkv to mp4 for 9 files of a series. Tried 4 times via Sonarr importing, and 1 time manual.

Command or context you are trying to run /usr/local/sma/venv/bin/python /usr/local/sma/manual.py -i ./Sword\ Art\ Online\ -\ S04E06\ -\ \[HDTV-1080p\]\[AAC\ 2.0\]\[x265\].mkv

autoProcess.ini settings

[Converter]
ffmpeg = ffmpeg
ffprobe = ffprobe
threads = 0
hwaccels = 
hwaccel-decoders = h264_cuvid, mjpeg_cuvid, mpeg1_cuvid, mpeg2_cuvid, mpeg4_cuvid, vc1_cuvid, hevc_qsv, h264_qsv, hevc_vaapi, h264_vaapi
hwdevices = vaapi:/dev/dri/renderD128
hwaccel-output-format = vaapi:vaapi
output-directory = 
output-format = mp4
output-extension = mp4
temp-extension = 
minimum-size = 0
ignored-extensions = nfo, ds_store
copy-to = 
move-to = 
delete-original = True
sort-streams = True
process-same-extensions = False
bypass-if-copying-all = False
force-convert = False
post-process = False
wait-post-process = False
detailed-progress = False
opts-separator = ,
preopts = 
postopts= -max_muxing_queue_size, 9999
regex-directory-replace = [^\w\-_\. ]
temp-output = False

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

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

[Video]
codec = h264, x264
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 = 
filter = 
force-filter = False
prioritize-source-pix-fmt = True

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

[Audio]
codec = ac3
languages = 
default-language = 
first-stream-of-language = False
allow-language-relax = True
channel-bitrate = 128
max-bitrate = 0
max-channels = 0
prefer-more-channels = True
filter = 
force-filter = False
sample-rates = 
copy-original = False
aac-adtstoasc = False
ignore-truehd = mp4, m4v
ignored-dispositions = 
unique-dispositions = False
sample-format = 
stream-codec-combinations = 
variable-bitrate = 0
profile = 

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

[Audio.ChannelFilters]
6-2 = 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

[Subtitle]
codec = mov_text
codec-image-based = 
languages = 
default-language = 
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 = 
unique-dispositions = False
attachment-codec = 
remove-bitstream-subs = False

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

[Subtitle.Subliminal.Auth]
opensubtitles = 
tvsubtitles = 

[Sonarr]
host = io.lan
port = 8989
apikey = XXX
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

[Radarr]
host = forge-master.lan
port = 7878
apikey = XXX
ssl = False
webroot = 
force-rename = False
rescan = True
block-reprocess = False

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

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

[CouchPotato]
host = localhost
port = 5050
username = 
password = 
apikey = 
delay = 65
method = renamer
delete-failed = False
ssl = False
webroot = 

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

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

[qBittorrent]
couchpotato-label = couchpotato
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]
couchpotato-label = couchpotato
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 = io.lan
port = 32400
refresh = True
token = XXX

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

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

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

Log files Full log from manual run is at https://pastebin.com/T4b1wcKd

Debug Log Attached sma.log

FFMpeg headers ffmpeg version 5.0.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-li sma.log baom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 57. 17.100 / 57. 17.100 libavcodec 59. 18.100 / 59. 18.100 libavformat 59. 16.100 / 59. 16.100 libavdevice 59. 4.100 / 59. 4.100 libavfilter 8. 24.100 / 8. 24.100 libswscale 6. 4.100 / 6. 4.100 libswresample 4. 3.100 / 4. 3.100 libpostproc 56. 3.100 / 56. 3.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

System Information mdhiggins/sonarr-sma

mdhiggins commented 2 years ago

Subtitle encoding failed

Looks like you've got some bad subtitles in your source file that are messing up FFMPEG

Try turning on subtitle cleaning with CleanIt which looks like it's off in your settings

CanisHelix commented 2 years ago

I'll give that a try, this config file has served well for many years :) I did get the same errors on another series but adding the queue param to 9999 fixed that one (even though it also has the same subtitle error), hence I wasn't sure that was the cause. I'll try turning cleanit on next.

CanisHelix commented 2 years ago

So now I'm getting Non-monotonous DTS in output stream 0:3/Non-monotonous DTS in output stream 0:4/Non-monotonous DTS in output stream 0:5 (getting a new DEBUG log now), but these are Subtitle streams from the looks of it.

Going to try -fflags +igndts as recommend by some googling.

mdhiggins commented 2 years ago

Yeah unfortunately its really up to the creator of the source material but its really more an FFMPEG problem you have to work around but hopefully that sorts things out

mdhiggins commented 2 years ago

The DTS thing however is usually just a warning and shouldn't be causing failure, if that doesn't fix it just post the whole logs and I'll take a look

CanisHelix commented 2 years ago

The only way so far has been to use FFMPEG to strip out the subtitle streams completely. After cleanit I looked at the srt files it produced, each of them has a few subtitles lines that are over 100k characters in length, unicode bytes from the looks of it.

ffmpeg -i input -map 0 -map -0:s -map -0:d -c copy output

Would it be possible that this might work in pre/postopts too?

Just wondering if it's possible use cleanit to strip out and get the srt's, but not re-encode them back into the mp4, but leave the .srt's separated.

mdhiggins commented 2 years ago

Seems like it's just a corrupt subtitle file that's breaking the encoder

CanisHelix commented 2 years ago

More than likely a corrupt lined or two.

Do you think adding -map, 0, -map, -0:s, -map, -0:d would prevent it from embedding the subtitles, but allow CleanIt to extract them for manual cleanup as Plex can use .srt I think without being embedded.

Edit: embed-subs: False might be better if I'm reading this right.

mdhiggins commented 2 years ago

Just turn off embed subs in autoProcess and it'll extract them and clean

Change your sub codec to srt as well

CanisHelix commented 2 years ago

Thanks for all the help, got it working and converted now.