Why asoundrc?

What is it good for, why do I want one?

Neither the .asoundrc nor the asound.conf files are required for ALSA to work properly. Most applications will work without them. They are used to allow extra functionality, such as routing and sample-rate conversion, through the alsa-lib layer.

The .asoundrc file

This file allows the you to have more advanced control over your card/device. The .asoundrc file consists of definitions of the various cards available in your system. It also gives you access to the pcm plugins in alsa-lib. These allow you to do tricky things like combine your cards into one or access multiple i/o's on your mulitchannel card.

Where does asoundrc live?

The asoundrc file is typically installed in a user's home directory

	$HOME/.asoundrc

and is called from

	/usr/share/alsa/alsa.conf

It is also possible to install a system wide configuration file as

	/etc/asound.conf

When an alsa application starts both configuration files are read.

Below is the most basic definition.

The default plugin

Make a file called .asoundrc in your home and/or root directory.

        vi /home/xxx/.asoundrc

copy and paste the following into the file then save it.

        pcm.!default {
type hw
card 0
}

ctl.!default {
type hw
card 0
}

The keyword default is defined in the ALSA lib API and will always access hw:0,0 - the default device on the default soundcard. Specifying the !default name supercedes the one defined in the ALSA lib API.

Now you can test:

	aplay -D default test.wav

The naming of PCM devices

A typical asoundrc starts with a 'PCM hw type'. This gives an ALSA application the ability to start a virtual soundcard (plugin, or slave) by a given name. Without this, the soundcard(s)/devices(s) must be accessed with names like hw:0,0 or default. For example:

	aplay -D hw:0,0 test.wav

or with ecasound

	ecasound -i test.wav -o alsa,hw:0,0

The numbers after hw: stand for the soundcard number and device number. This can get confusing as some sound "cards" are better represented by calling them sound "devices", for example USB sounddevices. However they are still "cards" in the sense that they have a specific driver controlling a specific piece of hardware. They also correspond to the index shown in

	/proc/asound/cards

As with most arrays the first item usually starts at 0 not 1. This is true for the way pcm devices (physical i/o channels) are represented in ALSA. Starting at pcm0c (capture), pcm0p (playback).

We use subdevices mainly for hardware which can mix several streams together. It is impractical to have 32 devices with exactly the same capabilities. The subdevices can be opened without a specific address, so the first free subdevice is opened. Also, we temporarily use subdevices for hardware with alot of streams (I/O connectors) - for example MIDI. There are several limits given by used minor numbers (8 PCM devices per card, 8 MIDI devices per card etc.).

For example, to access the first device on the first soundcard/device, you would use

	hw:0,0

to access the first device on the second soundcard/device, you would use

	hw:1,0

to access the second device on the third soundcard/device, you would use

	hw:2,1

The Control device

The control device for a card is the way that programs modify various "controls" on the card. For many cards this includes the mixer, some cards, for example the rme9652, have no mixer. However, they do still have a number of other controls and some programs like JACK need to be able to access them. Examples include the digital i/o sync indicators, sample clock source switch and so on.

Aliases

With the 'PCM hw type' you are able to define aliases for your devices. The syntax for this definition is:

	pcm.NAME {
type hw # Kernel PCM
card INT/STR # Card name or number
[device] INT # Device number (default 0)
[subdevice] INT # Subdevice number, -1 first available (default -1)
mmap_emulation BOOL # enable mmap emulation for ro/wo devices
}

For example, this gives your first soundcard an alias:

	pcm.primary {
type hw
card 0
device 0
}

Now you can access this card by the alias 'primary'.

	aplay -D primary test.wav

Plugins

To see a full list of plugins visit the alsa-lib documentation which is generated daily from cvs.

Q: What are plugins?

A: In ALSA, PCM plugins extend functionality and features of PCM devices. The plugins deal automagically with jobs like naming devices, sample rate conversions, sample copying among channels, writing to a file, joining sound cards/devices for multiple inputs/outputs (not sample synced), using multi channel sound cards/devices and other possibilities left for you to explore. to make use of them you need to create a virtual slave device.

