Page 1 of 1

Script to change audio?

Posted: March 27th, 2019, 10:42 pm
by MartyIU13
I currently use ffmpeg to re-encode the audio on large 4K files to AC3 5.1 so Direct Play on Plex works and those large files don't have to be transcoded. Is there a way to add this process to run automatically in SAB as a post-processing script once a file is done downloading then send the file to the appropriate folder after?

I currently open up a cmd window and type:

ffmpeg -i originalfilename-map 0 -vcodec copy -scodec copy -acodec ac3 -b:a 640k newfilename

to keep the video as is and just change the audio to AC3 5.1. I was able to set it up and get that part working. Just hoping now I can make this automatic in SAB somehow. I am only doing this with huge 4K files as regular 1080 is fine with transcoding (or most are just encoded for direct play automatically anyways), but also wondering if on top of re-encoding the audio the script can also re-encode the video to H.264 if it is not already.

Just doing the audio part would be fine for now, but if one script, or multiple, can be run as a post processing script in SAB to get all files set with the right video and audio encoding for direct play purposes, that would be great. Any help would be appreciated!

Re: Script to change audio?

Posted: March 28th, 2019, 2:14 am
by safihre
Have you taken a look at https://sabnzbd.org/wiki/scripts/post-p ... ng-scripts ?

You will need to create a script, either Python or shell/bash script, and in that script you should automatically detect the filename.
So maybe try to match on ".mkv"?
I did a quick Google and already found some other ffmpeg-SABnzbd scripts, so maybe you can also take those or part of those?

Re: Script to change audio?

Posted: March 28th, 2019, 4:41 pm
by MartyIU13
Thank you, but was more hoping for a little more step by step. I have no idea how to create a script and detect the filename. Was hoping it would be a simple setting somewhere based on what I already setup with ffmpeg.

Re: Script to change audio?

Posted: April 1st, 2019, 1:05 pm
by safihre
Unfortunately I can't help much, I'm not too much of a Linux expert myself..

Re: Script to change audio?

Posted: April 1st, 2019, 2:23 pm
by OneCD
MartyIU13 wrote:
March 27th, 2019, 10:42 pm
I currently open up a cmd window and type:
Are you using Windows?

Re: Script to change audio?

Posted: April 2nd, 2019, 8:24 pm
by MartyIU13
OneCD wrote:
April 1st, 2019, 2:23 pm
MartyIU13 wrote:
March 27th, 2019, 10:42 pm
I currently open up a cmd window and type:
Are you using Windows?
Yes, Windows 10

Re: Script to change audio?

Posted: May 7th, 2019, 8:30 pm
by MartyIU13
Bump

Re: Script to change audio?

Posted: May 7th, 2019, 8:34 pm
by OneCD
Sorry Marty, I can help with scripting on Linux, but my Windows is a little rusty. Hopefully, someone can jump in and assist.