Archive

Posts Tagged ‘DirectShowSource()’

Opening MTS Files for Post Processing

August 18th, 2009 No comments

Many high resolution digital video cameras record their data as .MTS files, which are containers for H.264 encoded video and audio. However many video editors are not able to open these files directly for further processing. If you have a codec that can play the file in a DirectShow compatible video player you can also open it with another program such as VirtualDub. All you have to do is to install AviSynth and then paste the text below into a batch file in a directory containing MTS videos. All the files will then be made available through an .avs file as a single, virtual video. Resizing and other pre-processing through AviSynth is optional. Before executing the batch file, you should make sure that all the .mts videos are of the same resolution and frame rate.

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
 
SET COUNT=0
SET AVSFILE=video.avs
SET COMMAND=video_splice = AlignedSplice(
IF EXIST %AVSFILE% DEL %AVSFILE%
 
FOR %%a IN (*.mts) DO (
	SET /a COUNT=!COUNT! + 1
	ECHO video_!COUNT! = DirectShowSource^("%%~fa"^)
	ECHO video_!COUNT! = DirectShowSource^("%%~fa"^) >> %AVSFILE%
	IF !COUNT! NEQ 1 SET COMMAND=!COMMAND!,
	SET COMMAND=!COMMAND!video_!COUNT!
)
SET COMMAND=%COMMAND%)
ECHO %COMMAND%
ECHO %COMMAND% >> %AVSFILE%
 
ECHO ReduceBy2^(video_splice^)
ECHO ReduceBy2^(video_splice^) >> %AVSFILE%
 
START "" /MAX "VirtualDubPortable.exe" "%AVSFILE%"