A very simple slave could be defined as follows:

	pcm_slave.sltest {
pcm
}

This defines a slave without any parameters. It's nothing more than another alias for your sound device. The slightly more complicated thing to understand is that parameters for 'pcm types' must be defined in the slave-definition-block. Let's setup a rate-converter which shows this behaviour.

	pcm_slave.sl2 {
pcm
rate 48000
}

pcm.rate_convert {
type rate
slave sl2
}

Now you can call this newly created virtual device by:

	aplay -D rate_convert test.wav

Which automatically converts your samples to a 44.1 kHz sample rate while playing. It's not very useful because most players and alsa converts samples to the right sample rate which your soundcard is capable of, but you can use it for a conversion to a lower static sample rate for example. A more complex tool for conversion is the pcm type plug. the syntax is:

  	type plug             	# Format adjusted PCM
slave STR # Slave name (see pcm_slave)
# or
slave { # Slave definition
pcm STR # Slave PCM name
# or
pcm { } # Slave PCM definition
[format STR] # Slave format (default nearest) or "unchanged"
[channels INT] # Slave channels (default nearest) or "unchanged"
[rate INT] # Slave rate (default nearest) or "unchanged"
}
route_policy STR # route policy for automatic ttable generation
# STR can be 'default', 'average', 'copy', 'duplicate'
# average: result is average of input channels
# copy: only first channels are copied to destination
# duplicate: duplicate first set of channels
# default: copy policy, except for mono capture - sum
ttable { # Transfer table (bidimensional compound of
# cchannels * schannels numbers)
CCHANNEL {
SCHANNEL REAL # route value (0.0 ... 1.0)
}
}

We can use it as follows:

	pcm_slave.sl3 {
pcm
format S16_LE
channels 1
rate 16000
}

pcm.complex_convert {
type plug
slave sl3
}

By calling it with:

	aplay -vD complex_convert test.wav

You will convert the sample during playing to the sample format: S16_LE, one channel and a sample rate of 16 kHz. As you called aplay with the verbose option -v you see this options as it appears as it comes from the original file. with:

	aplay -v test.wav

You see the original settings of the file.

Software mixing

Software mixing is the ability to play multiple sound files or applications at the same time through the same device. There are many ways to have software mixing in the Linux environment. Usually it requires a server application such as ARTSD, ESD, JACK... The list is large and the apps can often be confusing to use.

dmix

These days we have a native plugin for ALSA called the dmix (direct mixing) plugin. It allows software mixing in an easy to use syntax and without the hassle of installing/understanding a new application first.

A very interesting and potentially extremely useful aspect of this plugin is using it combined with the default plugin name. In theory this means all applications that have native ALSA support will share the sound device. In practice not many applications are able to take advantage of this functionality yet. However if you have time to test and report your findings to the application developers it is worth a try:

    pcm.!default {
type plug
slave.pcm "dmixer"
}


pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:1,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
}

ctl.dmixer {
type hw
card 0
}

(To use it with your own name just change the word !default above)

Now try:

	aplay -f cd -D default test.wav

on multiple consoles.

Some notes:

The dmix PCM name is already defined in the global configuration file /usr/share/alsa/alsa.conf.

- The default sample rate for this device is 48000Hz. If you would like to change it use:

 	aplay -D"plug:'dmix:RATE=44100'" test.wav

- An example command for dmix plugin to use 44100Hz sample-rate and hw:1,0 output device:

 	aplay -Dplug:'dmix:SLAVE="hw:1,0",RATE=44100' test.wav

- The dmix PCM name is already defined in the global configuration file /usr/share/alsa/alsa.conf.

Defaults are:

	SLAVE="hw:0,0",RATE=48000

NB the dmix plugin is not based on client/server architecture, but it writes directly to the soundcard's DMA buffer. There is no limit to the amount of instances that can be run at one time.

dsnoop

