Tom Metro wrote:
The 480P/480I can be displayed with the MVP and it is very fast to
just transcode the audio and leave the video as it.
OK, great. That doesn't sound too bad.
Have you had any audio sync problems with this process?
No it appears to work correctly
I do have a script that is mostly working that will figure out if
something can play on the mvp hardware and will do the minimal
transcoding needed to make it workable.
Care to share?
It is a work in progress, here is the current version, I have not
noticed any sync issues.
Right now I manually rename the file to xxx (from xxx.mpg) and then
run "makempeg2 xxx" and it appends the .mpg to the new file leaving
the old one there with no extension. After having done some testing on
it, I have not yet added the code to do the delete/rename the original,
and rename the new file back in place of the original.
Any reasonable comments are welcome, it is a rather large bash
script with a few awk's thrown in for some things, so it is some
fairly ugly code.
...redoing the audio (assuming the video is mpeg2) is really easy...
I wonder if MPEG2 is universal for all of these digital TV systems?
I believe mpeg2 is part of the ATSC standard, and I would expect that
QAM is just a modulation change and does not actually change the
underlying format ... as the tv makers won't want to have to add
an extra decoder chip.
I am using a pchdtv HD5500...
Thanks for the data point.
If I remember correctly the pchdtv HD5500 was priced over $100 for a
single tuner. (Or is that one of the models that has a digital tuner and
analog NTSC tuner that can both be used simultaneously, which could be
useful.)
The HDHomerun can be found for around $150, and provides two digital
tuners, so the "per tuner" cost is less. It's also frequently
recommended on the MythTV lists.
Ah. Yes, the HD5500 is about that and only has one digital tuner, I
don't know if you can use both tuners at the same time, I kind of though
that one could not as there is only one "tuner".
Roger
#!/bin/bash
# Written by: Roger Heflin ([EMAIL PROTECTED])
#
# script to convert a video file into a form that is playable on a
# mvpmc box, used inside of MYTHTV to convert HD signals and other
# files into forms that will work on the MVPMC box without using VLC
#
# Version 0.5 8/10/2007
#
export DEBUG=1
export srate=48000
export abitrate=192
# -vf sacle=720:480 -vf expand=576:432
if [ ! -s "$1" ] ; then
echo "$1 has 0 size"
exit 0
fi
if [ -L "$1" ] ; then
echo "$1 is a link - this program will not copy and replace properly with a
link"
exit 0
fi
if [ -f "$1" ] ; then
export TMPFILE=`/bin/mktemp`
if [ $DEBUG == 1 ] ; then
echo "Temp file is $TMPFILE"
fi
#
# sample in several places
#
mencoder -of mpeg -frames 5 -vf cropdetect -srate 48000 -ofps 30000:1001 -oac
copy -ovc raw -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000
-o /dev/null $1 2>&1 > ${TMPFILE}
mencoder -ss 5 -of mpeg -frames 5 -vf cropdetect -srate 48000 -ofps
30000:1001 -oac copy -ovc raw -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000
-o /dev/null $1 2>&1 > ${TMPFILE}.1
mencoder -ss 10 -of mpeg -frames 5 -vf cropdetect -srate 48000 -ofps
30000:1001 -oac copy -ovc raw-lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000
-o /dev/null $1 2>&1 > ${TMPFILE}.2
mencoder -ss 15 -of mpeg -frames 5 -vf cropdetect -srate 48000 -ofps
30000:1001 -oac copy -ovc raw -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000
-o /dev/null $1 2>&1 > ${TMPFILE}.3
else
echo "Usage: ${0} <videofiletoconvert>"
echo " "
exit -1
fi
export oldfile=$1
export newfile=${1}.tmp
if [ $DEBUG == 1 ] ; then
echo "Oldfile= $oldfile newfile= $newfile"
fi
#
# success: format: 0 data: 0x0 - 0x5ae43e0c
#TS file format detected.
#DEMUX OPEN, AUDIO_ID: -1, VIDEO_ID: -1, SUBTITLE_ID: -1,
#PROBING UP TO 2000000, PROG: 0
#VIDEO MPEG2(pid=49)AUDIO A52(pid=52) NO SUBS (yet)! PROGRAM N. 1
#Opened TS demuxer, audio: 2000(pid 52), video: 10000002(pid 49)...POS=564
#VIDEO: MPEG2 1920x1080 (aspect 3) 29.970 fps 65000.0 kbps (8125.0 kbyte/s)
#[V] filefmt:29 fourcc:0x10000002 size:1920x1080 fps:29.97 ftime:=0.0334
#Opening audio decoder: [liba52] AC3 decoding with liba52
#AC3: 2.0 (stereo) 48000 Hz 384.0 kbit/s
#AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
#Selected audio codec: [a52] afm:liba52 (AC3-liba52)
export vtype=`cat ${TMPFILE} | awk '$1 ~ "VIDEO:" { print $2}'`
export vbps=`cat ${TMPFILE} | awk '$1 ~ "VIDEO:" { for (i=1;i<NF;i++) if ($i ~
"kbps" ) printf("%6.0f", $(i-1))}'`
export size=`cat ${TMPFILE} | awk '$4 ~ "size:" { print $4}'`
export hsize=`echo $size | awk -F: '{split($2,parts,"x");print parts[1]}'`
export vsize=`echo $size | awk -F: '{split($2,parts,"x");print parts[2]}'`
export atype=`cat ${TMPFILE} | awk '$1 ~ "Selected" && $2 ~ "audio" { print $6
}'`
if [ "$vtype" == "[XVID]" ] ; then
export atype=$vtype
fi
if [ -z "$vsize" ] || [ -z "$hsize" ] || [ -z "$atype" ] || [ -z "$vbps" ] ||
[ -z "$atype" ] || [ -z "$vtype" ] ; then
cat ${TMPFILE}
echo "ERROR: file $1 had a empty size or video or audio decoder - or "
echo " the information was parsed incorrectly"
echo "$size is $hsize x $vsize with vtype = $vtype at $vbps bps and atype
$atype with $crop"
exit -1
fi
export crop=`grep "Crop area" ${TMPFILE}* | awk -v hsize=${hsize} -v
vsize=${vsize} 'BEGIN { cropminx=hsize;cropminy=vsize;cropmaxx=0;cropmaxy=0}
{for (i=1;i<NF;i++) { if ($i ~ "-vf") split($(i+1),crop,"[=:)]") ; if ( crop[1]
== "crop" ) { if ( crop[2] > cropmaxx ) cropmaxx=crop[2] ; if ( crop[3] >
cropmaxy ) cropmaxy=crop[3] ; if (crop[4] < cropminx ) cropminx=crop[4] ; if
(crop[5] < cropminy ) cropminy=crop[5]}}} END {
printf("crop=%d:%d:%d:%d",cropmaxx,cropmaxy,cropminx,cropminy)}'`
if [ $DEBUG == 1 ] ; then
#echo "START >>>>>>"
#cat ${TMPFILE}*
#echo "<<<<<<<END"
#grep -i CROP ${TMPFILE}*
echo "$size is $hsize x $vsize with vtype = $vtype at $vbps bps and atype
$atype with $crop"
fi
if [ ${vbps} -gt 20000 ] ; then
# ATSC is limited to about 20Mbps
export vbps=20000
fi
export abps=`expr ${vbps} \* 640 / ${hsize} \* 480 / ${vsize}`
if [ ${abps} -gt 5500 ] ; then
export abps=5500
fi
export mbps=`expr ${abps} \* 2`
echo "New Average bps = ${abps} Max bps = ${mbps}"
echo $crop
rm ${TMPFILE}*
if [ $hsize == 1920 ] && [ $vsize == 1080 ] ; then
echo "1920x1080 convertion selected"
mencoder -of mpeg -mpegopts format=dvd -srate ${srate} -ofps 30000:1001 -oac
mp3lame -ovc lavc -vf ${crop},scale=638:-3,expand=640:480,harddup -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=${abitrate}:keyint=18:vrc_buf_size=1835:vrc_maxrate=${mbps}:vbitrate=${abps}
${1} -o ${1}.mpg
elif [ $hsize == 1280 ] && [ $vsize == 720 ] ; then
echo "1280x720 conversion selected"
mencoder -of mpeg -mpegopts format=dvd -srate ${srate} -ofps 30000:1001 -oac
mp3lame -ovc lavc -vf ${crop},scale=638:-3,expand=640:480,harddup -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=${abitrate}:keyint=18:vrc_buf_size=1835:vrc_maxrate=${mbps}:vbitrate=${abps}
${1} -o ${1}.mpg
elif ( ( [ $hsize == 704 ] && [ $vsize == 480 ] ) ||
( [ $hsize == 640 ] && [ $vsize == 480 ] ) ||
( [ $hsize == 720 ] && [ $vsize == 480 ] ) ) &&
( [ "$vtype" == "MPEG1" ] || [ "$vtype" == "MPEG2" ] ) ; then
if [ "$atype" != "(mp3lib" ] ; then
echo "Audio is $atype and will not work - just transcoding the audio"
mencoder -of mpeg -mpegopts format=dvd -srate ${srate} -ofps 30000:1001
-oac mp3lame -ovc copy ${1} -o ${1}.mpg
else
echo "This movie should play on the MVPMC"
fi
elif [ $hsize == 320 ] && [ $vsize == 240 ] && [ "$vtype" == "MPEG1" ] ; then
# plays as postage stamp size
# rescale to something that will play
echo "320x240 conversion selected"
abps=`expr ${abps} / 2`
mbps=`expr ${mbps} / 2`
mencoder -of mpeg -mpegopts format=dvd -srate ${srate} -ofps 30000:1001
-oac mp3lame -ovc lavc -vf ${crop},scale=320:240,harddup -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=${abitrate}:keyint=18:vrc_buf_size=1835:vrc_maxrate=${mbps}:vbitrate=${abps}
${1} -o ${1}.mpg
elif [ $vbps -gt 10000 ] ; then
echo "This file has a bit rate of $vbps and is to high to play on MVPMC"
exit 0
elif [ "$vtype" != "MPEG1" ] && [ "$vtype" != "MPEG2" ] ; then
echo "This file is not MPEG1 or MPEG2 - transcoding"
mencoder -of mpeg -mpegopts format=dvd -srate ${srate} -ofps 30000:1001 -oac
mp3lame -ovc lavc -vf ${crop},scale=638:-3,expand=640:480,harddup -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=${abitrate}:keyint=18:vrc_buf_size=1835:vrc_maxrate=${mbps}:vbitrate=${abps}
${1} -o ${1}.mpg
exit 0
elif [ "$atype" != "(mp3lib" ] ; then
#
# there is probably an audio bps limit - I have not yet seen a failure around
it so won't
# worry about the audio bps at this time
#
echo "This file does not use mp3lib audio and will not play correctly on
audio on MVPMC (ac3 will play but be out of sync)"
exit 0
elif ( [ $hsize == 352 ] && [ $vsize == 240 ] ) ||
( [ $hsize == 480 ] && [ $vsize == 480 ] ) ||
( [ $hsize == 720 ] && [ $vsize == 480 ] ) ; then
echo "This video file is believed to work on MVPMC correctly - no changes
needed"
exit 0
else
echo "Unknown MPEG1/MPEG2 with mp3 audio $hsize x $vsize it may or may not
play correctly"
exit 0
fi
# mencoder -of mpeg -mpegopts format=dvd -srate 44100 -ofps 30000:1001 -oac
mp3lame -ovc lavc -vf cropdetect,scale=638:-3,expand=640:480,harddup -lavcopts
vcodec=mpeg2video:acodec=mp3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000
${1} -o ${1}.mpg
#mencoder -of mpeg -mpegopts format=dvd -srate 44100 -ofps 30000:1001 -oac lavc
-ovc lavc -vf harddup -lavcopts
vcodec=mpeg2video:acodec=ac3:abitrate=192:keyint=18:vrc_buf_size=1835:vrc_maxrate=5000:vbitrate=3000:aspect=4/3
-o ${1}.mpg $*
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mvpmc-users mailing list
Mvpmc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mvpmc-users
mvpmc wiki: http://mvpmc.wikispaces.com/