SageTV Community  

Go Back   SageTV Community > General Discussion > General Discussion
Forum Rules FAQs Community Downloads Today's Posts Search

Notices

General Discussion General discussion about SageTV and related companies, products, and technologies.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-18-2003, 10:47 PM
ku71 ku71 is offline
Sage Advanced User
 
Join Date: Apr 2003
Location: Kirkland (WA)
Posts: 76
Windows Media batch conversion recipe

What you need:
- free windows media encoder from http://www.microsoft.com/windowsmedia
- A batch file (below)

What it does:
it converts either a single file or an entire directory of files to WM9 format. File size decreases to about 35% of the original file size while maintaining the original resolution and quality (*)

open notepad and save this as convvideo.cmd

usage:
convvideo CONVERT <file>
convvideo CONVERTALL <directory>

Note: WM encoder relies on directshow filters for splitting the file and decoding mpeg2 video and audio. If you are getting an open error, your DS filters are not compatible with WM. I have had good results with the free elecard decoder.

Note2: I have had various problems with two pass encoding modes. This is caused by the decoder not producing the same results for the first and second passes. The batch file thus uses single pass modes for both audio and video. You may want to try changing
set VIDEO=%V_QUALITY%
to
set VIDEO=%V_BITRATE%
since this results in slighty smaller files. If it does not work, revert to the original setting.

Code:
@echo off
rem change this to the directory containing the files to convert
set VIDEODIR=d:\Video\Conversion\In

if "%1" == "" goto Default
if "%1" == "CONVERT" goto ConvertSingle
if "%1" == "CONVERTALL" goto ConvertAll
if exist %1% goto DispatchConvertSingle
goto End

:DispatchConvertSingle
call %0 CONVERT %1
goto End

:Default
call ConvVideo CONVERTALL %VIDEODIR%
goto End

:ConvertAll
for %%i in (%~d2%~p2%~n2\*.mpg) do call %0 CONVERT %%i
goto End

:ConvertSingle
if "%2" == "" goto End
if not exist %2 goto End
if "%3" == "" goto DefaultQuality
set Quality=%3
goto ConvertResume
:DefaultQuality
set Quality=80
:ConvertResume

set ENCODER="%SystemDrive%\program files\windows media components\encoder\wmcmd.vbs"
rem set PLAYER="%SystemDrive%\Program Files\Windows Media Player\wmplayer.exe" 
rem set PLAYER=d:\Programme\Tools\DVD\Graphedit\GRAPHEDT.EXE

set INPUT=%2
set OUTPUT=%~d2%~p2%~n2.wmv
rem set LOG=%~d2%~p2%~n2.log

set SIZE640=-v_width 640 -v_height 480  
set SIZE480=-v_width 480 -v_height 360
set SIZE400=-v_width 400 -v_height 300
set SIZE320=-v_width 320 -v_height 240
set SIZE=-v_preproc 1 

set A_QUALIY=-a_mode 2 -a_setting Q50_44_2 
set A_BITRATE=-a_mode 3 -a_setting 96_44_2
set A_CBR=-a_mode 0 -a_setting 128_48_2
set AUDIO=%A_CBR%

set V_QUALITY=-v_mode 2 -v_quality %Quality%
set V_BITRATE=-v_mode 3 -v_bitrate 1000000
set VIDEO=%V_QUALITY%

if exist %OUTPUT% goto Exists

rem start %PLAYER% %2
rem sleep 3

@echo on
start /low /wait cscript.exe %ENCODER% -input %INPUT% -output %OUTPUT% %SIZE% %VIDEO% %AUDIO%
@echo off
rem kill graphedit.exe
goto End

:Exists
@echo File '%OUTPUT%' exists, aborting.
goto end

:End
@echo Done!
(*) YMMV

Last edited by ku71; 06-23-2003 at 03:14 PM.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

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

Forum Jump


All times are GMT -6. The time now is 08:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.