Plex doesn’t seem to install comskip on linux by default. Although it says it uses it, it’s not in the tarball so nothing actually happens. I guess it assumes you’ve figured it out on your own(?).
Install comskip:
Dependencies:
apt-get install -y autoconf libtool git build-essential libargtable2-dev libavformat-dev libsdl1.2-dev
sudo su –
git clone git://github.com/erikkaashoek/Comskip
cd Comskip
./autogen.sh
./configure
make
make install
Auto-skip *should* work now if you set it up in the DVR settings, existing recordings won’t have commercials skipped.
Manual commercial scans (i.e. go fix my existing recordings!):
cd to your recording
comskip –ini=/usr/lib/plexmediaserver/Resources/comskip.ini MyRecording.ts
and wait.
it makes the edl and txt files for Plex to skip commercials, but does not modify the original file in any way
Or, go hit your entire DVR directory recursively:
Save this as /usr/bin/findcommercials
#!/bin/bash
# Save default separator definitions
oIFS=$IFS
# define new line as a separator, filenames can have spaces
IFS=$’\n’;
# For each file (f) listed as duplicated by fdupes, recursively
for f in `find . |grep .ts`
do
# Log the files we are touching
echo “Scanning for commercials in $f” >> ~/log.txt
echo “Scanning for commercials in $f”
# Run comskip
comskip –ini=/usr/lib/plexmediaserver/Resources/comskip.ini “$f”
done
# restore default separator definitions
IFS=$oIFS
To cut it up and make a new commercial free file:
cd ~
git clone https://github.com/BrettSheleski/comchap.git
cd comchap
cp comchap /usr/local/bin/comchap
cp comcut /usr/local/bin/comcut
comcut [OPTIONS] inputfile [OUTPUTFILE]
comcut –comskip-ini=/usr/lib/plexmediaserver/Resources/comskip.ini MyRecording.ts
To compress those pigs of ts files:
HandBrakeCLI -i The\ Wolverine\ \(2013\).ts -o The\ Wolverine\ \(2013\).mp4
There’s also:
ffmpeg -i input.ts -vcodec libx264 -vpre medium -crf 25 -ab 160k output.mp4
playing with the crf affects final file size
So, loop it through every ts file to catch up on commercial skipping, and compress the ts to mp4 (and heat up the room):
Save this as /usr/bin/findcommercialsandcompress
#!/bin/bash
# Save default separator definitions
oIFS=$IFS
# define new line as a separator, filenames can have spaces
IFS=$’\n’;
# For each file (f) listed as duplicated by fdupes, recursively
for f in `find . |grep .ts`
do
# Log the files we are touching
echo “This whole process will take a LONG time”
echo “Scanning for commercials in $f” >> ~/log.txt
echo “Scanning for commercials in $f”
# Run comskip
comskip –ini=/usr/lib/plexmediaserver/Resources/comskip.ini “$f”
# Run comcut
echo “Cutting out commercials in $f”
comcut –comskip-ini=/usr/lib/plexmediaserver/Resources/comskip.ini “$f”
# Compress them all, use the original filenames and make them .mp4
HandBrakeCLI -i ${f} -o ${f%.ts}.mp4
# Remove the original ts, if youre feeling brave
rm -f ${f}
done
# restore default separator definitions
IFS=$oIFS
Then:
chmod +x /usr/bin/findcommercialsandcompress
You should be able to cd into the root of wherever you want to and run: findcommercialsandcompress
Commercial scanning is pretty quick, 800+fps on my
0:48:17 – 86853 frames in 105.40 sec(824.03 fps), 1.00 sec(828.00 fps), 50%
Don’t know how to make Plex do this automatically on Linux yet, but it has to be close… Maybe a symlink?