openSUSE Forums > Archives > SF Archives > ARCHIVES - Tips, Tricks & Tweaks » Howto: Removing Commercials From Mpg And Converting To Xvid

Go Back   openSUSE Forums > Archives > SF Archives > ARCHIVES - Tips, Tricks & Tweaks
Forums FAQ Members List Search Today's Posts Mark Forums Read


ARCHIVES - Tips, Tricks & Tweaks Tips and Solutions for SUSE Linux
(Please do not post questions here)

 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 17-Nov-2007, 08:34
famewolf
Guest
 
Posts: n/a
Default

I have a replaytv which records alot of tv shows for me..I can use a program called dvarchive (java based so runs on all platforms) to download the shows to the pc but their huge (low quality is 1GB per hour, medium is 2GB per hour and High is 3GB per hour...I usually use medium (resolution is 720x480)). This process however would work the same if you recorded a tv show using a tuner in your pc to mpg.

Recently oldcpu pointed me to a kde program called dvbcut.....It makes removing commercials from a mpg pretty easy...scroll through the show...mark the beginning and end of the commercials (it has two sliders...one moves pretty fast..the other is for fine tuning) and it generates a new mpg with no commercials.

I then wanted to convert the mpg to xvid so it would take up alot less space..I also wanted to resize it to a normal 640x480 size....I wrote a simple shell script (only 3 lines) to use transcode to convert the mpg to xvid..

Code:
filein=$1
fileout=${filein%.*}

transcode -i "$filein" -o "$fileout".avi -Z 640x480 -f23 -y xvid -C3
The -Z tells it to resize...the -f tells it to use a framerate of 23 frames per second (This is used for film) and the -C3 tells it to do deinterlacing and resizing tweaks. The end result is a nice xvid to backup or copy to the laptop for later viewing. The removing of commercials is optional but really doesn't take that long to do.

  #2 (permalink)  
Old 17-Nov-2007, 21:55
famewolf
Guest
 
Posts: n/a
Default

Here is an alternative to my last method..this method is completely automated via a shell script....it uses a windows program called "comskip.exe" available from http://www.kaashoek.com/comskip/ (Copy comskip.exe and comskip.ini to the windows dir in wine and edit the ini file so outputedl=1) to mark the commercials and then uses mencoder in copy mode to remove the commercials. Lastly transcode is used to build an xvid of the show. The I5 is doing deinterlacing since I'm using a raw mpg from a tvshow...the -Z is resizing the xvid since a replaytv records in 720x480 by default. The comskip program is VERY impressive and uses multiple technique's to identify commercials from black frames to watching for logo's...monitoring closed captioning etc....On my tests other than a quick flash announcing the tv station at the beginning of the show which lasted about 5 seconds, it removed all commercials and junk.

I did try using mencoder to also process the mpg to xvid at the same time as removing the commercials but was getting better results from transcode and it was easier to set the options I wanted.

Code:
filein=$1
fileout=${filein%.*}
fileclean="$fileout"_clean.mpg
wine comskip.exe "$filein"
mencoder "$filein" -edl "$fileout".edl**-oac copy -ovc copy -of mpeg -o "$fileclean"
transcode -w 800 -i "$fileclean" -o "$fileout".avi -Z 640x480 -f23 -y xvid -I5
If you wanted to do cleanup afterward you could easily add the following:
Code:
mv "$fileout".avi /some/tvshow/dir
rm "$fileout".*
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2