사용자 도구

사이트 도구


linux:video

문서의 이전 판입니다!


리눅스 동영상

자막 합치기

mencoder -oac copy -ovc lavc -utf8 -font 'Nanum Gothic' -sub "자막파일.srt" -o 결과물 자막_넣을_동영상

동영상 비율 변환(crop)

  • 동영상을 16:9 비율로 변환하기. x → 가로, y → 세로
  • x/y > 16/9 : 가로가 비율보다 길 때 x 길이를 줄여준다.
    new x = x * ((y/9) / (x/16)) = 16/9y
  • x/y < 16/9 : 세로가 비율보다 길 때 y 길이를 줄여준다.
    new y = y * ((x/16) / (y/9)) = 9/16x
  • 가로 비율이 길 때의 left/right crop px 계산 video_169.groovy
    int width = Integer.parseInt(args[0])
    int height = Integer.parseInt(args[1])
     
    if (width/height <= 16/9) {
    	println "no need to crop"
    }
     
    int crop = width - (16.0 / 9.0 * height)
    println "crop left and right ${crop / 2}px"

smi2srt

  • SMI파일을 SRT로 변환하기
    sudo apt-get install libsubtitles-perl
    # smi to srt
    subs -c srt 파일명.smi -o 파일명.srt
     
    # srt to smi
    subs -c smi 파일명.srt -o 파일명.smi
     
    # 변환한 자막을 UTF-8로 바꿔준다.
    iconv -f euc-kr -t utf8 파일명1 > 파일명2
    # 인코딩 오류가 발생하면 -c 옵션 추가
    iconv -f euc-kr -t utf8 -c 파일명1 > 파일명2
  • 위 명령을 스크립트 파일로 만들어두기 $HOME/.local/bin/smi2srt.sh [path/to/file.smi]
    #!/bin/sh
    fn=$(basename "$1")
    dn=$(dirname "$1")
    targetname="${fn%.*}.srt"
    subs -c srt "$1" -o "$dn/$targetname"
    read -p "Press Enter." nov
  • Nemo Action으로 변환 $HOME/.local/share/nemo/actions/smi2srt.nemo_action
    [Nemo Action]
    Name=SMI to SRT
    Comment=SMI to SRT
    Exec=gnome-terminal -x sh -c "/home/kwon37xi/.local/bin/smi2srt.sh '%F'"
    Selection=Any
    Extensions=smi
  • SRT가 EUC-KR 인코딩일 경우 UTF-8로 변환하는 Nemo Action $HOME/.local/share/nemo/actions/euckr_srt_to_utf8.nemo_action
    [Nemo Action]
    Name=EUC-KR SRT to UTF-8 SRT
    Comment=EUC-KR SRT to UTF-8 SRT
    Exec=gnome-terminal -x sh -c "iconv -f euc-kr -t utf8 '%F' > /tmp/iconvtemp;mv /tmp/iconvtemp '%F'"
    Selection=Any
    Extensions=srt
linux/video.1443979724.txt.gz · 마지막으로 수정됨: 2015/10/05 01:58 저자 kwon37xi