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.52k stars 202 forks source link

Nzbget Processing #938

Closed sbcrumb closed 4 years ago

sbcrumb commented 6 years ago

I have nzbget processing my files and it is working and sonarr is moving them but when the file moves it shows up in activity as unable to import. Import failed, path does not exist or is not accessible by Sonarr: /downloads/nzbs/nzbget/completed/sonarr/The.King.of.Queens.S07E22.720p.BluRay.x264-GECKOS

Yes the file was moved and is there. What logs should I be chasing down to find out what is happening.

mdhiggins commented 6 years ago

Might want to check your permissions and make sure whichever user/group that's running Sonarr has permission to access

sbcrumb commented 6 years ago

But the file is converted and moved. Just sits in Sonarr in yellow. Both are running in docker and sonarr can access the path cause it moves it after conversion.

mdhiggins commented 6 years ago

Hm that's weird. Anything in the Sonarr logs? What docker containers are you using?

sbcrumb commented 6 years ago

My nzbget docker is this one miguel1993/docker-nzbget-mp4_automator:latest
my sonarr is hotio/suitarr:sonarr I am going to download and get some logs.

mdhiggins commented 6 years ago

I do have my own docket containers that are published if you have any desire to give them a shot. I can confirm they work

Sent from my iPhone

On Oct 12, 2018, at 8:24 AM, sbcrumb notifications@github.com wrote:

My nzbget docker is this one miguel1993/docker-nzbget-mp4_automator:latest my sonarr is hotio/suitarr:sonarr I am going to download and get some logs.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

sbcrumb commented 6 years ago

Please link me if you have sonarr/radarr with it backed in I would love it try it. I found it.. Trying it now Will report back.

sbcrumb commented 6 years ago

I do have my own docket containers that are published if you have any desire to give them a shot. I can confirm they work Sent from my iPhone On Oct 12, 2018, at 8:24 AM, sbcrumb @.***> wrote: My nzbget docker is this one miguel1993/docker-nzbget-mp4_automator:latest my sonarr is hotio/suitarr:sonarr I am going to download and get some logs. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

I tried your radarr version but after download nothing happens. And the log is empty, nothing more in radarr then it was passed to nzbget to download. Script is pointing to /scripts/sickbeard_mp4_automator/postRadarr.py but nothing.

sbcrumb commented 6 years ago

I do have my own docket containers that are published if you have any desire to give them a shot. I can confirm they work Sent from my iPhone On Oct 12, 2018, at 8:24 AM, sbcrumb @.***> wrote: My nzbget docker is this one miguel1993/docker-nzbget-mp4_automator:latest my sonarr is hotio/suitarr:sonarr I am going to download and get some logs. — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

OK maybe this will make it easier. So I was able to get it to work with nzbget(which is cool) it is slow on some files larger 4k ones. But I can manually run this command and do a 50gb 4k file in 20 mins or less. This is my goal so I am curious what settings I would apply in my config to produce the same results. ffmpeg -i "input.mkv" \ -map 0:0 -map 0:1 -map 0:1 \ -c:v copy \ -c:a:0 aac -b:a:0 192k -ac 2 \ -c:a:1 copy \ "output.conv.mkv"

This works and honestly it works well. I am able to direct stream this 4k file on my devices no issues. If I could get your script to do this on nzbget processing like would be good.

mdhiggins commented 6 years ago

https://github.com/mdhiggins/sickbeard_mp4_automator/issues/412

That issue contains my docker-compose file and configuration information

It may be that things aren't configured appropriately to interact with each other but I can assure you that docker configuration works as its my own personal configuration.

I'm not 100% clear exactly where you're getting stuck in the process though.

Radarr/Sonarr initiate the download ok, NZBGet downloads and completes, does the file get passed back and moved to its final destination and just no encoding takes place? Is that an accurate description?

Or is the file not being passed back to Radarr/Sonarr after NZBGet finishes the download?

mdhiggins commented 6 years ago

https://hub.docker.com/r/mdhiggins/

sbcrumb commented 6 years ago

412

That issue contains my docker-compose file and configuration information

It may be that things aren't configured appropriately to interact with each other but I can assure you that docker configuration works as its my own personal configuration.

I'm not 100% clear exactly where you're getting stuck in the process though.

Radarr/Sonarr initiate the download ok, NZBGet downloads and completes, does the file get passed back and moved to its final destination and just no encoding takes place? Is that an accurate description?

Or is the file not being passed back to Radarr/Sonarr after NZBGet finishes the download?

NZBGET downloads it and it sits after that nothing happens, no encoding is started. Let me look at that issue see if it helps.

mdhiggins commented 6 years ago

Do you have completed download handling turned on? The docker scripts use that instead of NZBGetPostprocess

