[mythtv] mythtranscode --fifoinfo on master
jam at tigger.ws
jam at tigger.ws
Sat Jan 4 06:10:37 UTC 2020
> On 3 Jan 2020, at 10:26 pm, mythtv-dev-request at mythtv.org wrote:
>
>> I have a script that I use to crop recording cutlist and transcode to
>> h264 using VAAPI acceleration via ffmpeg.? Now that I have been running
>> master, I noticed the behavior of mythtranscode --fifoinfo has changed.
>
> Does your reference just to frame-size reporting mean that in every
> other way transcoding this way still works? In particular, is cleancut
> still working? Seeing all the changes being made to the rendering
> mechanism over recent times, I'd imagined cleancut was sure to become
> broken. I'll be very pleased if it still works.
>
> (For various reasons, I'm stuck on v29 so haven't tested any of this
> myself).
Paul likewise I have a script that has not worked of late.
I was about to go exploring, but if you’d not mind sending me your script it would save me hard work
Cheers
James
As good faith i put my script here. I’m sure I started with someones efforts, but any links are long gone, so if any of this looks familiar appologies and thanks
[sandypit] /store/jam [989]% cat bin/h264cut.sh
#!/bin/bash
#Uses mythcommflag, ffmpeg, and mkvmerge to cut commercials out of h.264 encoded mpg files#
#set -x
echo -------------------------------------------------------
echo -n "recording eg 20181012 being /store/*201811012*.ts: "
read recname
echo -------------------------------------------------------
ls -lh /store/*$recname*.ts
echo -------------------------------------------------------
echo -n "Choose which file: "
read recname
echo -------------------------------------------------------
echo -n "now the name for the recording: "
read vidname
echo -------------------------------------------------------
if [[ $vidname == *\.* ]]; then
usename=$vidname
else
usename=$vidname".mp4";
fi
echo now choose the destinatin dir: $usename
echo 0=MythSeasons
echo 1=MythSeries
echo -n A D G J M P S V or \<cr\> for the prefix:
read prefix
case $prefix in
0)
dir="/store/Movies/MythSeasons";
;;
1)
dir="/store/Movies/MythSeries";
;;
[Aa])
dir="/store/Movies/MythA-C";
;;
[Dd])
dir="/store/Movies/MythD-F";
;;
[Gg])
dir="/store/Movies/MythG-I";
;;
[Jj])
dir="/store/Movies/MythJ-L";
;;
[Mm])
dir="/store/Movies/MythM-O";
;;
[Pp])
dir="/store/Movies/MythP-R";
;;
[Ss])
dir="/store/Movies/MythS-U";
;;
[Vv])
dir="/store/Movies/MythV-Z";
;;
*)
prefix=`echo $vidname | head -c 1`
case $prefix in
[0123456789])
dir="/store/Movies/Myth0-9"
;;
[ABCabc])
dir="/store/Movies/MythA-C"
;;
[DEFdef])
dir="/store/Movies/MythD-F"
;;
[GHIghi])
dir="/store/Movies/MythG-I"
;;
[JKLjkl])
dir="/store/Movies/MythJ-L"
;;
[MNOmno])
dir="/store/Movies/MythM-O"
;;
[PQRpqr])
dir="/store/Movies/MythP-R"
;;
[STUstu])
dir="/store/Movies/MythS-U"
;;
[VWXYZvwyzx])
dir="/store/Movies/MythV-Z"
;;
esac
;;
esac
echo -------------------------------------------------------
#cleanup $workdir
workdir="/store/TScut_work"
rm ${workdir}/*
echo dst:$dir/$usename
echo -------------------------------------------------------
if [ -z "`ls ${workdir}`" ]; then
mkdir -p ${workdir}
fi
if [ ! -f $recname ]; then
echo "[fatal] file doesn't exist, aborting."
exit 1
fi
DBHostName=localhost
DBUserName=mythtv
DBPassword=mythtv
DBName=mythconverg
#connect to DB
mysqlconnect="mysql -N -h$DBHostName -u$DBUserName -p$DBPassword $DBName"
export mysqlconnect
#deteremine directory and filename
RECDIR=`dirname $recname`
BASENAME=`basename $recname`
tmp=`basename $BASENAME .ts`
logfile=$workdir/${BASENAME}.log
>${logfile}
#determine chanid and starttime from recorded table
echo "select chanid from recorded where basename=\"$BASENAME\";"
chanid=`echo "select chanid from recorded where basename=\"$BASENAME\";" | $mysqlconnect`
echo "select starttime from recorded where basename=\"$BASENAME\";"
starttime=`echo "select starttime from recorded where basename=\"$BASENAME\";" | $mysqlconnect`
#determine FPS (frames per second) from db, which is used to determine the seek time to extract video clips
fps=$(echo "scale=10;`echo "select data from recordedmarkup where chanid=$chanid AND starttime='$starttime' and type=32" | $mysqlconnect` / 1000.0" | bc)
if [ -z "$chanid" ] || [ -z "$starttime" ]
then
echo "[fatal] Recording not found in MythTV database, script aborted."
exit 1
elif [ -z "$fps" ]
then
echo "[fatal] Frames per second value not found in MythTV database, script aborted."
exit 1
fi
#lets make sure we have a cutlist before we proceed
if [ -z "`mythutil -q -q --getcutlist --chanid $chanid --starttime "$starttime" | sed 's/Cutlist: $//'`" ]; then
echo "[fatal] no cutlist found"
exit 1
fi
#cutlist provides a list of frames in the format start-end,[start1-end1,....] to cut
#we swap this list so that it provides the ranges of video we want in the format
# was cut 100-200 600-700 list is now 100,200-600,700-end singe play ie 100 implies 0-100
CUTLIST=`mythutil -q -q --getcutlist --chanid $chanid --starttime "$starttime" | sed 's/Cutlist: //' | \
sed 's/-/ /g' | sed 's/^\|$/-/g' | sed 's/,/-/g'`
clipcount=0
for i in ${CUTLIST}
do
start=`echo $i | sed 's/ //g' | sed 's/^\(.*\)-.*$/\1/'`
end=`echo $i | sed 's/ //g' | sed 's/^.*-\(.*\)$/\1/'`
#if $start is empty, deal with it
if [ -z $start ]; then
#set $start to 0
start=0
if [ $start -eq $end ]; then
continue
fi
fi
#convert start into time in seconds (divide frames by frames per second)
start=$(echo "scale=8; $start / $fps" | bc -l)
#if $end is not null, we can do things
if [ -n "$end" ]; then
clipcount=$((++clipcount))
end=$(echo "scale=8; $end / $fps" | bc -l)
duration=`echo "$end - $start" | bc -l`
echo "[ffmpeg] -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss $start -t $duration ${workdir}/${tmp}_${clipcount}.mp4" &>>${logfile}
echo "[ffmpeg] -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss $start -t $duration ${workdir}/${tmp}_${clipcount}.mp4"
ffmpeg -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss $start -t $duration ${workdir}/${tmp}_${clipcount}.mp4 &>>${logfile}
#echo "file ${workdir}/${tmp}_${clipcount}.mp4"
echo "file ${workdir}/${tmp}_${clipcount}.mp4" >> ${workdir}/file
elif [ -z "$end" ]; then
clipcount=$((++clipcount))
echo "{ffmpeg} -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss ${start} ${workdir}/${tmp}_${clipcount}.mp4" &>>${logfile}
echo "{ffmpeg} -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss ${start} ${workdir}/${tmp}_${clipcount}.mp4"
ffmpeg -i ${RECDIR}/${BASENAME} -acodec copy -vcodec copy -ss ${start} ${workdir}/${tmp}_${clipcount}.mp4 &>>${logfile}
echo #"file ${workdir}/${tmp}_${clipcount}.mp4"
echo "file ${workdir}/${tmp}_${clipcount}.mp4" >> ${workdir}/file
fi
done
echo
echo "[ffmpeg] -f concat -safe 0 -i $workdir/file -c copy $dir/$usename" &>>${logfile}
echo "[ffmpeg] -f concat -safe 0 -i $workdir/file -c copy $dir/$usename"
ffmpeg -f concat -safe 0 -i $workdir/file -c copy "$dir/$usename" &>> $logfile
More information about the mythtv-dev
mailing list