While the dmix plugin is for mixing multiple output(playback) streams together, if you want to use multiple input(capture) clients you need to use the dsnoop plugin:

    pcm.mixin {
type dsnoop
ipc_key 5978293 # must be unique for all dmix plugins!!!!
ipc_key_add_uid yes
slave {
pcm "hw:0,0"
channels 2
period_size 1024
buffer_size 4096
rate 44100
periods 0
period_time 0
}
bindings {
0 0
0 1
}
}

JACK plugin

This plugin allows the user to connect applications that support alsa natively to the JACK daemon.

To compile and install jack, you need to move to src/pcm/ext directory, and run "make jack" and "make install-jack". this is intentional.

To use the JACK plugin you will need to add the following to your .asoundrc.

	pcm.jackplug {
type plug
slave { pcm "jack" }
}

pcm.jack {
type jack
playback_ports {
0 alsa_pcm:playback_1
1 alsa_pcm:playback_2
}
capture_ports {
0 alsa_pcm:capture_1
1 alsa_pcm:capture_2
}
}

Now, you can use:

	aplay -Djackplug somefile
arecord -Djackplug somefile

Virtual multi channel devices

If you would like to link two or more ALSA devices together so that you have a virtual multi channel device it is possible. However this will not create the mythical "multi-channel soundcard out of el-cheapo consumer cards". The real devices will drift out of sync over time. It is sometimes helpful to make applications see for example, one 4 channel card to allow for flexible routing if they can't easily be made to talk to multiple cards (making use of JACK being one example).

Copy and paste the following into your asoundrc.

	# create a virtual four-channel device with two sound devices:
# This is in fact two interleaved stereo streams in
# different memory locations, so JACK will complain that it
# cannot get mmap-based access. see below.

pcm.multi {
type multi;
slaves.a.pcm "hw:0,0";
slaves.a.channels 2;
slaves.b.pcm "hw:1,0";
slaves.b.channels 2;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave b;
bindings.2.channel 0;
bindings.3.slave b;
bindings.3.channel 1;
}

# JACK will be unhappy if there is no mixer to talk to, so we set
# this to card 0. This could be any device but 0 is easy.

ctl.multi {
type hw;
card 0;
}

# This creates a 4 channel interleaved pcm stream based on
# the multi device. JACK will work with this one.

pcm.ttable {
type route;
slave.pcm "multi";
ttable.0.0 1;
ttable.1.1 1;
ttable.2.2 1;
ttable.3.3 1;
}
# see above.
ctl.ttable {
type hw;
card 0;
}

This will give you xruns, but it's suitable for testing. To test the above setting feed an audio signal to the real sound devices play it back and listen to it with an external mixer:

	arecord -f S16_LE -r 44100 -c 4 -D multi | aplay -f S16_LE -r 44100 -c 4 -D multi

To start JACK with the new device, use

 	jackd [-a] -R [-v] -d alsa -d ttable [-p 1024]

Bindings explained

The above example for a virtual multi channel device uses bindings to make the connections work. The following is a more advanced asoundrc for 2 RME Hammerfalls which is a professional multichannel sound device. Below is a full explanation of how bindings work.

	# This is for two RME Hammerfall cards. They have been split into top row
# and bottom row with channels 0-7+16-25 on rme9652_0 and channels 8-15+26-27 on
# rme9652_1. NB. channels 24-27 are used as two stereo channels while the others are mono.

# eg. card1
# | 0 1 2 3 4 5 6 7 |
# | 8 9 10 11 12 13 14 15 24 25|
# card2
# | 16 17 18 19 20 21 22 23 24 25|