sbcrumb commented 6 years ago

Do you have completed download handling turned on? The docker scripts use that instead of NZBGetPostprocess

No complete handling is off just like the document says. I think my issue is that script path and arguments based on the readme versus the issue you posted I am not doing it right. so I think that could be part of it. Anyway you can also help me convert this command to work wiht your autoProcess.ini ffmpeg -i "input.mkv" \ -map 0:0 -map 0:1 -map 0:1 \ -c:v copy \ -c:a:0 aac -b:a:0 192k -ac 2 \ -c:a:1 copy \ "output.conv.mkv"

mdhiggins commented 6 years ago

I mean that's a standard command that will be generated with iOS audio enabled. You just need to get the script to actually execute. But for the docker images I would just use completed download handling, sync up your paths, and not use NZBGetPostProcess unless you need conversion immediately after downloading before the file goes back to Sonarr/Radarr

sbcrumb commented 6 years ago

I mean that's a standard command that will be generated with iOS audio enabled. You just need to get the script to actually execute. But for the docker images I would just use completed download handling, sync up your paths, and not use NZBGetPostProcess unless you need conversion immediately after downloading before the file goes back to Sonarr/Radarr

Ok that is good to know. I am going to mess withe settings when I get home mentioned in isssue #412 and see if that doesn't solve some of them Ideally I want to run it in sonarr/Radarr, so NZBget can keep downloading. Running it NZBget is a last resort since that works, it just holds up the processing que while each file converts. is all.

sbcrumb commented 6 years ago

I mean that's a standard command that will be generated with iOS audio enabled. You just need to get the script to actually execute. But for the docker images I would just use completed download handling, sync up your paths, and not use NZBGetPostProcess unless you need conversion immediately after downloading before the file goes back to Sonarr/Radarr

Finally got it to work .. However what I can't get is the conversion right.

[MP4]
ffmpeg = /usr/bin/ffmpeg
ffprobe = /usr/bin/ffprobe
threads = 0
output_directory = 
copy_to =  
move_to = 
output_extension = mkv
output_format = mkv
delete_original = False
relocate_moov = True
video-codec = h264, h265, hevc
video-bitrate = 
video-crf = 
video-max-width = 
video-profile = 
h264-max-level = 
use-qsv-decoder-with-encoder = False
use-hevc-qsv-decoder = False
enable_dxva2_gpu_decode = False
ios-audio = True
ios-first-track-only = False
ios-audio-filter = 
ios-move-last = False
max-audio-channels = 
audio-codec = aac,ac3
audio-language = eng
audio-default-language = eng 
audio-channel-bitrate = 
audio-filter = 
audio-copy-original = True
audio-first-track-of-language = False
subtitle-codec = mov_text
subtitle-language = eng
subtitle-default-language = 
subtitle-encoding = 
fullpathguess = True
convert-mp4 = False
tagfile = True
tag-language = en
download-artwork = Poster
download-subs = False
embed-subs = True
embed-only-internal-subs = False
sub-providers = addic7ed,podnapisi,thesubdb,opensubtitles
permissions = 0777
post-process = False
pix-fmt = 
aac_adtstoasc = False
postopts = 
preopts = 

Above is my config file, I would like to find the settings that equal this command I have used at the command line in the past.

ffmpeg -i "input.mkv" \
-map 0:0 -map 0:1 -map 0:1 \
-c:v copy \
-c:a:0 aac -b:a:0 192k -ac 2 \
-c:a:1 copy \
"output.conv.mkv"
mdhiggins commented 6 years ago

The options and command line generated will vary depending on your input material but your current options look like it should give you something relatively close to what you've got there What command are you getting? and can you post the FFPROBE info for one of your source files that isn't giving you the desired output?

sbcrumb commented 6 years ago

The options and command line generated will vary depending on your input material but your current options look like it should give you something relatively close to what you've got there What command are you getting? and can you post the FFPROBE info for one of your source files that isn't giving you the desired output?

So if I run the command on a file manually the one I posted the conversion takes 5 to 8 mins on a 5GB file. Below are details of the file I am testing on.

ffprobe version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, matroska,webm, from 'aa4f867cc3f8483a94e0a0ecda2e77cd.mkv':
  Metadata:
    title           : The Walking Dead 09x02 (The Bridge) - release by messafan for CasStudio
    encoder         : libebml v1.3.0 + libmatroska v1.4.1
    creation_time   : 2018-10-15T07:14:37.000000Z
  Duration: 00:45:06.78, start: 0.000000, bitrate: 14271 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: eac3, 48000 Hz, 5.1(side), fltp, 640 kb/s (default)
    Stream #0:2(eng): Subtitle: subrip
    Stream #0:3(eng): Subtitle: subrip
    Metadata:
      title           : SDH

