Closed Chris230291 closed 2 years ago
"Undetermined" is treated like any other language. So, if you don't specify :und
as a language then most of those tracks will be stripped.
The exception being that the script will always keep the last audio track if no other audio tracks were selected during processing, regardless of what was specified. See issue #8.
In this way the script will never produce a video with no audio.
Edit: I have it figured out. Is there any way to run it on the existing files?
Is there any way to run it on the existing files?
Yes, though it will require light scripting. Before calling striptracks, you have to set two environment variables at a minimum:
radarr_eventtype
(value is not important) and radarr_moviefile_path
to the full path and filename of the videosonarr_eventtype
(value is not important) and sonarr_episodefile_path
to the full path and filename of the videoSo, as an example only, you could enter the following at the command line to keep all English and undetermined audio and English subtitles:
export radarr_eventtype="Remux" radarr_moviefile_path="/movies/Finding Nemo (2003)/Finding Nemo (2003).mkv" radarr_movie_title=$(basename "$file" ".${file##*.}"); /usr/local/bin/striptracks.sh :eng:und :eng
Hopefully that helps.
Thanks for your help
I wonder if you can help me? My bash knowledge is not great. I am trying to run the script on all files
find /movies/ -type f | while read file; do radarr_eventtype="Test";radarr_moviefile_path="$file";/usr/local/bin/striptracks.sh :eng:und :eng; done
I am getting Unknown environment:
I am running this inside the Docker container shell using Portainer.
I made a mistake in my original example. Try this:
find /movies/ -type f \( -name "*.mkv" -o -name "*.avi" -o -name "*.mp4" \) | while read file; do export radarr_eventtype="BatchRemux" radarr_moviefile_path="$file" radarr_movie_title=$(basename "$file" ".${file##*.}"); /usr/local/bin/striptracks.sh :eng:und :eng; done
The striptracks script will show several errors, but it should remux everything just fine.
Thanks that is working. What would be the equivalent for Sonarr? Would it need the series title?
For Sonarr, try the script below. I didn't bother trying to set the title because there are 4 separate variables that striptracks uses to build the title for TV shows, and that's too much to try to scrape from the file name with a simple script. The only impact it will have is the embedded Title in the MKV will be something nonsensical like " x -".
find /tv/ -type f \( -name "*.mkv" -o -name "*.avi" -o -name "*.mp4" \) | while read file; do export sonarr_eventtype="BatchRemux" sonarr_episodefile_path="$file"; /usr/local/bin/striptracks.sh :eng:und :eng; done
You've given me a good idea, though, to make striptracks more able to function standalone. That will take a bit of work, but I think it is doable. It will make it easier for the next person anyway!
Thanks. I'm not sure how I feel about having incorrect embedded titles. If that's something you would address in the future I would rather wait. Is it not possible to get the show, season and title from the filename or path? I think the default naming standard is {Series Title} - S{season:00}E{episode:00} - {Episode Title} {Quality Title}
.
It's possible, it's just not simple to code all the options. I think I have a backup plan, though. Let me work on getting the title fall back to the base file name if the Sonarr/Radarr variables aren't populated.
Thanks. Your script worked well on my movies dir. Freed up almost a terabyte of space. 👍
I uploaded my first pass at a batch mode. Try commit aed5d2.
This should set the Title attribute in the MKV to the basename of the video file. I put an example in the README.md file.
I think ultimately I'd like to process the pipeline natively in the script, but after some experimentation, that will take much more rework than I have time at the moment.
Thanks. I was able to run it on all of my tv shows without any issues.
What happens if the desired language isn't found? Suppose all of the tracks of a file are
und
(undetermined), will the file be left alone or will it strip all of the tracks?Thanks, Chris