pcm_slave.rme9652_s {
pcm rme9652_0
}
pcm.rme9652_1 {
type hw
card 1
}
ctl.rme9652_1 {
type hw
card 1
}
pcm.rme9652_0 {
type hw
card 0
}
ctl.rme9652_0 {
type hw
card 0
}
ctl.rme9652_48 {
type hw
card 0
}
pcm.rme9652_48 {
type multi;
slaves.a.pcm rme9652_0;
slaves.a.channels 26;
slaves.b.pcm rme9652_1;
slaves.b.channels 26;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave a;
bindings.2.channel 2;
bindings.3.slave a;
bindings.3.channel 3;
bindings.4.slave a;
bindings.4.channel 4;
bindings.5.slave a;
bindings.5.channel 5;
bindings.6.slave a;
bindings.6.channel 6;
bindings.7.slave a;
bindings.7.channel 7;
bindings.8.slave a;
bindings.8.channel 16;
bindings.9.slave a;
bindings.9.channel 17;
bindings.10.slave a;
bindings.10.channel 18;
bindings.11.slave a;
bindings.11.channel 19;
bindings.12.slave a;
bindings.12.channel 20;
bindings.13.slave a;
bindings.13.channel 21;
bindings.14.slave a;
bindings.14.channel 22;
bindings.15.slave a;
bindings.15.channel 23;

# Use rme9652_1

bindings.16.slave b;
bindings.16.channel 8;
bindings.17.slave b;
bindings.17.channel 9;
bindings.18.slave b;
bindings.18.channel 10;
bindings.19.slave b;
bindings.19.channel 11;
bindings.20.slave b;
bindings.20.channel 12;
bindings.21.slave b;
bindings.21.channel 13;
bindings.22.slave b;
bindings.22.channel 14;
bindings.23.slave b;
bindings.23.channel 15;

# stereo channels

bindings.24.slave a;
bindings.24.channel 24;
bindings.25.slave a;
bindings.25.channel 25;
bindings.26.slave b;
bindings.26.channel 24;
bindings.27.slave b;
bindings.27.channel 25;
}

What is happening?

There are two sound cards which are linked with a wordclock pipe. That allows them to keep sample sync with each other which is very important for multichannel work. If the sample rates are not in sync then your sounds become out of time with each other.

Each sound card has a number of physical channels 19 + 10. They are represented in /proc/asound/cardx as pcmXc (capture) and pcmXp (playback). Where X equals the number of the physical input/output (i/o) channels starting at 0.

If you look at the lines:

	type multi;
slaves.a.pcm rme9652_0;
slaves.a.channels 26;

You can see that the card has been nicknamed "a" and given a range of 26 channels. You can assign the card any number of channels you want but you can only use as many channels as the card has physically available. The bindings start at the first available pcm device for the card ie. pcm0c pcm0p - and move upwards sequentially from there.

The first card for this file has 18 physical pcm devices. Nine of them are capture devices ie. pcm0c pcm1c pcm2cpcm8c, each with corresponding playback channels ie. pcm0p pcm1p pcm2p ... pcm8p. The second card has 10 physical pcm devices ie. pcm0c pcm1c pcm2c ... pcm9c. ...

If you look at the lines:

    	bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;

The first binding points to the first available pcm device on the card represented as "a". The second binding points to the second available pcm device on "a" and so on up to the last one available. We then assign a channel number to the binding so that the channels on the new virtual "soundcard" we have created are easy for us to access.

Another way of saying it is:

   	address of.the first channel on my new soundcard.using my real soundcard called "a";
make this address of.the first channel on my new soundcard.be the first pcm device on my new soundcard;
   	address of.the second channel on my new soundcard.using my real soundcard called "a";
make this address of.the second channel on my real soundcard.be the second pcm device on my new soundcard;


Referenced applications

  • aRTsd - the aRTs sound server is the basis of desktop sound for KDE.
  • ESD - the Enlightened Sound Daemon mixes several audio streams for playback by a single audio device.
  • Ecasound - a commandline multitrack recorder and editor with various GUI apps.
  • JACK - Jack Audio Connection Kit. If you don't know this app you don't know JACK.

Notes:

  1. Example: Alternative .asoundrc and modules.conf files
  2. Tricks for getting the most out of the card.


'Development > Linux' 카테고리의 다른 글

[Android] 우분트 10.4 기반 빌드/환경구축/소스/빌드[펌]  (0) 2012.09.26
Ubuntu 10.04 JDK  (0) 2012.09.26
Gstreamer build  (0) 2011.07.28
NFS in ubuntu  (0) 2009.12.04
Upgrade distribution in ubuntu  (0) 2009.11.27
Posted by 까 치
,

