On some recent recordings, on trying to transcode to "top and tail" the recordings, mythtranscode would generate an error (232) and in the logfiles would have something like:
Code:
Deadlock detected
One buffer is full when the other is empty! Aborting
Doing a search resulted in this page
here.
So from this, I created this script:
Code:
#!/bin/bash
# to fix mythtranscode error 232 files
USAGE="Usage: `basename $0` [-v] [-h] -f filename"
VERBOSE=false
OUTPUTDEV="/dev/null"
TEST=false
ID=false
PARAMETER=" "
while getopts f:vh OPTION ; do
case "$OPTION" in
f)SOURCEFILE="$OPTARG" ;;
v)VERBOSE=true ;;
h)echo "$USAGE" ;
exit 1
;;
esac
done
#Now we have arguments and options, we now need to check
#what parameters have been passed and do we need to process them
#Very little preprocessing for input filename, should really put in some file name
#sanity checking
TEMPNAME=${SOURCEFILE%.mpg}
#Add the extensions and the temporary file name part
SOURCENAME=${TEMPNAME}.mpg
TEMPFILENAME=${TEMPNAME}.tmp.mpg
if [ "$VERBOSE" = true ] ; then
echo "SOURCEfile = $SOURCENAME"
echo "TEMPfile = $TEMPFILENAME"
fi
if [ ! -e "$SOURCENAME" ] ; then
#Check for the existence of the input file
echo "$SOURCENAME not found."
exit 1
fi
ffmpeg -i "$SOURCENAME" -acodec copy -vcodec copy "$TEMPFILENAME"
if [ $? -ne 0 ]
then
#either ran out of space or file too damaged.
echo "Demux failed!"
exit 1
fi
if [ "$VERBOSE" = true ] ; then
mv -vf "$TEMPFILENAME" "$SOURCENAME"
else
mv -f "$TEMPFILENAME" "$SOURCENAME"
fi
if [ $? -ne 0 ]
then
#check that move completed
echo "File Moved failed!"
exit 1
else
echo "Move OK"
fi
mythtranscode --mpeg2 --buildindex --allkeys --showprogress --infile "$SOURCENAME"
if [ $? -ne 0 ]
then
#check that move completed
echo "Build Index failed!"
exit 1
else
echo "Build Index OK"
fi
exit 0
The sequence I found useful is:
Remove cut points
Run the fix232 script
Edit the file, put the cut points back in
Transcode to remove the unwanted bits of the file
Transcode again, as the previous transcode does not seem to rebuild the frame index correctly.
The script is invoked by fix232.sh -f <filename> for example
/home/mythtv/bin/fix232 -f 1002_20100626190000.mpg
Script is is to be used at owners risk, no responsibility for any data loss is accepted.
Bruce S.