Now if I let it process or if I run it manually it takes around 23 mins.

mdhiggins commented 5 years ago

When yo usay you run the command manually do you mean the exact same command generated by the script or the command you posted above? Because depending on if its transcoding vs remuxing times will be vastly different.

Also if you're using python 2.7 with 32 bit you may see some performance bottlenecks and upgrading to python3 with 64 bit can improve performance significantly

sbcrumb commented 5 years ago

I mean when I run my command manually versus the script or the manual.py. All my pythons are 64bit.

mdhiggins commented 5 years ago

So your 'my command' isn't dynamic, its static, so you need to post what command manual.py is generated for me to tell you why its taking longer, or at least post the output from manual.py because the commands generated are dynamic based on the input source. If you want a static command that doesn't adapt to the input material then you don't need anything as complicated as this script, you could just make a shell command and blanket process everything.

And are you using python 2 or 3?

sbcrumb commented 5 years ago

Manual processor started. /usr/bin/python Audio bitrate was invalid, defaulting to 256 per channel. 64bit Python. Enter path to file:

: /mnt/local/downloads/nzbs/nzbget/completed/software/Daddys.Home.2.(2017)/

Processing file /mnt/local/downloads/nzbs/nzbget/completed/software/Daddys.Home.2.(2017)/Daddys.Home.2.2017.2160p.BluRay.x265-WHITERHINO.mkv Matched movie title as: Daddy's Home 2 2017-11-09 Proceed using guessed identification from filename?

[y/n]: y

Processing Daddy's Home 2 Reading video stream. Video codec detected: hevc. Pix Fmt: yuv420p10le. Profile: Main 10. Reading audio streams. Audio detected for stream #1: truehd [eng]. MP4 containers do not support truehd audio, and converting it is inconsistent due to video/audio sync issues. Skipping stream 1 as typically the 2nd audio track is the AC3 core of the truehd stream. Audio detected for stream #2: ac3 [und]. Creating audio stream 0 from source audio stream 2 [iOS-audio]. Audio track is number 0 setting disposition to default Creating audio stream 1 from source stream 2. Audio Track is number 2 setting disposition to none Reading subtitle streams. Subtitle detected for stream #3: hdmv_pgs_subtitle [eng]. Subtitle detected for stream #4: hdmv_pgs_subtitle [eng]. No valid subtitle language specified, cannot download subtitles. { "preopts": [], "subtitle": {}, "format": "mp4", "postopts": [ "-threads", "0" ], "video": { "profile": null, "map": 0, "level": null, "codec": "h264", "bitrate": 33293.729, "pix_fmt": null }, "audio": { "0": { "map": 2, "language": "eng", "channels": 2, "codec": "aac", "disposition": "default", "bitrate": 256, "filter": null }, "1": { "map": 2, "language": "eng", "channels": 6, "codec": "copy", "disposition": "none", "bitrate": 1536, "filter": null } } } Starting conversion. [ ] 1% Python 3 I believe. Both are installed. But I think what is taking so long is TrueHD files.

mdhiggins commented 5 years ago

Its probably taking a while because your transcoding 4k video and actually transcoding the video portion instead of remuxing

sbcrumb commented 5 years ago

Anything I can do to speed it up. I really just want to add a 2.0 Stereo track for my 4k tv that I don't have a full surround sound on.

mdhiggins commented 5 years ago

You gotta add hevc and h265 to your approved video codecs so that it just copies the video stream and doesn't convert it

sbcrumb commented 5 years ago

Thanks I will try that tomorrow

sbcrumb commented 5 years ago

I did that but still takes an hour on my i7-7700K with 32GB of ram with a 4k 75GB file. is that the normal process time?

mdhiggins commented 5 years ago

Can you post the output like you did before? I'm curious if its still converting the video or not. It shouldn't take an hour

sbcrumb commented 5 years ago

Sure here is my config https://pastebin.com/UgM2PFGQ

And here is the output https://pastebin.com/fSGj5wTp

I had to use a new TrueHD file

mdhiggins commented 5 years ago

Looks like its copying the video which is the desired behavior. This one is probably taking a while because your source video has 7 different audio tracks, 6 of which are being converted to new a format, 1 copied

sbcrumb commented 5 years ago

My goal is to get the original copied and then a 2.0 added as the first track. So say the movie with 7.1 5.1 or whatever. I don't need the commentary crap. how do I drop the others and only keep the 2?

mdhiggins commented 5 years ago

ios-first-track-only = True audio-first-track-of-language = True

sbcrumb commented 5 years ago

ok let me try that now. Thanks for all your help.

sbcrumb commented 5 years ago

23 Mins on that one. Not bad. relocate_moov took bit. But This is way better. Thanks a ton.