[mythtv-users] 4:3cco MPEG2->MPEG2 transcoding
Eric Pheatt
eric.pheatt at gmail.com
Fri Dec 7 21:35:31 UTC 2007
On Dec 7, 2007 12:52 PM, Rod Smith <mythtv at rodsbooks.com> wrote:
> On Friday 07 December 2007 03:36:48 Darren Hart wrote:
> > Is it possible to have mythtv automatically crop all my 4:3 content as it
> > is being recorded and transcode it into a 16:9 stream? I use PVRx50 cards
> > and my frontend is a media mvp, so the resulting stream must still be
> > mpeg2.
>
> AFAIK, MythTV doesn't support this option directly; however, you can call an
> external transcoding script. Both ffmpeg and mencoder support cropping
> videos, so you could write a script that does the job and then call it after
> your show is recorded.
>
Here is a sample from a script I have as a user job for cropping 4:3
content broadcast with black pillar/letter box in 16:9 at 720p or
1080i with ffmpeg. The resulting mpeg cannot be burned directly to DVD
since the resulting dimensions are not exactly valid, but if you add
in the appropriate "fill" args then it should work YMMV.
#!/bin/bash
VFILE="${1}"
VTITLE="${2}"
IDENTIFY=`mplayer -identify -frames 60 -vo null -ao null\
"/myth/tv/${VFILE}" 2>/dev/null | grep ^ID_`
eval "$IDENTIFY";
echo "ID_VIDEO_WIDTH=$ID_VIDEO_WIDTH"
echo "ID_VIDEO_HEIGHT=$ID_VIDEO_HEIGHT"
if [ "${ID_VIDEO_WIDTH}" -eq 1920 ]; then
echo "1080i crop"
rm -f "/myth/tv/${VFILE}.tmp.mpg"
nice ffmpeg -i "/myth/tv/${VFILE}.ts" -cropleft 240 -cropright 240\
-target ntsc-dvd -acodec copy -s 640x480 -aspect 4:3\
"/myth/tv/${VFILE}.tmp.mpg"
elif [ "${ID_VIDEO_WIDTH}" -eq 1280 ]; then
if [ "${VTITLE}" == "Stargate" ]; then
echo "720p Stargate crop"
rm -f "/myth/tv/${VFILE}.tmp.mpg"
nice ffmpeg -i "/myth/tv/${VFILE}.ts" -cropleft 160
-cropright 160\
-croptop 90 -cropbottom 80 -target ntsc-dvd\
-acodec copy -s 640x366 -aspect 16:9\
"/myth/tv/${VFILE}.tmp.mpg"
else
echo "720p crop"
rm -f "/myth/tv/${VFILE}.tmp.mpg"
nice ffmpeg -i "/myth/tv/${VFILE}.ts" -cropleft 160
-cropright 160\
-target ntsc-dvd -acodec copy -s 640x480 -aspect 4:3\
"/myth/tv/${VFILE}.tmp.mpg"
fi
fi
FILESIZE=$(stat -c%s "/myth/tv/${VFILE}.tmp.mpg")
echo "filesize = $FILESIZE"
mysql -hmythtv -Dmythconverg\
-e "UPDATE recorded SET filesize = '$FILESIZE' WHERE basename
= '${VFILE}'"
cp -f "/myth/tv/${VFILE}.tmp.mpg" "/myth/tv/${VFILE}"\
&& rm -f "/myth/tv/${VFILE}.ts" "/myth/tv/${VFILE}.tmp.mpg"
fi
/usr/local/bin/mythrename.pl --live --link /myth/pretty --format
'\%T/\%S %- %Y-%m-%d, %g-%i %A'
exit 0
More information about the mythtv-users
mailing list