[출처] http://blog.naver.com/hcwha/70099948018

 

 

여기에서 다룰 변환은 동영상의 컨테이너만 바꾸는 변환입니다.

쉽게 풀어 말하면 "mkv 컨테이너"안에 들어 있는 "비디오 스트림"과 "오디오 스트림"을 꺼내어, avi에 컨테이너에 넣는 변환입니다.

즉 확장자만 다르게 변화시킬 뿐, 실제 "비디오 데이터"와 "오디오 데이터"는 변하지 않습니다.

 

2010년도의 LG TV중에 동영상을 USB 메모리나 외장하드에 저장해 연결했을때 동영상을 재생하는 USB 호스트기능이 있습니다.

지원 동영상 리스트를 보면 Xvid 비디오가 들어있는 mkv는 재생되지 않으나, Xvid 비디오가 들어간 avi는 재생이 가능했습니다.

Xvid.mkv파일을 보려고 할때는 사람들이 사용하는 팟인코더, 곰인코더등을 이용해서 재인코딩을 할 필요가 없습니다.

Xvid.avi로 컨테이너만 바꾸어주면 재생이 가능하게 됩니다. 시간절약에 화질유지까지 두마리 토끼를 잡는 셈이죠.

 

베가스같은 편집 프로그램에서 mkv를 편집하려면 Yamb을 이용해서 mkv에서 mp4(MPEG-4 Part 14)파일로 컨테이너만 바꾸는 변환을 하십시요.

그리고 mp4를 정상적으로 편집할 수 있는 베가스 10버전을 이용하시면 됩니다. 또한 avi로 컨테이너를 바꾸어도 베가스에서 인식합니다.

간단한 단순히 컷작업같은 편집을 할때는 "Direct Stream Copy"를 사용할 수 있는 VirtualDubMod가 베가스보다는 좋은 선택입니다.

그때는 먼저 mkv에서 avi로 컨테이너를 바꾸는 작업이 선행되어야 합니다.

참고로 mkv파일을 단순히 자르는 작업은 mkvmerge GUI를 이용하시면 됩니다. 그러나 지정한 시간에 정확히 잘리지는 않습니다.

 

 

 

컨테이너에서 비디오 스트림을 꺼내어 파일로 저장하는 과정을 디먹싱이라고 합니다.

(디먹싱의 실제 의미는 재생때 디멀티플렉서가 컨테이너에서 스트림을 꺼내어 디코더로 전달하는 과정을 말합니다.)

비디오 파일, 오디오 파일, 자막 파일을 컨테이너에 넣는 과정을 먹싱이라고 합니다.

 

 

STEP 1. 디먹싱

 

 

변환시킬 동영상 파일 1번 ◀

 

 

  컨테이너 : Matroska (확장자 .mkv)

  비디오 코덱 : Xvid

  오디오 코덱 : AC-3 (영화 본편 더빙), AC-3 (해설 더빙)

 

 

 

1. 필요한 프로그램 설치 

아래 링크를 2개를 모두 받아 압축 풀기합니다. MKVToolnix 설치합니다.

☞ MKVToolnix Part 1 다운받기    ☞ MKVToolnix Part 2 다운받기

☞ 여기를 클릭해 "MKVExtract GUI"를 다운받아 압축풀기합니다.

MKVExtractGUI2.exe를 복사해 MKVToolnix가 설치된 "C:Program FilesMKVtoolnix"폴더에 붙여 넣기합니다.

MKVExtractGUI2.exe에서 마우스 오른쪽 버튼을 클릭하여 "시작메뉴에 고정"시킵니다. MKVExtractGUI2.exe를 더블클릭하여 실행합니다.

MKVExtractGUI2를 시작메뉴에 고정해놓았으니 다음에는 시작메뉴에서 실행하면 됩니다.

 

2. 비디오와 오디오를 디먹싱

 

