Author |
Message |
uzik
|
Posted: Tue Nov 14, 2006 8:56 pm |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
I just finished a shell script extracts the video editor cutlist (NOT the commercials from the commercial detector) and removes the cut areas from the exported video. It requires only the basics installed with MythTV (mysql, mencoder, and standard shell functions such as echo and sed). This script uses the x264 codec to produce high quality mpeg4 AVI format files.
http://www.reddawn.net/~jsprenkl
I have been unable to get R5D1 to do this correctly so I wrote my own.
Last edited by uzik on Sat Aug 25, 2007 7:25 am, edited 1 time in total.
|
|
Top |
|
|
spalVl
|
Posted: Tue Nov 14, 2006 9:01 pm |
|
Joined: Mon Aug 29, 2005 4:04 pm
Posts: 729
Location:
Philadelphia, PA US
|
Nice
|
|
Top |
|
|
uzik
|
Posted: Wed Nov 15, 2006 10:13 pm |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
You're welcome. I'll post the other version I'm playing with that
does lower quality and much smaller encode time, and somewhat
smaller file sizes. It just involves changing mencoder parameters.
I may also post notes on how to make it take the commercials out,
it's fairly simple at this point
|
|
Top |
|
|
cesman
|
Posted: Fri Nov 17, 2006 5:48 pm |
|
Joined: Fri Sep 19, 2003 7:05 pm
Posts: 5088
Location:
Fontana, Ca
|
You should note on your site that you are using KnoppMyth. The <alt><s> isn't something that is standard w/ MythTV. If is a shortcut key in Fluxbox that I've configured. Other people that don't use KnoppMyth may find your script handy!
_________________ cesman
When the source is open, the possibilities are endless!
|
|
Top |
|
|
uzik
|
Posted: Sat Nov 18, 2006 9:21 am |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
Good idea. I also forgot to note they should make the file
executable with chmod. I've updated the page.
|
|
Top |
|
|
lopey
|
Posted: Sun Feb 11, 2007 8:27 pm |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
I just tried running this, and the status said it's completed, but I don't see anything in my /myth/video directory. Is there something I'm missing from your website?
BTW, thanks for the effort. I've been waiting for a more automated way of doing this, and if I can get this to work it'll be a godsend!
|
|
Top |
|
|
uzik
|
Posted: Sun Feb 11, 2007 9:31 pm |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
Hi lopey,
Another user that emailed me noted the first version had a permissions
problem with mysql. I updated the script to use the root
account. This works on my setup and will hopefully on others.
If you haven't gotten the script recently you might have the
old version.
The output directory used is set on line 31 of the script.
If you open it with a text editor you can set it as desired. It's
currently set to /myth/video. If that's correct for your
system you might try running it with debugging turned on:
Goto the setup and change the command line that starts the script.
Instead of:
/usr/bin/to264 "%FILE%" "%TITLE% - %SUBTITLE%"
enter this:
sh -x /usr/bin/to264 "%FILE%" "%TITLE% - %SUBTITLE%" >/tmp/debug1.txt 2>/tmp/debug2.txt
This will run the script with full verbose output of what
it's doing. Run the script and send the output files to me.
They'll be in the /tmp directory and will be named
debug1.txt and debug2.txt.
|
|
Top |
|
|
lopey
|
Posted: Sun Feb 11, 2007 9:47 pm |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
Thanks for the help, I just ran it in debug mode, and here is what I got
Code: # cat /tmp/debug1.txt MEncoder 1.0pre6-3.3.5 (C) 2000-2004 MPlayer Team CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Stepping: 6) Detected cache-line size is 32 bytes CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0 Compiled with runtime CPU detection - WARNING - this is not optimal! To get best performance, recompile MPlayer with --disable-runtime-cpudetection. MEncoder 1.0pre6-3.3.5 (C) 2000-2004 MPlayer Team CPU: Intel Celeron 2/Pentium III Coppermine,Geyserville (Family: 6, Stepping: 6) Detected cache-line size is 32 bytes CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 0 Compiled with runtime CPU detection - WARNING - this is not optimal! To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
Code: # cat /tmp/debug2.txt+ MYSQL=/usr/bin/mysql+ NICE='/usr/bin/nice -n10'+ MENCODER='/usr/bin/nice -n10 /usr/bin/mencoder'+ SED=/bin/sed+ ECHO=/bin/echo + REC_DIR=/myth/tv+ OUT_DIR=/myth/video+ TMPFILE=/tmp/to264-5501+ cat++ /bin/echo 'Mama'\''s' Family - Amateur Night++ /bin/sed -f /tmp/to264-5501.sed+ OUT_FILE='Mama'\''s Family - Amateur Night'+ unlink /tmp/to264-5501.sed+ OUT_FILE='/myth/video/Mama'\''s Family - Amateur Night.avi'+ cd /tmp+ cat sed -e 's@|INPUT|@1069_20070210173400.mpg@' -e 's@|OUTPUTFILE|@/tmp/to264-5501.edl@'+ /usr/bin/mysql -u root mythconverg -s -B+ unlink frameno.avi+ DEINT='-yadif=3 -mcdeint'+ AUDIO='-oac mp3lame -lameopts abr:br=128'+ EDL='-edl /tmp/to264-5501.edl'+ /usr/bin/nice -n10 /usr/bin/mencoder /myth/tv/1069_20070210173400.mpg -oac mp3lame -lameopts abr:br=128 -ovc x264 -x264encopts turbo=1:subq=1:frameref=1:bframes=2:pass=1 -aspect 4:3 -edl /tmp/to264-5501.edl -o /dev/nullFile not found: 'frameno.avi'Failed to open frameno.avix264encopts is not an MEncoder optionExiting... (error parsing cmdline) + /usr/bin/nice -n10 /usr/bin/mencoder /myth/tv/1069_20070210173400.mpg -oac mp3lame -lameopts abr:br=128 -ovc x264 -x264encopts bitrate=1800:subq=4:8x8dct:me=2:frameref=3:bframes=2:b_pyramid:weight_b:pass=2 -aspect 4:3 -edl /tmp/to264-5501.edl -o '/myth/video/Mama'\''s Family - Amateur Night.avi'File not found: 'frameno.avi'Failed to open frameno.avix264encopts is not an MEncoder optionExiting... (error parsing cmdline)+ unlink divx2pass.log+ unlink /tmp/to264-5501.edl
EDIT: Trying to get code output to work right
|
|
Top |
|
|
lopey
|
Posted: Sun Feb 11, 2007 9:51 pm |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
BTW, I'm using knoppmyth R5C7
|
|
Top |
|
|
uzik
|
Posted: Sun Feb 11, 2007 11:16 pm |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
Ah ha.
Code: /usr/bin/mencoder /myth/tv/1069_20070210173400.mpg -oac mp3lame -lameopts abr:br=128 -ovc x264 -x264encopts turbo=1:subq=1:frameref=1:bframes=2:pass=1 -aspect 4:3 -edl /tmp/to264-5501.edl -o /dev/nullFile not found: 'frameno.avi' Failed to open frameno.avi x264encopts is not an MEncoder optionExiting... (error parsing cmdline) The frameno.avi error we can disregard. It looks like you have a different version of mencoder than I do, and the encoding options have changed between versions. The current script has this on line 108: Code: $MENCODER $REC_DIR/$1 $AUDIO -ovc x264 -x264encopts turbo=1:subq=1:frameref=1:bframes=2:pass=1 -aspect 4:3 $EDL -quiet -o "/dev/null" Change it to this: Code: $MENCODER $REC_DIR/$1 $AUDIO -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vqmin=2:vbitrate=2000:vpass=1:aspect=4/3 $EDL -quiet -o "/dev/null" Change line 110 to this: Code: $MENCODER $REC_DIR/$1 $AUDIO -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vqmin=2:vbitrate=2000:vpass=2:aspect=4/3 $EDL -quiet -o "$OUT_FILE"
and see if that works. It took a lot of digging through the documentation for mencoder to find the options it accepted so I'm not 100% certain it will work with your version. It won't still be x264 video, but you should be able to play it and it should have pretty good quality.
|
|
Top |
|
|
lopey
|
Posted: Sun Feb 11, 2007 11:36 pm |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
uzik,
Thanks for helping me here, hopefully this will prove useful for other people trying to use your killer script.
Anyway, I was wondering if I could simply update mencoder and mplayer in order to use your script. I would prefer it that way without having to modify your hard work.
Right now I'm using MEncoder 1.0pre6-3.3.5, what version are you using, and how did you get it?
|
|
Top |
|
|
uzik
|
Posted: Mon Feb 12, 2007 7:38 am |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
My mencoder version is:
MEncoder 1.0pre8-3.3.5 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) XP 2000+ (Family: 6, Model: 8, Stepping: 1)
It was installed with Knoppmyth R5D1.
You could certainly upgrade your mencoder, though I think
editing two lines of text in my script is much safer and easier
than a software upgrade. I've had bad experiences upgrading
software. You can either end up with it being just as broken,
or even more broken, after all the effort (or just getting a
different set of bugs). If your box works well otherwise I wouldn't
do it. The reason I ended up writing this script was
because updating to the latest version broke ffmpeg between
R5C7 and R5D1. After the 'patch' didn't work I wrote my own
replacement.
|
|
Top |
|
|
lopey
|
Posted: Tue Feb 13, 2007 12:32 pm |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
Sorry for the delay in response, I got caught up in work yesterday. Anyway, I made the changes you proposed to your script, but now I'm getting
Code: /usr/bin/nice -n10 /usr/bin/mencoder /myth/tv/1003_20070212200000.mpg -oac mp3lame -lameopts abr:br=128 -ovc lavc -lavcopts vcodec=mpeg4:vhq:v4mv:vqmin=2:vbitrate=2000: vpass=1:aspect=4/3 -edl /tmp/to264-12408.edl -quiet -o /dev/null File not found: 'frameno.avi' Failed to open frameno.avi edl is not an MEncoder option
So it seems that I can't use edl, and by the way. When looking at the edl file, it is empty after running the script. Is that right?
|
|
Top |
|
|
uzik
|
Posted: Tue Feb 13, 2007 10:10 pm |
|
Joined: Tue Apr 19, 2005 10:30 am
Posts: 50
|
The edl file is generated by reading the database and building a list
of cut points. You put in the cut points by editing the recording (hit 'e' while
watching the recording). If you didn't edit out the commercials the edl file
will be empty.
I can't really debug it without getting access to a C7 box.
If you email me directly I could send you some other scripts
to try out without generating alot of chatter here.
jsprenkl@reddawn.net
|
|
Top |
|
|
lopey
|
Posted: Wed Feb 14, 2007 8:44 am |
|
Joined: Sat Oct 14, 2006 8:25 am
Posts: 14
|
Thanks uzik,
I agree, I don't want to kill this thread because of support for my older knoppmyth installation. I'll contact you off the list, but right now I'm going to seriously consider upgrading to the next version of Knoppmyth. Thanks so much for helping me out, and I hope others find the usefulness of this script as well.
|
|
Top |
|
|