MPlayer
|
MPlayer는 다양한 코덱과 파일포맷을 지원하는 동영상 재생기입니다. MPEG-1/2/4, DivX 3/4/5, Windows Media 7/8/9, Quicktime 5/6, Vivo 1/2등을 지원하고, RealAudio/Video도 9까지 지원합니다. MMX/SSE(2)/3Dnow(Ex)로 최적화된 자체 오디오/비디오 코덱을 내장하고 있지만, !XAnim이나 !RealPlayer의 바이너리 코덱 플러그인, Win32의 코덱 DLL도 사용 가능합니다. 기본적인 VCD/DVD 재생, DVD 자막, 뿐만 아니라 텍스트 기반의 자막 포맷도 다수 지원됩니다. mencoder라는 프로그램을 통해 raw/divx/mpeg4 AVI(pcm/mp3 audio)형식으로 변환기능을 제공하며, V4L 장치에서의 비디오 캡쳐도 지원합니다. (http://freshmeat.net 의 소개 인용)
한글 자막 ¶한글 자막을 제대로 보기 위해서는 인코딩과 글꼴을 설정해주어야 한다. 자막 파일 subtitle.smi가 CP949 인코딩이고 나눔고딕 글꼴로 자막을 보려고 한다면:
mplayer video.avi -fontconfig -subcp cp949 "Nanum Gothic" -sub subtitle.smi 자막 위치 조정 ¶WIDTH=`mplayer -vo null -ao null -identify -endpos 0 "$1" | grep ID_VIDEO_WIDTH | sed -e "s/^.*=//g"`; HEIGHT=`expr $WIDTH \* 9 / 16` mplayer -vf expand=-1:$HEIGHT "$1"
<?php
if($_SERVER['argc'] < 2) {
echo "mplaysmi moviefile\n";
exit;
}
if(!file_exists($_SERVER['argv'][1])) {
echo '"'.$_SERVER['argv'][1]."\" file not found\n";
exit;
}
$moviefile = $_SERVER['argv'][1];
while(true) {
preg_replace_callback('/^ID_VIDEO_(WIDTH|HEIGHT)=(\d+)/m', 'size_callback', shell_exec('mplayer -vo null -ao null -identify -endpos 0 "'.$moviefile.'" | grep "^ID_VIDEO_"'));
$theight = ceil($width * 9 / 16);
if($height >= $theight) {
$theight = ceil($width * 10 / 16);
}
$ret = system('mplayer -vf expand=-1:'.$theight.' "'.$moviefile.'"');
if(false === $ret) {
exit;
}
if(preg_match('/\(종료\)/u', $ret)) {
exit;
}
$moviefile = preg_replace('/(\d+)([^\d]+)$/e', 'sprintf("%0".strlen($1)."d", $1 + 1).$2', $moviefile);
if(!file_exists($moviefile)) {
exit;
}
}
function size_callback($matches)
{
global $width, $height;
if($matches[1] == 'WIDTH') {
$width = $matches[2];
} else {
$height = $matches[2];
}
}
?>
설정파일 ¶~/.mplayer/config
unicode=yes #subcp=euc-kr subcp=cp949 fontconfig=1 font=Eunjin ## fontconfig를 1로 맞추었다면 fc-list 명령으로 나온 영어 폰트명을 적는다. #fontconfg=0 #font=/usr/share/fonts/TTF/UnPilgi.ttf ## fontconfig가 0이면 폰트경로를 적어준다. #af=volnorm ## 사운드 노멀라이즈 - 성능저하가 심함. subfont-autoscale=2 ## 동영상의 해상도에 비례 하여 글자의 크기를 맞춰줍니다 (1=높이, 2=넓이, 3=대각선) #subfont-outline=3 ## 테두리의 두께를 정해줍니다. #ffactor=1.5 ## 테두리 약간 투명참고사이트 : http://kldp.org/node/18761
|











![[http]](/imgs/http.png)