(1) Input File에서 오른쪽에 있는 버튼을 클릭하여 디먹싱할 mkv파일을 불러옵니다.

(2) 그림처럼 "Source Dir"에 체크하면 열기한 mkv파일이 있는 폴더에 디먹싱된 파일이 저장되게 됩니다.

(3) Tracks에서 오른쪽 끝에 있는 "전체 선택"버튼을 클릭합니다.

     그리고 Tracks에서 정보를 보고 디먹싱하고 싶지 않은 파일에 체크해제 합니다

     이 mkv 컨테이너에는 1개의 "비디오 스트림", 2개의 "오디오 스트림"이 들어 있습니다.

(4) Extract버튼을 클릭하면 디먹싱이 시작됩니다.

 

Xvid 비디오는 AVI 컨테이너에 먹싱된 상태로 avi인 파일로 저장되며, AC-3 오디오는 확장자가 .ac3인 파일로 저장됩니다.

이렇게 두가지 모두 raw 파일이 아닌 상태로 디먹싱됩니다.

 

 

 

 

 

변환시킬 동영상 파일 2번

 

 

   컨테이너 : Matroska(확장자 .mkv)

   비디오 코덱 : H264 (=MPEG-4 AVC)

   오디오 코덱 : AC-3(영어 더빙), AC-3(한국어 더빙) (2가지가 모두 들어 있는 파일)

 

 

 

 

1. 필요한 프로그램 설치

H264 코덱으로 만들어진 비디오를 디먹싱해야 합니다.

mkv파일에 H264 비디오가 들어 있는 경우에 mkvextract를 사용하면 확장자가 .h264인 raw 파일로 디먹싱됩니다.

avc2avi를 이용해 h264 파일을 avi 컨테이너에 디먹싱할 수 있으나 2기가 이상에서 에러를 보이므로 나누는 작업이 추가됩니다.

여러모로 불편합니다. 그러나 다행히도 Haali Media Splitter를 설치했을때 들어 있는 "mkv2vfr.exe"을 이용하면 avi 파일로 에러없이 저장시킬수 있습니다.

 

☞ 여기를 클릭하여 "mkv2vfr.exe", "mkunicode.dll", "mkzlib.dll"파일을 다운받습니다.

동영상과 위 3파일이 같은 폴더에 있도록 붙여넣기 합니다.

이미 Haali Media Splitter가 설치되어 있는 분은, 마찬가지로 Haali Media Splitter가 설치된 폴더에서 3파일을 복사해 동영상이 있는 폴더에 붙여넣기합니다.

 

2. 비디오 디먹싱

 

도스상태에서 mkv파일과 mkv2vfr.exe파일이 들어 있는 폴더로 이동합니다. 그리고 mkv2vfr에 디먹싱 명령을 내려줘야 합니다.

도스라면 어렵다고 생각할수도 있지만 아주 간단합니다.

 

(1) 윈도우 작업표시줄에서 [시작 → 모든 프로그램 → 보조프로그램 → 명령 프롬프트]를 선택합니다.

(윈도우키+R을 눌러 실행창에 cmd를 입력하고 엔터해도 됩니다.)

 

(2) mkv파일이 들어 있는 폴더를 "D:TEST" 폴더라고 가정하고 설명하겠습니다.

프롬프트창에서 "D:TEST"까지 이동해야 합니다.

d:라고 입력후 엔터합니다. cd test라고 입력후에 엔터합니다.

 

(3) 이제 mkv2vfr에 명령을 내리면 됩니다. 기본 명령은 다음과 같습니다. mkv2vfr input.mkv output.avi

input.mkv에 디먹싱할 mkv파일명을 적고, 저장될 output.avi는 저장될 파일명이니 원하는 대로 적습니다.

만약 파일명에 띄어쓰기가 되어 있는 경우에는 "Test 01.mkv"와 같이 큰따옴표를 적어 주어야 합니다.

저장되는 avi파일에는 H264 비디오 스트림만 들어 있습니다. 아쉽게도 오디오는 mkv2vfr로 디먹싱할 수 없습니다.

 

 

 

