[mythtv-users] Encoding to h264 to save space
jedi at mishnet.org
jedi at mishnet.org
Tue Feb 19 16:04:07 UTC 2008
My original backend was an underperforming ATI based system.
It had precisely this problem. This issue went away once I
replaced it with a mac mini. Check the load on your system
and see if you aren't maxing it out. Your box might not have
enough muscle to seek through h264 in realtime.
I also have another nv 6100 based system with a similar cpu
to the old ATI underperformer. This system can also seek fine
through h264 files.
Although I have never compressed as agressively as you do.
I don't know if that could be an issue.
> I cannot get this script to work. There must be a line feed somewhere in
> my
> copy that shouldn't be.
>
> Chris, can you email it to me as an attachment?
>
>
>
> Marc
>
>
>
> From: mythtv-users-bounces at mythtv.org
> [mailto:mythtv-users-bounces at mythtv.org] On Behalf Of Chris Isip
> Sent: Monday, February 18, 2008 9:30 PM
> To: Discussion about mythtv
> Subject: [mythtv-users] Encoding to h264 to save space
>
>
>
> I am able to shrink 1 hour of video to approximately 150 MB at 200 kbit
> with
> ffmpeg using h264. Seems to work well except with seeking. I wonder if
> this is a keyframe issue. When I forward or rewind, there is distortion
> for
> a few seconds and then the video fixes itself. If I forward or rewind
> before the video is fixed, the progress bar seems to jump back. Seeking
> is
> more reliable when the distrotion is allowed to clear first. Also, I
> cannot
> jump to the very first frame of the recording. If I exit the recording
> and
> play it again, I start on the first frame. Here is a copy of my latest
> script. Single pass for now (hoping to go to 2 pass). I was wondering if
> anyone could give me any ideas as to how to fix this issue.
>
> Thanks
> Chris
>
>
> #!/bin/bash
> VIDEO_DIR=/mnt/VIDEO
>
> #subq to 7 trellis to 2 threads 2
> #need to clear the cutlist and generate it again
>
>
>
>
> function convert-to-h264 ()
> {
> #argument is file only (no path)
> #need to dereference a symlink
> inputfile=`ls -ld $VIDEO_DIR/$1 | awk -F" " '{ print $NF }'`
>
> echo "Will encode $inputfile"
> basedname=`echo $inputfile | sed 's,^\(.*/\)\?\([^/]*\),\2,'`
> vidformat=`mplayer -vo null -ao null -frames 0 -identify "$inputfile"
> 2>/dev/null | grep "ID_VIDEO_FORMAT" | sed -e 's/ID_VIDEO_FORMAT=//'`
>
>
>
> if ! [ "$vidformat" == "H264" ]; then
> /usr/bin/ffmpeg -threads 2 -i $inputfile -acodec mp3 -ac 2 -ar 44100 -ab
> 128k -s 320x240 -vcodec h264 -sameq -flags +loop -cmp +chroma -partitions
> +parti4x4+partp8x8+partb8x8 -me umh -subq 7 -trellis 2 -refs 1 -coder 0
> -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt
> 300k
> -maxrate 300k -bufsize 300k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin
> 15
> -qmax 51 -qdiff 4 -level 30 -aspect 320:240 $inputfile.avi
>
>
> mv $inputfile $inputfile.old
> mv $inputfile.avi $inputfile
>
>
> echo "Building seek table"
> mythcommflag --rebuild -f "$inputfile"
>
> echo "Clearing the cut list"
> mythcommflag --clearcutlist -f $inputfile
>
> echo "Commercial skip to cutlist"
> mythcommflag --gencutlist -f $inputfile
>
> filesize=$(wc -c $inputfile | awk '{print $1}')
> echo "Updating database"
> mysql -umythtv -pmythtv -hmymythtv mythconverg -se"UPDATE recorded SET
> cutlist=0,filesize=$filesize WHERE basename=\"$basedname\";"
> else
> echo "Already an H264"
>
> fi
> }
>
>
> CONVLIST=`mysql -umythtv -pmythtv -hmymythtv mythconverg -se"select
> basename
> from recorded where title like \"%$1%\";"`
>
> for i in ${CONVLIST[@]} ; do
> if ! test -L $VIDEO_DIR/$i ; then #its not a symnlink
> #Check if this recording is done -mmin +5
> filetoconvert=`find $VIDEO_DIR -name $i -mmin +5 | sed
> 's,^\(.*/\)\?\([^/]*\),\2,'`
> if [ -z "$filetoconvert" ]; then
> echo "$i is not finnished recording...Skipping"
> else
> echo "Moving $i to /mnt/VIDEO1"
> mv $VIDEO_DIR/$i /mnt/VIDEO1
> ln -sf /mnt/VIDEO1/$i $VIDEO_DIR/$i
> convert-to-h264 $i
> fi
> else
> echo "$i is already a symlink...Skipping"
> convert-to-h264 $i
> fi
>
>
>
>
> done
> [root at mygamepc cmisip]# cat /usr/local/bin/RECconv2.sh
> #!/bin/bash
> VIDEO_DIR=/mnt/VIDEO
>
> #subq to 7 trellis to 2 threads 2
> #need to clear the cutlist and generate it again
>
>
>
>
> function convert-to-h264 ()
> {
> #argument is file only (no path)
> #need to dereference a symlink
> inputfile=`ls -ld $VIDEO_DIR/$1 | awk -F" " '{ print $NF }'`
>
> echo "Will encode $inputfile"
> basedname=`echo $inputfile | sed 's,^\(.*/\)\?\([^/]*\),\2,'`
> vidformat=`mplayer -vo null -ao null -frames 0 -identify "$inputfile"
> 2>/dev/null | grep "ID_VIDEO_FORMAT" | sed -e 's/ID_VIDEO_FORMAT=//'`
>
>
>
> if ! [ "$vidformat" == "H264" ]; then
> /usr/bin/ffmpeg -threads 2 -i $inputfile -acodec mp3 -ac 2 -ar 44100 -ab
> 128k -s 320x240 -vcodec h264 -sameq -flags +loop -cmp +chroma -partitions
> +parti4x4+partp8x8+partb8x8 -me umh -subq 7 -trellis 2 -refs 1 -coder 0
> -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt
> 300k
> -maxrate 300k -bufsize 300k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin
> 15
> -qmax 51 -qdiff 4 -level 30 -aspect 320:240 $inputfile.avi
>
>
> mv $inputfile $inputfile.old
> mv $inputfile.avi $inputfile
>
>
> echo "Building seek table"
> mythcommflag --rebuild -f "$inputfile"
>
> echo "Clearing the cut list"
> mythcommflag --clearcutlist -f $inputfile
>
> echo "Commercial skip to cutlist"
> mythcommflag --gencutlist -f $inputfile
>
> filesize=$(wc -c $inputfile | awk '{print $1}')
> echo "Updating database"
> mysql -umythtv -pmythtv -hmymythtv mythconverg -se"UPDATE recorded SET
> cutlist=0,filesize=$filesize WHERE basename=\"$basedname\";"
> else
> echo "Already an H264"
>
> fi
> }
>
>
> CONVLIST=`mysql -umythtv -pmythtv -hmymythtv mythconverg -se"select
> basename
> from recorded where title like \"%$1%\";"`
>
> for i in ${CONVLIST[@]} ; do
> if ! test -L $VIDEO_DIR/$i ; then #its not a symnlink
> #Check if this recording is done -mmin +5
> filetoconvert=`find $VIDEO_DIR -name $i -mmin +5 | sed
> 's,^\(.*/\)\?\([^/]*\),\2,'`
> if [ -z "$filetoconvert" ]; then
> echo "$i is not finnished recording...Skipping"
> else
> echo "Moving $i to /mnt/VIDEO1"
> mv $VIDEO_DIR/$i /mnt/VIDEO1
> ln -sf /mnt/VIDEO1/$i $VIDEO_DIR/$i
> convert-to-h264 $i
> fi
> else
> echo "$i is already a symlink...Skipping"
> convert-to-h264 $i
> fi
>
>
>
>
> done
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-users
>
More information about the mythtv-users
mailing list