안녕하세요?
최근에 윈도우 서버로 갈아타면서 퀵싱크를 활용한 인코딩에 대해서 알아보겠습니다.
리눅스에서는 아래와 같이 세팅을 진행하고 굉장히 복잡합니다.
http://blog.djjproject.com/253
http://blog.djjproject.com/346
일단 길게 서문을 쓰지 않고 바로 진행해 보겠습니다.
1. 윈도우 기능 활성화 및 우분투 설치
제어판 -> 프로그램 및 기능 -> Windows 기능 켜기/끄기 -> Linux용 Windows 하위 시스템 을 체크하고 리부팅합니다.
다음으로 스토어에 들어가서 Linux 라고 검색합니다.
우분투를 선택해서 설치합니다.
그러면 아래처럼 앱 리스트에 올라옵니다.
실행을 하시면 조금 기다렸다가, 계정을 물어보는 창이 뜰것입니다.
왜인지 모르겠지만 제 데탑에서는 상기와 같은 창에서 멈추어 있어서 설정과정만 말씀드리겠습니다.
추가 계정을 생성하지 않기 위해서 계정 이름은 root 로 그리고 패스워드 설정하시면 되겠습니다.
그럼 아래와 같이 쉘이 열립니다.
다른 방법으로는 CMD 에서 bash 라고 입력하시면 아래와 같이 열리게 됩니다.
2. 실제 리눅스와 다른점 체크
일단 지금 윈도우에 사용중인 디스크는 /mnt/c d e f 이런식으로 잡힐 것입니다.
네트워크 드라이브는 잡히지 않습니다.
(일례로.. 레이드라이브를 리눅스 서브 시스템에 붙여 쓰기가 불가능합니다. mklink 를 통해서도 불가능하고.. \\raidrive 로도 불가능하네요.)
root@DESKTOP-CTBRHLM:~# ls -li /mnt
total 0
1407374883553285 drwxrwxrwx 0 root root 512 May 9 20:40 c
1407374883553285 drwxrwxrwx 0 root root 512 May 9 20:40 d
root@DESKTOP-CTBRHLM:~#
한편, htop 의 경우는 아래와 같이 뜹니다.
패키지 리스트를 갱신하지 않으면 설치가 되지 않습니다. 아래처럼 갱신 후 사용해 주세요.
root@DESKTOP-CTBRHLM:~# apt-get install htop
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package htop
root@DESKTOP-CTBRHLM:~# apt-get update && apt-get install htop
Get:1 http://security.ubuntu.com/ubuntu xenial-security InRelease [107 kB]
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]
Get:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]
Get:5 http://archive.ubuntu.com/ubuntu xenial/universe amd64 Packages [7,532 kB]
Get:6 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [490 kB]
Get:7 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [211 kB]
Get:8 http://archive.ubuntu.com/ubuntu xenial/universe Translation-en [4,354 kB]
Get:9 http://archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages [144 kB]
Get:10 http://security.ubuntu.com/ubuntu xenial-security/restricted amd64 Packages [7,224 B]
Get:11 http://security.ubuntu.com/ubuntu xenial-security/restricted Translation-en [2,152 B]
Get:12 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [347 kB]
Get:13 http://archive.ubuntu.com/ubuntu xenial/multiverse Translation-en [106 kB]
Get:14 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [775 kB]
Get:15 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [129 kB]
Get:16 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 Packages [3,464 B]
Get:17 http://security.ubuntu.com/ubuntu xenial-security/multiverse Translation-en [1,744 B]
Get:18 http://archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [321 kB]
Get:19 http://archive.ubuntu.com/ubuntu xenial-updates/restricted amd64 Packages [7,560 B]
Get:20 http://archive.ubuntu.com/ubuntu xenial-updates/restricted Translation-en [2,272 B]
Get:21 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [626 kB]
Get:22 http://archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [252 kB]
Get:23 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.4 kB]
Get:24 http://archive.ubuntu.com/ubuntu xenial-updates/multiverse Translation-en [8,344 B]
Get:25 http://archive.ubuntu.com/ubuntu xenial-backports/main amd64 Packages [4,844 B]
Get:26 http://archive.ubuntu.com/ubuntu xenial-backports/main Translation-en [3,220 B]
Get:27 http://archive.ubuntu.com/ubuntu xenial-backports/universe amd64 Packages [7,400 B]
Get:28 http://archive.ubuntu.com/ubuntu xenial-backports/universe Translation-en [3,996 B]
Fetched 15.7 MB in 17s (901 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following NEW packages will be installed:
htop
0 upgraded, 1 newly installed, 0 to remove and 135 not upgraded.
Need to get 76.4 kB of archives.
After this operation, 215 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/universe amd64 htop amd64 2.0.1-1ubuntu1 [76.4 kB]
Fetched 76.4 kB in 1s (55.9 kB/s)
Selecting previously unselected package htop.
(Reading database ... 25532 files and directories currently installed.)
Preparing to unpack .../htop_2.0.1-1ubuntu1_amd64.deb ...
Unpacking htop (2.0.1-1ubuntu1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up htop (2.0.1-1ubuntu1) ...
root@DESKTOP-CTBRHLM:~#
일단은 U5PVR 에 사용하는 컨테이너 느낌의 리눅스와 비슷합니다. 일종의 호환성을 가진 리눅스이죠.
한편, 비트 디펜더 (윈도우 디펜더) 때문에 짜잘한 파일들의 설치가 늦어지는 느낌도 있습니다.
다음으로, 실제 이 루트 파일들은 어디에 존재하는지 궁금하지 않습니까? 찾아보았습니다.
root@DESKTOP-CTBRHLM:~# ls -li /
total 52
16607023625977317 drwxr-xr-x 0 root root 512 Sep 23 2017 bin
1407374883765241 drwxr-xr-x 0 root root 512 Sep 23 2017 boot
2251799813951287 drwxr-xr-x 0 root root 512 May 9 21:28 dev
1407374883765261 drwxr-xr-x 0 root root 512 May 9 21:33 etc
562949953657118 drwxr-xr-x 0 root root 512 Apr 13 2016 home
281474976976696 -rwxr-xr-x 1 root root 51272 Jan 1 1970 init
562949953657121 drwxr-xr-x 0 root root 512 Sep 23 2017 lib
562949953658246 drwxr-xr-x 0 root root 512 Sep 23 2017 lib64
562949953658248 drwxr-xr-x 0 root root 512 Sep 23 2017 media
562949953658249 drwxr-xr-x 0 root root 512 May 9 21:28 mnt
562949953658250 drwxr-xr-x 0 root root 512 Sep 23 2017 opt
1 dr-xr-xr-x 8 root root 0 May 9 21:28 proc
562949953658252 drwx------ 0 root root 512 May 9 21:33 root
1407374883819339 drwxr-xr-x 0 root root 512 May 9 21:28 run
562949953658258 drwxr-xr-x 0 root root 512 Sep 23 2017 sbin
562949953658641 drwxr-xr-x 0 root root 512 Aug 31 2017 snap
562949953658642 drwxr-xr-x 0 root root 512 Sep 23 2017 srv
1 dr-xr-xr-x 12 root root 0 May 9 21:28 sys
562949953658644 drwxrwxrwt 0 root root 512 May 9 21:33 tmp
562949953658645 drwxr-xr-x 0 root root 512 Sep 23 2017 usr
281474976974195 drwxr-xr-x 0 root root 512 Sep 23 2017 var
root@DESKTOP-CTBRHLM:~#
찾아봅니다..
사용자 홈 폴더에 Appdata\Local\Pakages\CanonicalGroub* .... 에 있습니다.
해당 폴더의 LocalState 에 rootfs 를 들어가면!!
아래처럼 폴더가 그대로 보이네요.
이런 환경에서 완벽한 우분투 환경은 아니고 간단한 컴파일이나 리눅스에서 돌아가는 프로그램 몇몇들은 구동해 볼 수 있겠습니다.
화면을 뛰우긴 위해서 VNC 를 쓰거나 ssh 의 x11 forwarding 으로 화면을 보실 수 있습니다.
한편, 해당 하위 시스템은 런레벨지원이나 흔히 사용하는 rc 명령.. 그리고 systemctl (시스템 데몬) 명령이 먹지 않기 때문에 서비스도 직접 service **** start 로 수동으로 시작해 주셔야합니다.
테스트를 해 보니 아래의 정도로 판단이 가능합니다.
1. 리눅스의 파일시스템 사용 불가능
2. 아파치웹서버, 서브소닉 등등은 구동가능
3. 커널을 타는 fuse 파일 시스템 사용 불가능 (plexdrive / rclone mount 사용불가)
4. 이외 커널을 타는 서비스들 구동 불가..
커널 이야기가 나와서 말인데요. 커널 버전은 아래와 같습니다.
root@DESKTOP-CTBRHLM:~# uname -r
4.4.0-43-Microsoft
root@DESKTOP-CTBRHLM:~#
마이크로소프트의 호환성 레이어를 통한 커널이 돌아가고 있습니다.
3. 실전! TVHeadend 올려보기
컴파일은 뭐 똑같습니다. 컴파일 하시면 됩니다.
컴파일이 귀찮기 때문에 그냥 REPO 등록을 통해서 작업하겠습니다.
SPAWN 프로파일을 활용하기 위해서는 꼭 4.3 unstable 레포를 추가해야합니다.
root@DESKTOP-CTBRHLM:~# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
Executing: /tmp/tmp.7EiK0IBjkJ/gpg.1.sh --keyserver
hkp://keyserver.ubuntu.com:80
--recv-keys
379CE192D401AB61
gpg: requesting key D401AB61 from hkp server keyserver.ubuntu.com
gpg: key D401AB61: public key "Bintray (by JFrog) <bintray@bintray.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
root@DESKTOP-CTBRHLM:~# echo "deb https://dl.bintray.com/tvheadend/deb xenial unstable" | sudo tee /etc/apt/sources.list.d/tvheadend.list
deb https://dl.bintray.com/tvheadend/deb xenial unstable
root@DESKTOP-CTBRHLM:~# apt-get update
tvheadend 설치합니다.
root@DESKTOP-CTBRHLM:~# apt-get install tvheadend
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
libarchive-zip-perl libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3 libcgi-fast-perl
libcgi-pm-perl libclass-factory-util-perl libclass-inspector-perl libclass-methodmaker-perl libclass-singleton-perl
libcommon-sense-perl libconvert-binhex-perl libdata-dump-perl libdate-manip-perl libdatetime-format-builder-perl
libdatetime-format-iso8601-perl libdatetime-format-strptime-perl libdatetime-locale-perl libdatetime-perl
libdatetime-timezone-perl libdigest-hmac-perl libdvbcsa1 libemail-address-perl libemail-find-perl
libemail-valid-perl libencode-locale-perl libexporter-lite-perl libexporter-tiny-perl libfcgi-perl
libfile-chdir-perl libfile-listing-perl libfile-slurp-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl
libhtml-fromtext-perl libhtml-parser-perl libhtml-tableextract-perl libhtml-tagset-perl libhtml-tree-perl
libhttp-cache-transparent-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
libhttp-negotiate-perl libhttp-server-simple-perl libio-html-perl libio-sessiondata-perl libio-socket-inet6-perl
libio-socket-ssl-perl libio-stringy-perl libjson-perl libjson-xs-perl liblingua-preferred-perl
liblist-moreutils-perl liblog-tracemessages-perl liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl
libmime-tools-perl libmodule-implementation-perl libmodule-runtime-perl libnet-dns-perl libnet-domain-tld-perl
libnet-http-perl libnet-ip-perl libnet-smtp-ssl-perl libnet-ssleay-perl libossp-uuid-perl libossp-uuid16
libpackage-deprecationmanager-perl libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl
libparams-util-perl libparams-validate-perl libparse-recdescent-perl libpcre2-8-0 libperl5.22 libregexp-common-perl
libsoap-lite-perl libsocket6-perl libsub-install-perl libtask-weaken-perl libterm-progressbar-perl
libterm-readkey-perl libtext-bidi-perl libtie-ixhash-perl libtimedate-perl libtry-tiny-perl libtypes-serialiser-perl
libunicode-string-perl liburi-perl liburiparser1 libwww-mechanize-perl libwww-perl libwww-robotrules-perl
libxml-dom-perl libxml-libxml-perl libxml-libxslt-perl libxml-namespacesupport-perl libxml-parser-perl libxml-perl
libxml-regexp-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl libxml-treepp-perl libxml-twig-perl
libxml-writer-perl libxml-xpathengine-perl libxmlrpc-lite-perl libxmltv-perl libxslt1.1 perl perl-base
perl-modules-5.22 xmltv-util
Suggested packages:
libgssapi-perl libhtml-element-extended-perl libcrypt-ssleay-perl uuid libscalar-number-perl libapache2-mod-perl2
libmime-lite-perl libnet-jabber-perl libauthen-ntlm-perl libunicode-map8-perl xml-twig-tools xmltv-gui perl-doc
libterm-readline-gnu-perl | libterm-readline-perl-perl make libtext-kakasi-perl liblinux-dvb-perl
The following NEW packages will be installed:
libarchive-zip-perl libauthen-sasl-perl libavahi-client3 libavahi-common-data libavahi-common3 libcgi-fast-perl
libcgi-pm-perl libclass-factory-util-perl libclass-inspector-perl libclass-methodmaker-perl libclass-singleton-perl
libcommon-sense-perl libconvert-binhex-perl libdata-dump-perl libdate-manip-perl libdatetime-format-builder-perl
libdatetime-format-iso8601-perl libdatetime-format-strptime-perl libdatetime-locale-perl libdatetime-perl
libdatetime-timezone-perl libdigest-hmac-perl libdvbcsa1 libemail-address-perl libemail-find-perl
libemail-valid-perl libencode-locale-perl libexporter-lite-perl libexporter-tiny-perl libfcgi-perl
libfile-chdir-perl libfile-listing-perl libfile-slurp-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl
libhtml-fromtext-perl libhtml-parser-perl libhtml-tableextract-perl libhtml-tagset-perl libhtml-tree-perl
libhttp-cache-transparent-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl
libhttp-negotiate-perl libhttp-server-simple-perl libio-html-perl libio-sessiondata-perl libio-socket-inet6-perl
libio-socket-ssl-perl libio-stringy-perl libjson-perl libjson-xs-perl liblingua-preferred-perl
liblist-moreutils-perl liblog-tracemessages-perl liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl
libmime-tools-perl libmodule-implementation-perl libmodule-runtime-perl libnet-dns-perl libnet-domain-tld-perl
libnet-http-perl libnet-ip-perl libnet-smtp-ssl-perl libnet-ssleay-perl libossp-uuid-perl libossp-uuid16
libpackage-deprecationmanager-perl libpackage-stash-perl libpackage-stash-xs-perl libparams-classify-perl
libparams-util-perl libparams-validate-perl libparse-recdescent-perl libpcre2-8-0 libregexp-common-perl
libsoap-lite-perl libsocket6-perl libsub-install-perl libtask-weaken-perl libterm-progressbar-perl
libterm-readkey-perl libtext-bidi-perl libtie-ixhash-perl libtimedate-perl libtry-tiny-perl libtypes-serialiser-perl
libunicode-string-perl liburi-perl liburiparser1 libwww-mechanize-perl libwww-perl libwww-robotrules-perl
libxml-dom-perl libxml-libxml-perl libxml-libxslt-perl libxml-namespacesupport-perl libxml-parser-perl libxml-perl
libxml-regexp-perl libxml-sax-base-perl libxml-sax-expat-perl libxml-sax-perl libxml-treepp-perl libxml-twig-perl
libxml-writer-perl libxml-xpathengine-perl libxmlrpc-lite-perl libxmltv-perl libxslt1.1 tvheadend xmltv-util
The following packages will be upgraded:
libperl5.22 perl perl-base perl-modules-5.22
4 upgraded, 117 newly installed, 0 to remove and 131 not upgraded.
Need to get 28.5 MB of archives.
After this operation, 120 MB of additional disk space will be used.
Do you want to continue? [Y/n]
중간에 나오는 것은 마스터 계정 설정인데요. 설정해주시면 됩니다.
윈도우 디펜더가 파일을 하나하나 검사하기 때문에 굉장히 속도가 늦습니다. 참고하시길 바랍니다.
(물론 NTFS 파일 시스템도 한몫을 합니다.)
그럼 일단 아래처럼 접속이 될 것입니다.
root@DESKTOP-CTBRHLM:~# service tvheadend start
* Starting Tvheadend tvheadend [ OK ]
root@DESKTOP-CTBRHLM:~#
참고로 USB 튜너 연동 절대절대 안됩니다. 네트워크에 있는 홈런과는 연동이 됩니다. 참고하시길 바랍니다.
4. 외부로 노출되도록 방화벽 설정하기
일단 TVH 는 9981 9982 TCP / SSH 는 22 TCP 를 사용합니다.
제어판 -> Windows 방화벽 으로 이동해서 인바운드 규칙과 아웃바운드 규칙에 각각 추가해 줍니다.
(실은 인바운드 아웃바운드 뭔지 모르겠습니다 ㅎㅎ..)
아래처럼 인바운드 아웃바운드 모두 규칙을 추가해 줍니다.
고급설정을 클릭합니다.
새규칙을 누르고..
포트로 체크합니다.
TCP UDP 인지 체크하시고 특정포트를 누르신다음 포트 입력합니다.
연결허용 누릅니다.
아래는 상황에 맞게 해주시면 됩니다.
이름 마음에 드는것으로 선택합니다.
아웃바운드에서도 해주시길 바랍니다.
SSH 도 설정을 추가적으로 하셔도 되고 한번에 추가할 떄 하셔도 됩니다.
5. SSH 서비스 설정하기
아래명령으로 설치합니다.
root@DESKTOP-CTBRHLM:~# apt-get install openssh-server
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libfreetype6
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
openssh-client openssh-sftp-server
Suggested packages:
ssh-askpass libpam-ssh keychain monkeysphere rssh molly-guard
The following packages will be upgraded:
openssh-client openssh-server openssh-sftp-server
3 upgraded, 0 newly installed, 0 to remove and 128 not upgraded.
Need to get 963 kB of archives.
After this operation, 11.3 kB disk space will be freed.
Do you want to continue? [Y/n]
설정을 진행합니다.
root@DESKTOP-CTBRHLM:~# nano /etc/ssh/sshd_config
PermitRootLogin yes
PasswordAuthentication yes
두개의 설정을 변경합니다. (상기처럼)
그리고 서비스 시작합니다.
root@DESKTOP-CTBRHLM:~# service ssh start
* Starting OpenBSD Secure Shell server sshd [ OK ]
root@DESKTOP-CTBRHLM:~#
Xshell 이나 Putty 등등의 프로그램으로 연결해 봅니다.
Connecting to 192.168.0.150:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-17134-Microsoft x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud
129 packages can be updated.
55 updates are security updates.
Last login: Wed May 9 20:24:33 2018 from 124.194.31.74
root@DESKTOP-PG6CSQF:~#
연결이 잘 됩니다.
6. 리얼 혼종.. 리눅스 쉘에서 윈도우 프로그램 실행하기
일단.. 윈도우용으로 컴파일 된 ffmpeg 혹은 QSVEncC 를 받습니다.
https://ffmpeg.zeranoe.com/builds/
https://rigaya34589.blog.fc2.com/blog-category-10.html
(QSVEnCc 사용법)
https://rigaya34589.blog.fc2.com/blog-entry-337.html
적당히 C 드라이브에 tvheadend 라고 만들어 놓고 그 안에 넣습니다.
그 다음 리눅스 쉘에서 실행하기 편하도록 바인드를 해 둡니다.
root@DESKTOP-PG6CSQF:~# ln -s /mnt/c/tvheadend/ffmpeg.exe /usr/bin/ffmpeg
root@DESKTOP-PG6CSQF:~# ln -s /mnt/c/tvheadend/qsvencc/QSVEncC.exe /usr/bin/qsvencc
바로 실행이 가능합니다.
root@DESKTOP-PG6CSQF:~# ffmpeg
nable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
root@DESKTOP-PG6CSQF:~# qsvencc
QSVEncC (x86) 3.02 (r1420) by rigaya, Apr 23 2018 22:53:29 (VC 1900/Win/avx2)
reader: raw, avi, avs, vpy, avqsv [H.264/AVC, H.265/HEVC, MPEG2, VP8, VP9, VC-1]
Usage: QSVEncC [Options] -i <filename> -o <filename>
When video codec could be decoded by QSV, any format or protocol supported
by ffmpeg library could be used as a input.
Also, input can be avi, avs, vpy, raw YUV or YUV4MPEG2(y4m) format.
when raw(default), fps, input-res are also necessary.
output format will be automatically set by the output extension.
when output filename is set to "-", H.264/AVC ES output is thrown to stdout.
Example:
QSVEncC -i "<avsfilename>" -o "<outfilename>"
avs2pipemod -y4mp "<avsfile>" | QSVEncC --y4m -i - -o "<outfilename>"
Example for Benchmark:
QSVEncC -i "<avsfilename>" --benchmark "<benchmark_result.txt>"
Information Options:
-h,-? --help show help
-v,--version show version info
--check-hw check if QuickSyncVideo is available
--check-lib check lib API version installed
--check-features [<string>] check encode/vpp features
with no option value, result will on stdout,
otherwise, it is written to file path set
and opened by default application.
when writing to file, txt/html/csv format
is available, chosen by the extension
of the output file.
--check-features-html [<string>]
check encode/vpp features and write html report to
specified path. With no value, "qsv_check.html"
will be created to current directory.
--check-environment check environment info
--check-avversion show dll version
--check-codecs show codecs available
--check-encoders show audio encoders available
--check-decoders show audio decoders available
--check-formats show in/out formats available
--check-protocols show in/out protocols available
--check-filters show filters available
Basic Encoding Options:
-c,--codec <string> set encode codec
- h264(default), hevc, mpeg2, raw
-i,--input-file <filename> set input file name
-o,--output-file <filename> set ouput file name
for extension mp4/mkv/mov,
avcodec muxer will be used.
Input formats (will be estimated from extension if not set.)
--raw set input as raw format
--y4m set input as y4m format
--avi set input as avi format
--avs set input as avs format
--vpy set input as vpy format
--vpy-mt set input as vpy format in multi-thread
--avqsv set input to use avcodec + qsv
--avsw set input to use avcodec + sw decoder
--input-analyze <int> set time (sec) which reader analyze input file.
default: 5 (seconds).
could be only used with avqsv/avsw reader.
use if reader fails to detect audio stream.
--video-track <int> set video track to encode in track id
1 (default) highest resolution video track
2 next high resolution video track
...
-1 lowest resolution video track
-2 next low resolution video track
...
--video-streamid <int> set video track to encode in stream id
--audio-source <string> input extra audio file
--audio-file [<int>?][<string>:]<string>
extract audio into file.
could be only used with avqsv reader.
below are optional,
in [<int>?], specify track number to extract.
in [<string>?], specify output format.
--trim <int>:<int>[,<int>:<int>]...
trim video for the frame range specified.
frame range should not overwrap each other.
--seek [<int>:][<int>:]<int>[.<int>] (hh:mm:ss.ms)
skip video for the time specified,
seek will be inaccurate but fast.
--input-format <string> set input format of input file.
this requires use of avqsv/avsw reader.
-f,--output-format <string> set output format of output file.
if format is not specified, output format will
be guessed from output file extension.
set "raw" for H.264/ES output.
--audio-copy [<int>[,...]] mux audio with video during output.
could be only used with
avqsv reader and avcodec muxer.
by default copies all audio tracks.
"--audio-copy 1,2" will extract
audio track #1 and #2.
--audio-codec [<int>?]<string>
encode audio to specified format.
in [<int>?], specify track number to encode.
--audio-bitrate [<int>?]<int>
set encode bitrate for audio (kbps).
in [<int>?], specify track number of audio.
--audio-ignore-decode-error <int> (default: 10)
set numbers of continuous packets of audio
decode error to ignore, replaced by silence.
--audio-samplerate [<int>?]<int>
set sampling rate for audio (Hz).
in [<int>?], specify track number of audio.
--audio-resampler <string> set audio resampler.
swr (swresampler: default), soxr (libsoxr)
--audio-stream [<int>?][<string1>][:<string2>][,[<string1>][:<string2>]][..
set audio streams in channels.
in [<int>?], specify track number to split.
in <string1>, set input channels to use from source stream.
if unset, all input channels will be used.
in <string2>, set output channels to mix.
if unset, all input channels will be copied without mixing.
example1: --audio-stream FL,FR
splitting dual mono audio to each stream.
example2: --audio-stream :stereo
mixing input channels to stereo.
example3: --audio-stream 5.1,5.1:stereo
keeping 5.1ch audio and also adding downmixed stereo stream.
usable symbols
mono = FC
stereo = FL + FR
2.1 = FL + FR + LFE
3.0 = FL + FR + FC
3.0(back) = FL + FR + BC
3.1 = FL + FR + FC + LFE
4.0 = FL + FR + FC + BC
quad = FL + FR + BL + BR
quad(side) = FL + FR + SL + SR
5.0 = FL + FR + FC + SL + SR
5.1 = FL + FR + FC + LFE + SL + SR
6.0 = FL + FR + FC + BC + SL + SR
6.0(front) = FL + FR + FLC + FRC + SL + SR
hexagonal = FL + FR + FC + BL + BR + BC
6.1 = FL + FR + FC + LFE + BC + SL + SR
6.1(front) = FL + FR + LFE + FLC + FRC + SL + SR
7.0 = FL + FR + FC + BL + BR + SL + SR
7.0(front) = FL + FR + FC + FLC + FRC + SL + SR
7.1 = FL + FR + FC + LFE + BL + BR + SL + SR
7.1(wide) = FL + FR + FC + LFE + FLC + FRC + SL + SR
--audio-filter [<int>?]<string>
set audio filter.
in [<int>?], specify track number of audio.
--chapter-copy copy chapter to output file.
--chapter <string> set chapter from file specified.
--chapter-no-trim do not apply trim to chapter file.
--sub-copy [<int>[,...]] copy subtitle to output file.
these could be only used with
avqsv reader and avcodec muxer.
below are optional,
in [<int>?], specify track number to copy.
--avsync <string> method for AV sync (default: through)
through ... assume cfr, no check but fast
forcecfr ... check timestamp and force cfr.
-m,--mux-option <string1>:<string2>
set muxer option name and value.
these could be only used with
avqsv reader and avcodec muxer.
--nv12 set raw input as NV12 color format,
if not specified YV12 is expected
--tff set as interlaced, top field first
--bff set as interlaced, bottom field first
--fps <int>/<int> or <float> video frame rate (frames per second)
--input-res <int>x<int> input resolution
--output-res <int>x<int> output resolution
if different from input, uses vpp resizing
if not set, output resolution will be same
as input (no resize will be done).
--fixed-func use fixed func instead of GPU EU (default:off)
Frame buffer Options:
frame buffers are selected automatically by default.
d3d9 memory is faster than d3d11, so d3d9 frames are used whenever possible,
except decode/vpp only mode (= no encoding mode, system frames are used).
On particular cases, such as runnning on a system with dGPU, or running
vpp-rotate, will require the uses of d3d11 surface.
Options below will change this default behavior.
--disable-d3d disable using d3d surfaces
--d3d use d3d9/d3d11 surfaces
--d3d9 use d3d9 surfaces
--d3d11 use d3d11 surfaces
Encode Mode Options:
EncMode default: --cqp
--cqp <int> or encode in Constant QP, default 24:26:27
<int>:<int>:<int> set qp value for i:p:b frame
--la <int> set bitrate in Lookahead mode (kbps)
--la-hrd <int> set bitrate in HRD-Lookahead mode (kbps)
--icq <int> encode in Intelligent Const. Quality mode
default value: 24
--la-icq <int> encode in ICQ mode with Lookahead
default value: 26
--cbr <int> set bitrate in CBR mode (kbps)
--vbr <int> set bitrate in VBR mode (kbps)
--avbr <int> set bitrate in AVBR mode (kbps)
AVBR mode is only supported with API v1.3
--avbr-unitsize <int> avbr calculation period in x100 frames
default 27 (= unit size 2300 frames)
--qvbr <int> set bitrate in Quality VBR mode.
requires --qvbr-q option to be set as well
--qvbr-q <int> or set quality used in qvbr mode. default: 23
--qvbr-quality <int> QVBR mode is only supported with API v1.11
--vcm <int> set bitrate in VCM mode (kbps)
Other Encode Options:
--fallback-rc enable fallback of ratecontrol mode, when
platform does not support new ratecontrol modes.
-a,--async-depth set async depth for QSV pipeline. (0-64)
default: 0 (=auto, 4+2*(extra pipeline step))
--max-bitrate <int> set max bitrate(kbps)
--qp-min <int> or set min QP, default 0 (= unset)
<int>:<int>:<int>
--qp-max <int> or set max QP, default 0 (= unset)
<int>:<int>:<int>
--qp-offset <int>[:<int>][:<int>]...
set qp offset of each pyramid reference layers.
default 0 (= unset).
-u,--quality <string> encode quality
- best, higher, high, balanced(default)
fast, faster, fastest
--la-depth <int> set Lookahead Depth, 10-100
--la-window-size <int> enables Lookahead Windowed Rate Control mode,
and set the window size in frames.
--la-quality <string> set lookahead quality.
- auto(default), fast, medium, slow
--(no-)mbbrc enables per macro block rate control
default: auto
--ref <int> reference frames
default 0 (auto)
-b,--bframes <int> number of sequential b frames
default 3(HEVC) / 3(others)
--(no-)b-pyramid enables B-frame pyramid reference (default:off)
--(no-)direct-bias-adjust lower usage of B frame Direct/Skip type
--gop-len <int> (max) gop length, default 0 (auto)
when auto, fps x 10 will be set.
--(no-)open-gop enables open gop (default:off)
--strict-gop force gop structure
--(no-)i-adapt enables adaptive I frame insert (default:off)
--(no-)b-adapt enables adaptive B frame insert (default:off)
--(no-)weightp enable weighted prediction for P frame
--(no-)weightb enable weighted prediction for B frame
--(no-)repartition-check [H.264] enable prediction from small partitions
--(no-)fade-detect enable fade detection
--trellis <string> set trellis mode used in encoding
- auto(default), off, i, ip, all
--mv-scaling set mv cost scaling
- 0 set MV cost to be 0
- 1 set MV cost 1/2 of default
- 2 set MV cost 1/4 of default
- 3 set MV cost 1/8 of default
--slices <int> number of slices, default 0 (auto)
--no-deblock [h264] disables H.264 deblock feature
--tskip [hevc] enable transform skip
--sao <string> [hevc]
- auto default
- none disable sao
- luma enable sao for luma
- chroma enable sao for chroma
- all enable sao for luma & chroma
--ctu <int> [hevc] max ctu size
- auto(default), 16, 32, 64
--sharpness <int> [vp8] set sharpness level for vp8 enc
--level <string> set codec level
- H.264: auto(default), 1, 1b, 1.1, 1.2, 1.3
2, 2.1, 2.2, 3, 3.1, 3.2, 4, 4.1, 4.2
5, 5.1, 5.2
- HEVC: auto(default), 1, 2, 2.1, 3, 3.1, 4
4.1, 5, 5.1, 5.2, 6, 6.1, 6.2
- MPEG2: auto(default), low, main, high
high1440
--profile <string> set codec profile
- H.264: auto(default), Baseline, Main, High
- HEVC: auto(default), main, main10
- MPEG2: auto(default), Simple, Main, High
--sar <int>:<int> set Sample Aspect Ratio
--dar <int>:<int> set Display Aspect Ratio
--bluray for H.264 bluray encoding
--crop <int>,<int>,<int>,<int>
set crop pixels of left, up, right, bottom.
--videoformat <string> undef, ntsc, component, pal, secam, mac
default: undef
--colormatrix <string> undef, auto, bt709, smpte170m, bt470bg
smpte240m, YCgCo, fcc, GBR
default: undef
--colorprim <string> undef, auto, bt709, smpte170m, bt470m
bt470bg, smpte240m, film
default: undef
--transfer <string> undef, auto, bt709, smpte170m, bt470m
bt470bg, smpte240m, linear, log100, log316
default: undef
--aud insert aud nal unit to ouput stream.
--pic-struct insert pic-timing SEI with pic_struct.
--fullrange set stream as fullrange yuv
--max-cll <int>,<int> set MaxCLL and MaxFall in nits. e.g. "1000,300"
--master-display <string> set Mastering display data.
e.g. "G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)"
--input-buf <int> buffer size for input in frames (1-16)
default hw: 3, sw: 1
cannot be used with avqsv reader.
--output-buf <int> buffer size for output in MByte
default 8 MB (0-128)
--mfx-thread <int> set input thread num (-1 (auto), 2, 3, ...)
note that mfx thread cannot be less than 2.
--input-thread <int> set input thread num
0: disable (slow, but less cpu usage)
1: use one thread
--output-thread <int> set output thread num
-1: auto (= default)
0: disable (slow, but less memory usage)
1: use one thread
--min-memory minimize memory usage of QSVEncC.
same as --output-thread 0 --audio-thread 0
--mfx-thread -a 1 --input-buf 1 --output-buf 0
this will cause lower performance!
--max-procfps <int> limit processing speed to lower resource usage.
default:0 (no limit)
--log <string> output log to file (txt or html).
--log-level <string> set output log level
info(default), warn, error, debug
--log-framelist <string> output frame info for avqsv reader (for debug)
--benchmark <string> run in benchmark mode
and write result in txt file
--bench-quality "all" or <int>[,<int>][,<int>]...
default: 1,4,7
list of target quality to check on benchmark
--perf-monitor [<string>][,<string>]...
check performance info of QSVEncC and output to log file
select counter from below, default = all
--perf-monitor-plot [<string>][,<string>]...
plot perf monitor realtime (required python, pyqtgraph)
select counter from below, default = cpu,bitrate
counters for perf-monitor, perf-monitor-plot
all ... monitor all info
cpu_total ... cpu total usage (%)
cpu_kernel ... cpu kernel usage (%)
cpu_main ... cpu main thread usage (%)
cpu_enc ... cpu encode thread usage (%)
cpu_in ... cpu input thread usage (%)
cpu_out ... cpuQSVEncC.exe finished with error!
output thread usage (%)
cpu_aud_proc ... cpu aud proc thread usage (%)
cpu_aud_enc ... cpu aud enc thread usage (%)
cpu ... monitor all cpu info
gpu_load ... gpu usage (%)
gpu_clock ... gpu avg clock (%)
gpu ... monitor all gpu info
queue ... queue usage
mem_private ... private memory (MB)
mem_virtual ... virtual memory (MB)
mem ... monitor all memory info
io_read ... io read (MB/s)
io_write ... io write (MB/s)
io ... monitor all io info
fps ... encode speed (fps)
fps_avg ... encode avg. speed (fps)
bitrate ... encode bitrate (kbps)
bitrate_avg ... encode avg. bitrate (kbps)
frame_out ... written_frames
--python <string> set python path for --perf-monitor-plot
default: python
--perf-monitor-interval <int> set perf monitor check interval (millisec)
default 250, must be 50 or more
--(no-)timer-period-tuning enable(disable) timer period tuning
default: enabled
VPP Options:
--vpp-denoise <int> use vpp denoise, set strength (0-100)
--vpp-detail-enhance <int> use vpp detail enahancer, set strength (0-100)
--vpp-deinterlace <string> set vpp deinterlace mode
- none disable deinterlace
- normal normal deinterlace
- it inverse telecine
- bob double framerate
--vpp-image-stab <string> set image stabilizer mode
- none, upscale, box
--vpp-sub [<int>] or [<string>]
burn in subtitle into frame
set sub track number in input file by integer
or set external sub file path by string.
--vpp-sub-charset [<string>] set subtitle char set
--vpp-sub-shaping <string> simple(default), complex
--vpp-delogo <string> set delogo file path
--vpp-delogo-select <string> set target logo name or auto select file
or logo index starting from 1.
--vpp-delogo-pos <int>:<int> set delogo pos offset
--vpp-delogo-depth <int> set delogo depth [default:128]
--vpp-delogo-y <int> set delogo y param
--vpp-delogo-cb <int> set delogo cb param
--vpp-delogo-cr <int> set delogo cr param
--vpp-delogo-add add logo mode
--vpp-rotate <int> rotate image
90, 180, 270.
--vpp-mirror <string> mirror image
- h mirror in horizontal direction
- v mirror in vertical direction
--vpp-scaling <string> set scaling quality
- auto(default)
- simple use simple scaling
- fine use high quality scaling
--vpp-half-turn half turn video image
unoptimized and very slow.
root@DESKTOP-PG6CSQF:~#
참 띠용~... 하는 부분입니다.
참 신기합니다. ㅎㅎ
간단히 인코딩 테스트를 했습니다만.. 실패.. 경로가 맞지 않나 보네요.
root@DESKTOP-PG6CSQF:~# ffmpeg -i test.mp4 -y out.mp4
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.0 (GCC)
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
test.mp4: No such file or directory
TVH 에 바로 적용해 보겠습니다.
7. SPAWN 프로파일 사용하기
TVH 에서 SPAWN 으로 생성하시면 되겠습니다.
명령은 아래와 같습니다.
/usr/bin/ffmpeg -loglevel quiet -c:v h264_qsv -i pipe:0 -map_metadata -1 -map_chapters -1 -threads 1 -map 0:0 -map 0:1 -map -0:s -codec:v:0 h264_qsv -preset 7 -profile:v high -level 5.1 -b:v 800k -vf scale=960:540 -codec:a:0 aac -ab 64k -ac 2 -f mpegts -
혹은 QSVEncC 를 활용하신다면 아래와 같이 넣으시면 됩니다.
/usr/bin/qsvencc -i pipe:0 -c h264 --vpp-deinterlace bob --output-res 960x540 --d3d11 --fixed-func --audio-codec aac --audio-stream stereo --audio-bitrate 96 --format mpegts -o -
상기 커맨드에서 해상도와 코덱등은 잘 설정해 주세요. 6세대 부터 HEVC 인코딩이 가능합니다.
재생은 잘 되네요.
8. 먹스에 넣을때 부터 pipe 사용하기
일단 /home/hts/ffmpeg 라고 실행파일을 하나 생성합니다.
#!/bin/bash
#/usr/bin/ffmpeg -hwaccel dxva2 -threads 1 -i "$1" -vcodec h264_qsv -b:v 800k -vf scale=960:540 -acodec aac -ab 64k -ac 2 -f mpegts -y pipe:1
/usr/bin/qsvencc -i "$1" -c h264 --vpp-deinterlace bob --output-res 960x540 --d3d11 --fixed-func --audio-codec aac --audio-stream stereo --audio-bitrate 96 --format mpegts -o pipe:1
윗줄이 ffmpeg 를 사용한 것이고 아랫줄이 qsvencc 를 사용한 것입니다. QSVEncC 가 설정이 편하여서 사용중입니다.
먹스에 주소는 아래와 같이 설정합니다.
pipe:///home/hts/ffmpeg http://ip_addr/stream/******
이런식으로 가능하고 rtp나 udp 사용 가능합니다.
홈런을 사용하신다면 SPAWN 프로파일을 이용해 주시는게 좋습니다.
버전에 따라 다르겠지만, 4세대 에서는 비디오 프로세싱이.. 아폴로레이크 시스템에서는 비디오 인코딩 퍼센트가 올라갑니다.
이렇게 장문의 글을 마칩니다.
마치려고 했는데? 다시 .. 윈도우 부팅시 서비스 시작은 어떻게 하는지에 대해서 강구해 보았습니다.
9. 서비스 자동시작
예약된 작업에 추가하셔도 됩니다.
그냥 저는 시작프로그램에 등록했습니다.
.bat 파일로써 아래의 구문을 추가합니다.
bash -c "service tvheadend start"
bash -c "service ssh start"
그리고 시작프로그램 폴더에 넣어주시면 잘 실행될 것입니다.
가즈아~~~~~~~~~~~
'서버 > 윈도우 서버' 카테고리의 다른 글
Windows 10 + Subsonic + Raidrive + PLEX 가사플러그인 (소주6잔님) (429) | 2018.08.13 |
---|---|
윈도우10 을 서버로 쓰는 것 적응기.. (WSL / Windows Update) (417) | 2018.06.28 |
RaiDrive -> KODI ... 개꿀? (390) | 2017.12.04 |
윈도우 공유폴더 만들기 (계정 권한) (2401) | 2017.10.15 |
[Windows]Emby Server 설치 및 Quick Sync Video 트랜스코딩 체험(QSV) (428) | 2016.08.28 |
댓글