참고하세요

MKV, MP4컨테이너는 VFR방식으로 인코딩된 비디오 스트림을 지원하지만, AVI컨테이너는 지원하지 않습니다.

그 차이때문에 MKV, MP4에 들어 있는 vfr로 만들어진 H264 비디오를 빼내어 AVI 컨테이너에 넣었을 때는 싱크가 맞지 않게 됩니다.

VFR 비디오 스트림을 지원하지 않는 AVI 컨테이너 특성때문에 생긴 싱크에러는 컨테이너만 바꾸어서는 해결이 안되고, 재인코딩을 해야만 합니다.

mkv2vfr로 VFR 비디오 스트림을 빼내면 아래 그림처럼 프레임 레이트가 여러개 표시되는 것으로 확인할 수 있습니다.

이런 VFR 비디오 스트림은 주로 일본 만화 영화에서 많이 사용됩니다.

 

 

 

(4) 저장된 avi파일을 미디어 플레이어로 재생시켜 봅니다. 정상적으로 재생되지 않으면 문제가 있는 것입니다.

 

참고하세요

사실 동영상 프로그램들은 내부 충돌이 일어날 가능성이 높은데, 제 컴퓨터 환경에서는 Haali Media Splitter의 최신버전이 설치된 상태에서는 디먹싱하면 결과물이 정상적으로 재생되지 않았습니다.

버전을 바꾸어 테스트했더니 정상적으로 디먹싱되었습니다. 어디서 문제인지는 저도 모르겠습니다.

제가 테스트할때 정상적으로 디먹싱한 버전은 ver. 1.9.42.1 이었습니다.

 

 

 

 

3. 오디오 디먹싱

MKVExtract로 디먹싱하면 됩니다. 1번 동영상에서 설명한 대로 따라 하세요.

 

 

 

 

 

 

STEP 2. 먹싱

 

스텝 1에서 디먹싱하여 비디오만 들어 있는 avi파일과 오디오 파일을 만들었습니다.

비디오 스트림만 들어 있는 avi파일에 오디오 파일을 먹싱시켜 보겠습니다.

먹싱은 VirtualDub으로 해도 되고, AVI-Mux로 해도 되는데, 여기서는 AVI-Muxer로 하겠습니다.

 

 

 

1. ☞ 여기를 클릭하여 AVI-Mux를 다운받습니다. 적당한 곳에 압축을 풀어 놓습니다.

무설치 프로그램이니 "AVIMux_GUI.exe"파일을 더블 클릭하여 실행합니다.

 

 

2. 그림 처럼 "open files" 영역에서 마우스 오른쪽 버튼을 클릭하여 "add"버튼을 클릭합니다.

비디오 스트림만 들어 있는 avi파일을 추가합니다.

탐색기에서 avi 파일을 끌어다가 "open files" 영역에 떨어트려도 됩니다.

 

H264 비디오가 들어간 avi파일을 떨어트렸을 때 에러가 발생하는 것은 비디오 스트림의 index block이 깨진 경우같이 정상적이지 못할때 입니다.

VirtualDub으로 열었을때도 마찬가지로 에러메시지가 표시될 겁니다.

앞에서 말했듯이 컴퓨터에서 Haali Media Splitter를 언인스톨시키고, 제가 올린 파일 mkv2vfr로 다시 해보세요.

그래도 안되면 무언가 내부적인 요인에 의한 것이니, 스스로 찾아야 합니다. 어둠의 길로 들어서게 되는 거죠. 

 

 

 

3. 불러온 avi파일을 더블클릭합니다. 그러면 아래쪽 먹싱될 성분을 나타내는 영역에 비디오가 표시 됩니다.

 

 

 

4. 다시 "open files" 영역에서 스텝 3에서 디먹싱된 "오디오 파일"을 추가합니다.

    비디오와 달리 아래쪽 창에 자동으로 표시됩니다.

참고: avi 컨테이너에도 오디오 스트림을 2개이상 넣을 수 있습니다.

