2005-06-27, 22:35
(kruuth @ june 27 2005,19:31 Wrote:oh, is there a way to go back and have it transcode all the ones i already have?hmm.. figured out that thumbs cannot be created from mp4 files.. so a small refinement to my original script (wget to initiate thumbs)..
Quote:#!/bin/bash
videodir=/mnt/disk3/video/tv/
echo -e "\n\n===============================" >>/tmp/mythtranscode.out
echo "mythtranscode $*" >>/tmp/mythtranscode.out
sql () {
mysql -u root mythconverg -e "$*" >>/tmp/mythtranscode.out 2>&1
echo "$*" >>/tmp/mythtranscode.out
}
partfile=`echo $6|tr -cd "1234567890"`
channel=`echo $4`
starttime=`echo $6|tr "t" " "`
echo "partfile=$partfile" >>/tmp/mythtranscode.out
cd $videodir
name="`ls $channel\_$partfile*.nuv`"
echo "name: $name" >>/tmp/mythtranscode.out
sql "update jobqueue set status=4 where chanid=$channel and starttime='$starttime'"
nice -n +20 mencoder $name -ovc xvid -oac mp3lame -lameopts br=128 \
-vf scale=480:480 -o $name.tmp -xvidencopts bitrate=1000\
>/tmp/mencoder.out 2>>/tmp/mythtranscode.out
if [ $? -eq 0 ]; then
if [ ! -f $name.tmp ]; then
sql "update jobqueue set status=8 where chanid=$channel and starttime='$starttime'"
echo "failed!" >>/tmp/mythtranscode.out
return 99
else
sql "update jobqueue set status=5 where chanid=$channel and starttime='$starttime'"
echo "success!" >>/tmp/mythtranscode.out
# load the page to initiate building thumbs from mpg instead of mp4
wget http://localhost/mythweb/recorded_programs.php -o /dev/null
sleep 5
# mythtv takes care of removing the mpg and replacing the converted mp4
return 0
fi
else
# mythtv takes care of removing the mpg and replacing the converted mp4 but converting failed...
rm -rf $name.tmp
sql "update jobqueue set status=8 where chanid=$channel and starttime='$starttime'"
echo "failed!" >>/tmp/mythtranscode.out
return 99
fi
and it is possible to re-transcode original recordings.. but you'll have to do it in mysql. the ready for transcoding status is 1 if i remember correctly.
Quote:enum jobstatus {
job_queued = 0x0001, job_pending = 0x0002, job_starting = 0x0003, job_running = 0x0004,
job_stopping = 0x0005, job_paused = 0x0006, job_retry = 0x0007, job_erroring = 0x0008,
job_aborting = 0x0009, job_done = 0x0100, job_finished = 0x0110, job_aborted = 0x0120,
job_errored = 0x0130, job_unknown = 0x0000
}
to re-encode a file, do this:
Quote:[root@server01 tmp]# mysql -u root mythconverg
reading table information for completion of table and column names
you can turn off this feature to get a quicker startup with -a
welcome to the mysql monitor. commands end with; or \g.
your mysql connection id is 1180 to server version: 3.23.58
type 'help;' or '\h' for help. type '\c' to clear the buffer.
mysql> select * from jobqueue
->;
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
| id | chanid | starttime | inserttime | type | cmds | flags | status | statustime | hostname | args | comment |
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
| 209 | 1 | 2005-06-25 22:04:00 | 2005-06-25 23:43:01 | 1 | 0 | 0 | 272 | 20050626054342 | server01 | | |
| 212 | 9 | 2005-06-27 19:28:00 | 2005-06-27 20:03:00 | 1 | 0 | 0 | 272 | 20050627214938 | server01 | | |
| 213 | 8 | 2005-06-27 19:49:00 | 2005-06-27 20:33:01 | 1 | 0 | 0 | 4 | 20050627215019 | server01 | | |
| 107 | 9 | 2005-06-01 19:34:00 | 2005-06-01 20:06:02 | 2 | 4 | 0 | 5 | 20050601221721 | server01 | | finished, 0 break(s) found. |
| 181 | 9 | 2005-06-20 19:28:00 | 2005-06-20 20:00:04 | 1 | 0 | 0 | 8 | 20050620230920 | server01 | | |
| 102 | 1 | 2005-06-01 17:59:00 | 2005-06-01 18:01:00 | 1 | 4 | 0 | 4 | 20050601190217 | server01 | | |
| 98 | 3 | 2005-06-01 17:01:00 | 2005-06-01 17:08:00 | 1 | 4 | 0 | 5 | 20050601173409 | server01 | | |
| 59 | 3 | 2005-05-25 12:43:00 | 2005-05-25 12:46:00 | 1 | 4 | 0 | 9 | 20050525125056 | server01 | | |
| 109 | 8 | 2005-06-01 19:49:00 | 2005-06-01 20:31:01 | 2 | 4 | 0 | 5 | 20050601224617 | server01 | | finished, 2 break(s) found. |
| 210 | 9 | 2005-06-26 23:04:00 | 2005-06-27 00:03:01 | 1 | 0 | 0 | 272 | 20050627030605 | server01 | | |
| 211 | 4 | 2005-06-27 17:04:00 | 2005-06-27 17:33:01 | 1 | 0 | 0 | 272 | 20050627185316 | server01 | | |
| 208 | 8 | 2005-06-25 19:00:00 | 2005-06-25 19:38:01 | 1 | 0 | 0 | 272 | 20050626001611 | server01 | | |
| 206 | 6 | 2005-06-25 16:24:00 | 2005-06-25 16:58:01 | 1 | 0 | 0 | 272 | 20050625184611 | server01 | | |
| 207 | 8 | 2005-06-25 17:59:00 | 2005-06-25 19:00:04 | 1 | 0 | 0 | 272 | 20050625221726 | server01 | | |
+-----+--------+---------------------+---------------------+------+------+-------+--------
+----------------+----------+------+-----------------------------+
14 rows in set (0.00 sec)
mysql> update jobqueue set type=1 where id=207;
the file 8_20050625175900_20050625190000.nuv will be re-encoded. because "2005-06-25 17:59:00" = "20050625175900" and the channel is 8 (second collumn, after id).