targetTime="400"
slowForSD="1"
cd /
cd "media/My Video"
find . -type f -name "*.ts" | while read fileTS
do
file=${fileTS#*/}
fileRoot=${file%.ts}
process="0"
inuse "$file"
if [ $? == "0" ]
then
echo "xx "`date +"%d-%m %H:%M"`" In use $file"
else
if [ -f "$fileRoot.thm" ]
then
checkByte=`hexdump -n1 -s3 -e'"" 1/1 "%02x"' "$fileRoot.thm"`
if [ $checkByte == "ff" ]
then
process="1"
fi
else
process="1"
fi
if [ $process == "1" ]
then
flags=`hmt "$fileRoot.hmt" | grep -o 'Flags: .*$'`
markFile="1"
if [ "${flags/*ODEncrypted*}" == "" ]
then
echo "xx "`date +"%d-%m %H:%M"`" Encrypted $file"
markFile="0"
else
videoID=`hmt "$fileRoot.hmt" | grep -o 'Video PID:.*$'`
videoID=${videoID#Video PID}
audioID=`hmt "$fileRoot.hmt" | grep -o 'Audio PID:.*$'`
audioID=${audioID#Audio PID}
if [ $audioID == $videoID ]
then
echo "xx "`date +"%d-%m %H:%M"`" $file is audio only"
else
ffmpeg -loglevel quiet -ss "$targetTime" -i "$file" -frames 1 -pix_fmt bgra -vf vflip -s 140x78 TempThumb.bmp
if [ ! -f TempThumb.bmp ]
then
echo "xx "`date +"%d-%m %H:%M"`" $file requires slow capture"
if [ "${flags/*SD*}" == "" ] && [ $slowForSD == "1" ]
then
echo "-- "`date +"%d-%m %H:%M"`" Attempting slow capture $file"
ffmpeg -loglevel quiet -i "$file" -ss "$targetTime" -frames 1 -an -pix_fmt bgra -vf vflip -s 140x78 TempThumb.bmp
fi
else
echo "++ "`date +"%d-%m %H:%M"`" Thumbnail created $file"
fi
fi
if [ -f TempThumb.bmp ]
then
dd bs=54 skip=1 if=TempThumb.bmp of="$fileRoot.thm"
rm TempThumb.bmp
fi
if [ -f "$fileRoot.thm" ] && [ $markFile == "1" ]
then
echo -ne \\xFE | dd conv=notrunc bs=1 count=1 seek=3 of="$fileRoot.thm"
fi
fi
else
echo "-- "`date +"%d-%m %H:%M"`" Already processed $file"
fi
fi
done
As far as I know the existing WebIF thumbnail generator distinguishes generated thumbnail files from Humax standard ones by appending an extra byte. This means the difference can be read from the file properties without actually reading the file at all.2. It flags a thumbnail as processed by changing the 4th byte from FF to FE (not sure if WebIF thumbnail function flags the files in any way)
How do other DVRs (eg TOPPY) treat thumbnails on recordings. Do they use the first frame. Or could there be some sort of thumbnail flag that the recordings point to a predetermined frame on a recording. If this was so and the hummy is not detecting it.
Do mp4 files have thumbnails like embedded jpg files? On the hummy the mp4 file has no thumbnail just a greyed out icon. MP4 files converted to avi files automatically generate a more appropriate thumbnail-like .jpg file. Curious!
Yes, in which case the programme maker or broadcaster should generate an icon for it.And if you are going to create a thumbnail would it not make sense that the thumbnail would be specific for a program/series just as the prid/crid is.
Just to clarify, the .ts file is a container for the data streams (video, audio, subtitle, etc) which may themselves be encoded in a variety of formats, and then the .ts container format defines how these streams are packaged up into one file. Similar applies to other container formats (mp4, mkv, etc). The thumbnail is NOT part of this package.From what you say, and I read on threads the 'ts' container contains 4 files and the .thm file is the thumbnail.
.hmia "naked" .ts get another file added if you play it but I don't recall what it's called).
It's impossible to predict where the desirable image for the thumbnail will be, hence the Set Thumbnail feature in the Web-IFI really don't understand why they decided to use the first frame for the thumbnail.
targetTime="400"
hdTargetFallback="200"
slowForSD="1"
logActionsOnly="1"
if [ $logActionsOnly == "0" ]
then
echo " "`date +"%d-%m %H:%M"`" Running auto task"
fi
/mod/webif/lib/bin/auto
cd /
cd "media/My Video"
find . -type f -name "*.ts" | while read fileTS
do
file=${fileTS#*/}
fileRoot=${file%.ts}
process="0"
inuse "$file"
if [ $? == "0" ]
then
if [ $logActionsOnly == "0" ]
then
echo "xx "`date +"%d-%m %H:%M"`" In use $file"
fi
else
if [ -f "$fileRoot.thm" ]
then
checkByte=`hexdump -n1 -s3 -e'"" 1/1 "%02x"' "$fileRoot.thm"`
fileSize=$(stat -c '%s' "$fileRoot.thm")
if [ $checkByte == "ff" ] && [ $fileSize == "43680" ]
then
process="1"
fi
else
process="1"
fi
if [ $process == "1" ] && [ -f "$fileRoot.hmt" ]
then
flags=`hmt "$fileRoot.hmt" | grep -o 'Flags: .*$'`
markFile="1"
if [ "${flags/*ODEncrypted*}" == "" ]
then
if [ $logActionsOnly == "0" ]
then
echo "xx "`date +"%d-%m %H:%M"`" Encrypted $file"
fi
markFile="0"
else
videoID=`hmt "$fileRoot.hmt" | grep -o 'Video PID:.*$'`
videoID=${videoID#Video PID}
audioID=`hmt "$fileRoot.hmt" | grep -o 'Audio PID:.*$'`
audioID=${audioID#Audio PID}
if [ $audioID == $videoID ]
then
if [ $logActionsOnly == "0" ]
then
echo "xx "`date +"%d-%m %H:%M"`" $file is audio only"
fi
else
cat /dev/null | ffmpeg -loglevel quiet -ss "$targetTime" -i "$file" -frames 1 -pix_fmt bgra -vf vflip -s 140x78 TempThumb.bmp > /dev/null 2>&1
attemptSlowCapture="0"
if [ ! -f TempThumb.bmp ]
then
attemptSlowCapture="1"
else
picStart=`hexdump -s 54 -n 32 -v -e'"" 1/1 "%02x"' TempThumb.bmp`
if [ $picStart == "818181ff818181ff818181ff818181ff818181ff818181ff818181ff818181ff" ]
then
echo "xx "`date +"%d-%m %H:%M"`" $file thumb looks faulty"
attemptSlowCapture="1"
fi
fi
if [ $attemptSlowCapture == "1" ]
then
echo "xx "`date +"%d-%m %H:%M"`" $file requires slow capture"
if [ "${flags/*SD*}" == "" ] && [ $slowForSD == "1" ]
then
echo "-- "`date +"%d-%m %H:%M"`" Attempting slow capture $file"
cat /dev/null | ffmpeg -loglevel quiet -i "$file" -r 25 -ss "$targetTime" -frames 1 -an -pix_fmt bgra -vf vflip -s 140x78 TempThumb.bmp > /dev/null 2>&1
else
echo "-- "`date +"%d-%m %H:%M"`" Attempting HD fallback thumbnail $file"
cat /dev/null | ffmpeg -loglevel quiet -ss "$hdTargetFallback" -i "$file" -r 25 -frames 1 -an -pix_fmt bgra -vf vflip -s 140x78 TempThumb.bmp > /dev/null 2>&1
fi
else
echo "++ "`date +"%d-%m %H:%M"`" Thumbnail created $file"
fi
fi
if [ -f TempThumb.bmp ]
then
dd bs=54 skip=1 if=TempThumb.bmp of="$fileRoot.thm" > /dev/null 2>&1
rm TempThumb.bmp
fi
if [ -f "$fileRoot.thm" ] && [ $markFile == "1" ]
then
echo -ne \\xFE | dd conv=notrunc bs=1 count=1 seek=3 of="$fileRoot.thm" > /dev/null 2>&1
fi
fi
else
if [ $logActionsOnly == "0" ]
then
if [ -f "$fileRoot.hmt" ]
then
echo "-- "`date +"%d-%m %H:%M"`" Already processed $file"
else
echo "-- "`date +"%d-%m %H:%M"`" No media information for $file"
fi
fi
fi
fi
done
if [ "$1" == "STANDBY" ]
then
if [ $logActionsOnly == "0" ]
then
echo " "`date +"%d-%m %H:%M"`" Shutting down"
fi
ir STANDBY >> /dev/null
fi
This appears to make no sense...Code:if [ $checkByte == "ff" ] && [ $fileSize == "43680" ] then process="1" fi else process="1" fi