미디어 플레이어에서 먼저 재생될 오디오 파일을 불러온 뒤에, 그 다음 부수적으로 포함시킬 오디오를 불러옵니다.

 

5. Start 버튼을 클릭합니다.

   열리는 창에서 "파일 형식"이 "AVI files (*.avi)"로 되어 있는지 확인합니다.

   적당한 avi파일명을 입력하고 저장합니다.

 

 

 

에러 상황 1

만들어지는 파일이 mkv라면 AVI-Mux GUI에서 오른쪽 아래에 있는 "Setting"버튼을 클릭합니다.

아래 그림처럼 "default output format"을 AVI로 바꾸면 됩니다.

 

 

 

에러 상황 2

싱크가 맞지 않는 경우가 발생하면 오디오파일을 클릭합니다. 그러면 delay창이 활성화됩니다.

미리 미디어 플레이어에서 확인해 보고 적당한 delay값을 찾아 적용시키면 됩니다. 단위는 밀리초입니다.

 

 

 

 

 

 

 

※ 후기

베가스에서 mkv를 지원하지 않습니다.

때문에 베가스에서 지원하는 ts, m2ts, mp4, mov등으로 바꾸면 어떨까 궁금증이 일어났습니다.

일단 mov는 오디오가 스테레오만 지원하는 단점이 있어 배제했습니다.

(mov를 불러올때 화면이 검게 나오는 버그는 베가스 9.0e버전에서는 교정되었습니다.)

 

H.264 비디오를 컨테이너에서 빼내어 ts, m2ts, mp4로 바꾸었을때 컴퓨터로 재생하는데는 아무 문제가 없습니다.

tsMuxer로 만든 ts, m2ts는 파일은 열었을때 베가스가 얼어버리는 현상이 발생했습니다. 제컴만 그런것인지....

H264 비디오는 2 GB가 넘었을때 문제를 일으키니 mkv파일을 2기가씩 잘라내어 mkv 파일을 여러개 만들었습니다.

그것을 다시 Boilsoft Video Joiner를 이용해 이어 붙여 하나의 mp4파일을 만들었습니다.

합쳐진 mp4파일을 베가스 9버전에서 열었을때는 재생이 매끄럽지 않아 편집도 불가능했습니다.

그러나 베가스 10버전에서는 매끄럽게 재생되었고, 프레임을 이동시 얼지않고 정상적으로 이동되었습니다. 따라서 편집도 가능해졌습니다.

 

베가스 10버전을 오늘 처음 사용해봤지만 베가스 9버전에서 열어 저장됬던 sfk파일을 그대로 사용하면 오디오파형이 제대로 보이지 않는 문제가 있었습니다. 지우면 오디오를 불러오는데 시간이 걸리지만 정상적으로 파형이 보이네요.

 

렌더링시간이 무척긴 베가스로 영화 한편을 모두 인코딩하지는 않겠죠.

어차피 일정부분을 때어내어 작업한다면 AVI로 만들어 VirtualDubMod로 자르고 그것을 베가스에 임포팅해 작업을 하는 것도 좋은 선택으로 생각됩니다.

'Development > Multimedia' 카테고리의 다른 글

동영상에서 오디오를 변환하지 않고 빼내기  (0) 2012.06.17
Change audio arrangement without reencoding  (0) 2012.06.17
What DLS is ...  (0) 2009.10.25
Gstreamer example  (0) 2008.07.18
To refer about gstreamer  (0) 2008.05.30
Posted by 까 치
,
윤도현 홈페이지 놀러오세요~~ 가입들도 하시고 ㅋㅋㅋ
www.kpeople.co.kr/~cuteyanda

'XE수다떨기글' 카테고리의 다른 글

잘지내능가 동상..  (0) 2011.01.06
형님 저 머리 했어요. 한번 보세요....  (0) 2010.08.24
일본 아줌마  (0) 2010.04.20
파도타기  (0) 2009.12.14
.....  (0) 2009.12.14
Posted by 까 치
,