2015-03-12, 16:35
OK i ask in the skin thread, but maybe you have a hint for me in which file i must look to fix this ?
./chapterimages.sh /path/to/moviefile.mkv
#!/bin/bash
#chapterimages.sh
#created by The_Dave; 4.22.15
### Choose the same of the subdirectory you want all of the screenshot images to be placed in
THUMBS="chapters"
### END EDITABLE SECTION
### The script below will create the xml file & needed chapter images for each video defined after the script call
### example: user@shell> chapterimages.sh video_file.mkv
FILE=$1
n=${FILE,,}
#directory the file exists in
nn=$(dirname $n)
#just the filename
m=$(basename "$n")
#the "base" file name with NO extension
mkf=${m%%.*}
CHAPIMGS=$nn/$THUMBS
XMLFILE=$mkf.chapter.xml
DESTFILE=$nn/$XMLFILE
### Perform checks to see if the files / directories already exist
if [ ! -d "$CHAPIMGS" ]; then
echo "The directory $CHAPIMGS was NOT found; It will be created for you";
mkdir $CHAPIMGS
fi
if [ -e "$DESTFILE" ]; then
echo "The chapter XML file $DESTFILE already exists";
echo "Please delete this file before running this command again; exiting"
exit
fi
echo "Beginning work on the chapters images & xml file for the video: $mkf"
#determine the image caputure size from the video resoltion
SIZE=`mediainfo "--Inform=Video;%Width%x%Height%" $FILE`
#get the list of chapters from the video file
CHAPSTR=`mediainfo --Output=CSV $FILE |egrep "^[0-9]{2}:[0-9]{2}:\.*"`
IFS=$'\n'
CHAPARR=( $CHAPSTR )
N=1
XML='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><chapters>'
for i in "${CHAPARR[@]}";do
#cheat to create leading zero for image file names;supports up to 999 chapters
nm=00$N
num="${nm: -3}";
echo "Chapter: $num -Image: $mkf-$num.jpg -Time,Name: $i";
ts="$( cut -d ',' -f 1 <<< "$i" )";
chapname="$( cut -d ',' -f 2- <<< "$i" )";
#change quote characters to xml friendly
chapname=${chapname//\"/"}
chapname=${chapname//\'/'}
XML="$XML<chapter mark=\"$ts\" title=\"$chapname\" title2=\"\" thumb=\"chapters/$mkf-$num.jpg\" />"
if [ -e "$CHAPIMGS/$mkf-$num.jpg" ]; then
echo "The chapter image file $mkf-$num.jpg already exists...";
echo "Please delete this image file before running this command again; exiting"
exit;
else
###Tried making 3 images every 3 seconds after the timestamp, but was not much better...
#ffmpeg -ss $ts -i $FILE -vframes 3 -t 3 -s $SIZE $CHAPIMGS/$mkf-$num-%03d.jpg >/dev/null 2>&1
ffmpeg -ss $ts -i $FILE -vframes 1 -t 1 -s $SIZE $CHAPIMGS/$mkf-$num.jpg >/dev/null 2>&1
fi
((N++))
done
XML="$XML</chapters>"
#echo $XML
### Output the $XML to a new file
echo "$XML" > "$DESTFILE"
<FullscreenVideo>
<remote>
<title>XBMC.ActivateWindow(videobookmarks)</title>
</remote>
</FullscreenVideo>
<VideoBookmarks>
<remote>
<title>Close</title>
</remote>
</VideoBookmarks>