[ffmpeg] 여러 개의 동영상 한꺼번에 합치기

  1. ffmpeg를 https://ffmpeg.org/download.html 에서 받아서 압축을 푼 후, PATH 환경 변수에 해당 경로를 추가해서 커맨드 프롬프트에서 실행 가능하도록 만든다.

  2. 여러 동영상 파일명을 적은 Text file을 하나 만든다.

[code]
file ‘StepByStep/01_1-3/1-3-2.m4v’
file ‘StepByStep/01_1-3/1-3-3.m4v’
file ‘StepByStep/01_1-3/1-3-4.m4v’
file ‘StepByStep/01_1-3/1-3-5.m4v’
file ‘StepByStep/01_1-3/1-3-6.m4v’
file ‘StepByStep/01_1-3/1-3-7.m4v’
file ‘StepByStep/01_1-3/1-3-8.m4v’
file ‘StepByStep/01_1-3/1-3-9.m4v’
file ‘StepByStep/01_1-3/1-3-10.m4v’
file ‘StepByStep/01_1-3/1-3-11.m4v’
file ‘StepByStep/01_1-3/1-3-12.m4v’
file ‘StepByStep/01_1-3/1-3-13.m4v’
file ‘StepByStep/01_1-3/1-3-14.m4v’
file ‘StepByStep/01_1-3/1-3-15.m4v’
file ‘StepByStep/01_1-3/1-3-16.m4v’
file ‘StepByStep/01_1-3/1-3-17.m4v’
file ‘StepByStep/01_1-3/1-3-18.m4v’
file ‘StepByStep/01_1-3/1-3-19.m4v’
file ‘StepByStep/01_1-3/1-3-20.m4v’
file ‘StepByStep/01_1-3/1-3-21.m4v’
file ‘StepByStep/01_1-3/1-3-22.m4v’
file ‘StepByStep/01_1-3/1-3-23.m4v’
file ‘StepByStep/01_1-3/1-3-24.m4v’
file ‘StepByStep/01_1-3/1-3-25.m4v’
file ‘StepByStep/01_1-3/1-3-26.m4v’
file ‘StepByStep/01_1-3/1-3-27.m4v’
file ‘StepByStep/01_1-3/1-3-28.m4v’
file ‘StepByStep/01_1-3/1-3-29.m4v’
file ‘StepByStep/01_1-3/1-3-30.m4v’
file ‘StepByStep/01_1-3/1-3-31.m4v’
file ‘StepByStep/01_1-3/1-3-32.m4v’
file ‘StepByStep/01_1-3/1-3-33.m4v’
file ‘StepByStep/01_1-3/1-3-34.m4v’
file ‘StepByStep/01_1-3/1-3-35.m4v’
file ‘StepByStep/01_1-3/1-3-36.m4v’
[/code]

만드는데 쓴 bash shell 명령은 다음과 같다.

[code]
for DIR in `ls`; do pushd $DIR; for FILE in `ls -tr`; do echo "file ‘StepByStep/`basename \`pwd\“/$FILE’"; done > ../../`basename \`pwd\`.txt`; popd; done
[/code]

3.  다음 명령어를 커맨드 프롬프트에서 실행한다.

[code]
ffmpeg -f concat -i filename.txt -c copy -fflags +genpts output.mp4
[/code]

이걸 디렉토리 별로 돌린 bash shell 명령은 다음과  같다

[code]
for TXT in `ls *.txt`; do ffmpeg -f concat -i $TXT -c copy -fflags +genpts `echo $TXT | cut -d. -f1`.mp4; done;
[/code]

 

참고: https://superuser.com/questions/1039678/merge-multiple-video-with-ffmpeg-single-command-line-in-specific-time-without-cu

 

moniwiki 설치

글 정리할 때 익숙한 건 역시 moniwiki다. 다시 설치하려니 github로 옮겨가고, wikiseed 심는 것도 따로 프로젝트를 따로 뒀던데 다시 설치하는 절차를 정리한다.

설치하려는 디렉토리 아래(난 /var/www/)에서 git clone

[code]
git clone https://github.com/wkpark/moniwiki.git
chown -R www-data:www-data moniwiki
cd moniwiki/
git clone https://github.com/wkpark/moniwiki-wikiseed.git wikiseed
cd theme/
git clone https://github.com/wkpark/moniwiki-theme-paper.git paper
git clone https://github.com/wkpark/moniwiki-theme-bootstrap3.git bootstrap3
git clone https://github.com/wkpark/moniwiki-theme-publish.git publish
[/code]

