« Sapphire In Steel - Ruby within Visual S... | Main | Searching Google Desktop from PowerShell... »

This post will likely win the award this month for "least useful and most obscure use of two totally unrelated tools to do a task that few folks ever would need to do and fewer would be interested in reading about" but I wanted to save it for myself for reference.

I've got a bunch of old TV shows that are in MPEG2 format that were recorded with BeyondTV from SnapStream. I don't want to toss them, but they are fat and wasting space. I'd like to have them available if I wanted to watch them on my PlayStation Portable, but using PSPVideo9 is tedious for more than a few files. Also, the version of FFMPEG that comes with PSPVideo9 is really old.

You can get a binary copy of FFMPEG (as the project team releases source but not binaries) from this friendly fellow here.

FFmpeg is a collection of free software that can record, convert and stream digital audio and video. It includes libavcodec, a leading audio/video codec library. FFmpeg is developed under Linux, but it can be compiled under most operating systems, including Windows. The project was started by Gerard Lantau, an alterego of Fabrice Bellard, and is now maintained by Michael Niedermayer. Notable is that most FFmpeg developers are part of either the MPlayer, xine or VideoLAN project as well. [Wikipedia]

FFmpeg doesn't like WMV files very much, and they are compressed pretty well already. I wanted to run this ffmpeg command line...

ffmpeg -i 'oldname.*' -f mp4 -r 25 -s 320×240 -b 768 -ar 44000 -ab 112 'newname.mp4'

...on all my files that weren't WMV and convert my files to MP4 video at 320x240 and a decent bit rate.

I used PowerShell to exclude this command line, build the filenames and ran this PowerShell command (pipeline) on my folder:

dir -exclude *.wmv | foreach-object { $newname = $_.Basename + ".mp4"; ffmpeg -i "$_" -f mp4 -r 25 -s 320×240 -b 768 -ar 44000 -ab 112 $newname }

Ran for a few hours and the PlayStation Portable is now happy with my copies of old TV shows that aren't on DVD yet.

NOTE: The System.IO.FileInfo object, returned from PowerShell's 'dir', doesn't have a "BaseName" property, so I've added a custom ScriptProperty to my "My.Types.ps1xml" file:

<Types>
   <Type>
     <Name>System.IO.FileInfo</Name>
      <Members>
         <ScriptProperty>
           <Name>Basename</Name>
           <GetScriptBlock>
            $this.Name.Remove($this.Name.Length - $this.Extension.Length);
           </GetScriptBlock>
         </ScriptProperty>
      </Members>
   </Type>
</Types>

As outlined in this post called "BaseName for FileInfo objects" on the PowerShell team blog.

Tracked by:
"interesting things to do in windows powershell" (Tiernans Comms Closet) [Trackback]
"Power to the PowerShell" (Impersonation Failure) [Trackback]


Sunday, July 02, 2006 5:32:19 AM (Pacific Standard Time, UTC-08:00)
I use the Videora iPod converter for converting videos. It has the ability to que up videos for conversion.
http://www.videora.com/en-us/Converter/iPod/
Sunday, July 02, 2006 10:09:17 AM (Pacific Standard Time, UTC-08:00)
Ya, I tried that, but Videora's trial had expired. ;)
Scott Hanselman
Comments are closed.

Contact

Sponsors

Hosting By

Hot Topics

Tags

Calendar

<November 2009>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

November, 2009 (5)
October, 2009 (19)
September, 2009 (11)
August, 2009 (12)
July, 2009 (21)
June, 2009 (26)
May, 2009 (16)
April, 2009 (13)
March, 2009 (17)
February, 2009 (17)
January, 2009 (18)
December, 2008 (32)
November, 2008 (17)
October, 2008 (22)
September, 2008 (16)
August, 2008 (14)
July, 2008 (25)
June, 2008 (19)
May, 2008 (17)
April, 2008 (17)
March, 2008 (26)
February, 2008 (21)
January, 2008 (28)
December, 2007 (19)
November, 2007 (17)
October, 2007 (31)
September, 2007 (39)
August, 2007 (37)
July, 2007 (43)
June, 2007 (37)
May, 2007 (32)
April, 2007 (38)
March, 2007 (29)
February, 2007 (46)
January, 2007 (31)
December, 2006 (27)
November, 2006 (31)
October, 2006 (32)
September, 2006 (39)
August, 2006 (34)
July, 2006 (40)
June, 2006 (18)
May, 2006 (31)
April, 2006 (34)
March, 2006 (30)
February, 2006 (38)
January, 2006 (44)
December, 2005 (19)
November, 2005 (34)
October, 2005 (24)
September, 2005 (37)
August, 2005 (20)
July, 2005 (24)
June, 2005 (33)
May, 2005 (16)
April, 2005 (22)
March, 2005 (34)
February, 2005 (15)
January, 2005 (37)
December, 2004 (28)
November, 2004 (30)
October, 2004 (34)
September, 2004 (22)
August, 2004 (34)
July, 2004 (18)
June, 2004 (64)
May, 2004 (49)
April, 2004 (21)
March, 2004 (29)
February, 2004 (29)
January, 2004 (36)
December, 2003 (25)
November, 2003 (24)
October, 2003 (59)
September, 2003 (42)
August, 2003 (24)
July, 2003 (44)
June, 2003 (29)
May, 2003 (21)
April, 2003 (30)
March, 2003 (27)
February, 2003 (47)
January, 2003 (50)
December, 2002 (31)
November, 2002 (38)
October, 2002 (44)
September, 2002 (15)
May, 2002 (2)
April, 2002 (4)

Google Ads