Rand Al Thor Wrote:Actually using myth and xbmc together has been quite a treat. The script that launches it from the home menu works perfectly and then escape brings you right back to the xbmc menu. The only thing i could wish for is that xbmc didn't leave fullscreen mode when it lost focus. it only happens for a few seconds though. Or perhaps that it opened in an "xbmc" window. Im sure all that is low on the priority list though. Next i am going to work out a script that transcodes all my myth recordings to xvid then puts them in my tv folder and scans them to the xbmc db. shouldn't bee too difficult. Cheers.
I have a script which will transcode to xvid. Currently I use it for HD recordings so it is geared towards that. I found the original script here
Xvid Script so credit goes to Steve for writing this. I made a few modifications based on my requirements. The original cut down the resolution to 960x540 which is half-HD (1920x1080) but my projector outputs 720p so I set the output resolution to 1280x720 instead, I also adjusted the target file sizes. Under 32 mins ~500mb(1/2 hour show) and between 33 and 62 ~1gb(1 hour show). More arguments could be added I suppose if you wanted to transcode movies as well but I use it for TV usually so really didn't need much more than an hour. I have also noticed that on some files once they are converted the index gets lost and you can't skip back and forth so I tried adding "-idx" to my final mencoder command but it didn't seem to work when tested so I may have to add a 3rd mencoder to fix the index separately. The script also checks to see if the file is 29 for 59 fps and adjusts it's output accordingly. I also guess this could be modified to use x264 instead of xvid but I find xvid is easier to deal with currently and actually the original xbox can more or less play these files(I have only tested a coupel and noticed minimal frame drop). Here is the script I am currently using, also this script will retain the AC3 soundtrack:
Code:
#!/bin/bash
#
#variables
overheadbytes=16
server_default=POT
#Functions
#Video Length Calculation
function VideoSizeCalc() {
audiosize=`pc $audiobitrate/1000*$totalseconds*0.1220703125/1024`
echo "Audio Size in MB = $audiosize"
totalseconds=`echo $totalseconds|sed -e 's/\.[0-9]*//'`
if [ $totalseconds -lt 1920 ]; then
totalsize=500
elif [ $totalseconds -lt 3720 ]; then
totalsize=1000
else
echo "I don't know how to handle this length!"
exit 1
fi
echo "Total Size = $totalsize"
videosize=`pc $totalsize-$audiosize` # new one since overhead doesn't
#really matter its so small
videosize=`echo `${videosize:0:3}``
echo "Videosize = $videosize MB"
}
#test for arguements
if [[ -z "@ARGV" ]]; then
echo "first arguement is the original mpg"
echo "second arguement is the new folder name, will be used for filename"
exit
else
#Reassign variables
if [[ ! -e $1 ]]; then
echo "no such input mpg!"
exit
else
original_name=$1
fi
folder_name=$2
file_name=$3
# display arguments
echo "Original mpeg is: $original_name"
echo "Folder name will be: $folder_name"
echo "File name will be: $file_name"
fi
#Grab input file information
echo "Determining total file length..."
totalseconds=`mencoder "$original_name" -ovc copy -nosound -o /dev/null -quiet 2>&1 | awk '/^Video stream:/{print $10+$10/$12}'`
echo "total seconds = $totalseconds"
audiobitrate=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=0//' | grep "ID_AUDIO_BITRATE" | sed -e 's/ID_AUDIO_BITRATE=//'`
echo "audio bitrate = $audiobitrate"
videowidth=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_WIDTH" | sed -e 's/ID_VIDEO_WIDTH=//'`
videoheight=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_HEIGHT" | sed -e 's/ID_VIDEO_HEIGHT=//'`
videofps=`mplayer -vo null -ao null -frames 0 -identify "$original_name" 2>/dev/null | grep "ID_VIDEO_FPS" | sed -e 's/ID_VIDEO_FPS=//'`
videofps=`echo `${videofps:0:2}``
echo "FPS: $videofps"
aspect=1.78
#`pc $videowidth/$videoheight`
#aspect=`echo "$aspect" | tr -s [:digit:]`
echo "Aspect Ratio: $aspect"
#Calculate Video size
VideoSizeCalc
sleep 10
videosize=`pc $videosize*1024`
echo "Videosize = $videosize"
if [[ "$videofps" -eq "59" ]]; then
nice -n 17 mencoder "$original_name" -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=1280:720 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
#
nice -n 17 mencoder "$original_name" -oac copy -ovc xvid -vf decimate=2:1000:1600:.001,scale=1280:720 -ofps 24000/1001 -xvidencopts pass=2:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $folder_name$file_name.avi
elif [[ "$videofps" -eq "29" ]]; then
nice -n 17 mencoder "$original_name" -oac copy -ovc xvid -vf pullup,softskip,scale=1280:720 -ofps 24000/1001 -xvidencopts pass=1:vhq=0:me_quality=5:turbo:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o /dev/null
#
nice -n 17 mencoder "$original_name" -oac copy -ovc xvid -vf pullup,softskip,scale=1280:720 -ofps 24000/1001 -xvidencopts pass=2:vhq=0:me_quality=5:quant_type=mpeg:aspect=$aspect:max_bframes=0:bitrate=-$videosize -o $folder_name$file_name.avi
fi
exit
For this to work you need PerlCalc. You can find it here
PerlCalc. You run the command like this:
Code:
/path/to/hrhd.sh originalfile.mpg /out/put/folder/ outputfilename
Here is how I call this from with a MythTV userscript:
Code:
/home/kevin/hrhd.sh /media/mythtv/Recordings/"%FILE%" /media/video/dlvideo/transcode/ "%FILE%"
If you wanted to remove the commercials first, you could run this after manually making sure your commercial breaks are correctly flagged using Myth's built in editor:
Code:
/usr/bin/mythtranscode -c %CHANID% -s %STARTTIME% --mpeg2 --honorcutlist; mv /media/mythtv/Recordings/"%FILE%" /media/mythtv/Recordings/"%FILE%.old"; mv /media/mythtv/Recordings/"%FILE%.tmp" /media/mythtv/Recordings/"%FILE%"; /usr/bin/mythcommflag -c %CHANID% -s %STARTTIME% --rebuild --clearcutlist
Or if you're pretty confident that mythcommflag is pretty accurate you could replace the first line of that with this:
Code:
/usr/bin/mythcommflag -c %CHANID% -s %STARTTIME% --gencutlist
This would use mythcommflag's cuts as the cutlist rather than manually doing it through myth. I prefer to verify so I don't end up with half a show where mythcommflag messed up. So if you made the output folder where you store your tv shows for XBMC this should almost work for you I think.
Feel free to comment or modify the script as I am always looking to improve it.
Thanks,
kevin