브라우저에서 monisetup.php 접속

  1.  $sitename 설정
  2.  $admin_passwd 설정
  3.  $use_sectionedit 설정
  4.  “Sow wikiseed” 로 wiki seed 심기

추가로 config.php 에서 고치기

http://blog.dasomoli.org/240 참고

쉘에서 secure.sh 실행

[code]
sh secure.sh
[/code]

apache2 설정

/etc/apache2/sites-available/moniwiki.dasomoli.org.conf

[code]
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request’s Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName moniwiki.dasomoli.org

<Directory /var/www/moniwiki>
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>

ServerAdmin dasomoli@gmail.com
DocumentRoot /var/www/moniwiki

# Available loglevels: trace8, …, trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/moniwiki_error.log
CustomLog ${APACHE_LOG_DIR}/moniwiki.access.log combined

# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with “a2disconf”.
Include conf-available/serve-cgi-bin.conf
</VirtualHost>

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
[/code]

moniwiki 디렉토리에 index.html 생성

/var/www/moniwiki/index.html

[code]
<html>
<head>
<meta http-equiv=”refresh” content=”0; url=./wiki.php”>
</head>
<body onload=”javascript:window.location=’./wiki.php'”>
Please follow <a href=”wiki.php”>this link</a>
</body>
</html>
[/code]

[vi] .vimrc

.vimrc 같은건 대충 필요한 것만 그때 그때 써서 썼는데 새 환경에서 하나하나 쓰려니 귀찮다. 복사해서 쓸 수 있게 여기다 하나 써두고 업데이트하자.

syntax on

set autoindent
set cindent
:set smartindent
set noexpandtab

set nu

set hlsearch

set ts=4
set shiftwidth=4

set laststatus=2
set statusline=\ %<%l:%v\ [%P]%=%a\ %h%m%r\ %F\
set incsearch

colorscheme elflord

set tags=./tags,tags
set tags+=/usr/src/linux/tags
set tags+=../tags
set tags+=../../tags
set tags+=../../../tags

highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/

https://medium.com/sunhyoups-story/vim-%EC%97%90%EB%94%94%ED%84%B0-%EC%9D%B4%EC%81%98%EA%B2%8C-%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0-5b6b8d546017

[Windows] Command Prompt의 Current Code page 변경

Windows에서 명령줄을 띄워서 작업할 때, 어떤 에러 메시지 등을 google에서 찾아보고 싶은 경우 같은 때, 나오는 메시지의 언어를 바꾸고 싶을 때가 있다. 이럴 때 “LANG” 환경 변수 등을 바꾸어도 그대로 에러 메시지 등이 우리말로 나온다. 요건 mingw 같은 환경에서 shell을 써도 마찬가지. 한국판 Windows를 깔면 기본이 CP949로 설정되어 에러 메시지 등이 우리말로 나오는 것인데, 다음과 같이 CHCP 명령을 이용하면 된다. 65001은 UTF-8이다.

CHCP 65001

참고: https://superuser.com/questions/269818/change-default-code-page-of-windows-console-to-utf-8

[Windows] Apache 2.4 + PHPv5

Apache는 apache lounge의 것을 이용하자.

https://www.apachelounge.com/download/

설치 방법은 zip 파일 내부의 ReadMe.txt를 읽어보면 충분하다. 간단히 보면 httpd.conf의 SRVROOT 경로를 설치한 폴더로 바꿔준 후, httpd.exe -k install 후 서비스 시작하면 된다.

PHP는 moniwiki를 사용하기 위해서 설치한 거라 php5를 설치했다. apache 서비스는 중지하고 설치한다.

https://windows.php.net/download/ 에서 php5를 받아 d:\php5 에 풀어준다. apache의 httpd.conf 에 다음을 추가해 준다.

AddHandler application/x-httpd-php .php

AddType application/x-httpd-php .php .html

LoadModule php5_module “d:/php5/php5apache2_4.dll”

PHPIniDir “d:/php5”

php5 설치 디렉토리 안의 php.ini-development 를 php.ini로 복사해준다.

apache 서비스를 시작!

다음과 같은 에러는 extension을 설치하지 않았을 때 나는 에러로 http://php.net/manual/it/install.windows.extensions.php 를 참조하여 해결한다.

“Call to undefined function mb_strwidth()”

해결 방법을 간단히 적으면, extension_dir = d:\php5\ext 와 같이 바꾸고, ;extension=php_mbstring.dll 과 같이 comment되어 있는 줄의 ;를 지워 comment를 해제한다.