Can ffmpeg write comskip info into the video file?

Thanks! Skipped by that without noticing it.

and here’s a little wrinkle to add the the mix.
Convert to x264 and add a bit of compression using ffmpeg

#!/bin/sh

DIR=`mktemp -d`

/usr/local/bin/comskip -n --output=$DIR -v1 --zpchapter "$1"  

INPUTFILE=$DIR/*.chp
CHAPTERS=$DIR/chapters.txt
TEMPMKV=$DIR/merged.mkv

echo $INPUTFILE
if [ -s $INPUTFILE ]
then
    cat $INPUTFILE | perl /home/media/scripts/convert_chapters.pl > $CHAPTERS
    if [ -s $CHAPTERS ]
    then
        mkvmerge --chapters $CHAPTERS -o $TEMPMKV "$1"
        mv $TEMPMKV "$1"
        #
        # ffmpeg -i inputfile.mkv -crf 18 -map 0 -acodec copy -scodec copy 
        # -c:v libx264 -threads 0 -preset veryslow outputfile.mkv
        #
        # Depending on you system this can take quite a while to complete
        ffmpeg -I "$1"  -crf 18 -map 0 -acodec copy -scodec copy -c:v libx264 -threads 0 -preset slow $TEMPMKV
        mv $TEMPMKV "$1"
        #
        #

    fi
fi

rm -rf $DIR

@Ethrex said:

  • It appears that while Plex is doing the post-processing, the ‘tuner slot’ within Plex is taken up (basically, it shows 100% in the server status until post-processing is done). I didn’t do a lot of testing around this, this was just a mental note. Of course the concern is that if both tuners are blocked on post-processing, will it block a scheduled recording?

Is this still the case? I’m working on a script for the HDHR Extend (utilize the Extend’s h264 encoding, then use comskip and mkvmerge to split the file on commercials). I assume it’ll take a little while for the script to run after each recording. If the tuner is used up during the post processing, that’d be really bad…

Are people developing a good comskip ini file? I’ve tried a few and they always cut stuff off, so I’ve pretty much given up on it

@hthighway and @ml@kg6sed.com

Thanks for posting the information. I am a noob to Linux and am trying to hack my way through what you provided, but need some clarification to keep me on the path to a successful install. I am running Plex on Ubuntu. I’ve tried the following so far:

Installed Comskip from github.com/erikkaashoek/Comskip the directions there seem to be old, but I left it has default.

I then installed _mkvpropedit _ from here: mkvtoolnix.download/downloads.html but that appears to install the whole MKVToolNix software.

Are those the right software packages?

What parameters change in your two scripts listed at the answer that I would need to change for my user’s profile on my box?
Does it matter what name for the first script? Or where to put it for Plex to access it?

Any other updates since your last post that makes it run better?

Thanks,

Rocky

Another way to do this is using the output_ffmeta=1 option in your comskip.ini

See https://github.com/erikkaashoek/Comskip/issues/32#issuecomment-149066215

Specifically… Passing the filename to a bat file AFTER you have the FFMETA output from comskip…

ffmpeg -hide_banner -report -i “%~dpn1”.ffmeta -hwaccel qsv -c:v mpeg2_qsv -f mpegts -i “%~dpn1”.ts -c:v h264_qsv -global_quality 22 -vf deinterlace_qsv -movflags +faststart -profile:v main -preset fast -level 40 -y “%~dpn1”.mp4