***** WARNING ***** Setting up these scripts requires extensive use of WinSCP/terminal and/or PuTTY!!! If you haven't used these apps for accessing your NAS before, you are at a risk of screwing up your system! If you don't know what you are doing STOP NOW! You been warned! I'm not responsible for any damage you may do! ***** WARNING *****
***** WARNING ***** Cayar's scripts require Python 2.7 which is available from Asustor's App Central. Install this FIRST before trying to execute his scripts. The manual.py and several other scripts require editing before you can test them! ***** WARNING *****
A while back Cayars (Carlo) posted some scripts he uses to do transcoding/remuxxing of MKV to MP4. As the MP4 H264 with AAC (or AC3) and Web Optimized settings seem to be the easiest to Direct Play, I started messing with his scripts a bit. It solves having to move files back and forth and using HandBrake to do the task.
I have 2 NASes now. The AS-202T, the smallest and least capable of Asustor's line up. And the AS-7004T, the opposite end of the spectrum, the real work horse of Asustor's stable. The differences between the two are truly awe-inspiring. Even with the CPU in the 7004T, though, I have decided I would continue with remuxxing all of my movies/TV shows to make sure the NAS was able to Direct Play as much as possible. Bandwidth is still an ongoing problem in Alaska, so getting everything into a good format to begin with is a major win.
Cayars' post about his scripts can be located here: (This is in a Plex Pass only section of the forums, if you don't have a Plex Pass you can't get to the post!)
As he runs a Windows PMS, all of his scripts are geared toward this. Paths to ffmpeg and ffprobe, paths for the working directory and the done directory all reflect his local Windows structure. As such, there was a bit of editing needed to make these truly amazing scripts do their magic on an Asustor NAS.
First, you will need to download his scripts. The zip is linked in his post above. This zip file also contained the WINDOWS flavor of ffmpeg, so those aren't useful for us. So we're also going to need to download a working Linux flavor. (Don't get the one from Asustor's App Central, it's an older version and only designed for some photo manipulations for Asustor's lacking photo apps.)
You can get a good working copy of ffmpeg and all the rest of that suite here:
I grabbed the 32-bit static, as I started messing with this on the 202T which is a 32-bit OS. If you are running on a 60x, 50xx, 51xx or 70xx series you can grab the 64-bit static build and it should work great. For the 20x and 30x stay with a 32-bit. I use a bit different folder structure, as Asustor seems to wipe out any of the standard Linux user folders on each reboot, so I put all of my scripts into /volume1/misc.
I unzipped the static build of ffmpeg into a folder named /volume1/misc/FFMpeg. (I also put the 32-bit in it's own folder, and the 64-bit into it's own, just to keep them straight in my own mind, since I started this on the 202T and now working on a 7004T.) You can make this folder structure from within the ADM File Manager or Access Control apps. Refer to Asustor's documentation on making a new share.
Next you need to unzip Cayar's scripts in a folder. I put them into /volume1/misc/Convert. Here you will find a few folders, including /process and /done. The /process is where you are going to put the movie/TV show you want to convert. When the conversion happens, the new file will be in the /done folder.
Now for the editing on Cayar's scripts. These are HIS scripts, and I'm not posting the whole mess here, just the sections I have edited. The first file that needs editing is the manual.py file. (Same edit needs to happen in all the other .py files in his folder structure. Not sure how many are actually used, but I did them all anyway.)
This edit is just to point to Asustor's strange location for python, so the first line needs to read:
Cayar's script pointed to his local install of python, which won't work for your NAS. Other scripts I modified this way are /converter/_init_.py, /converter/avcodecs.py, /converter/ffmpeg.py, and /converter/formats.py.
The next script that needs editing is the auotProcess.ini file. this is just an initialization file, and contains pointers to ffmpeg, ffprobe and where we put the new files.
This is what I edited: (If you are running a 32-bit OS and have 32-bit FFMpeg installed as I outlined above, change the 64-bit folder name below to 32-bit.)
ffmpeg = /volume1/misc/FFMpeg/64-bit/ffmpeg ffprobe = /volume1/misc/FFMpeg/64-bit/ffprobe output_directory = /volume1/misc/Convert/done
The last bit of editing is the run.bat. I renamed this run.sh, even though, at this time, I'm not "running" it, but copying a line from it to use in a PuTTY session. The edits I did are in the last line and should read:
/volume1/misc/Convert/manual.py -a -i /volume1/misc/Convert/process
(This should all be on one line, the code function turned it into 2 lines by default and I can't get it looking right for some reason...)
To run the script now, just open up PuTTY with root access and copy/paste the line in run.bat (or run.sh) into the PuTTY command line and hit enter. Any movies/TV shows, even in deeper folders will be converted.
This strips out any embedded subtitles, keeping only the English ones, if you want other languages, refer to Cayar's documentation with his scripts. It makes an AAC audio track on track 1, and an AC3 track on track 2. What used to take several hours to do copying files, handbraking them and copying them back again, now takes minutes to perform.
Soon, I hope I can get a script to move files from a working folder into the process folder, then call all of these scripts with a cron job. If I get it working I'll post them as a follow up here.
GL all! And HEED THE WARNINGS!