Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th December 2006, 21:20   #1  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
SoundOut 1.1.1 - Sound Output Plugin [10/15/07]

SoundOut is a GUI driven sound output module for AviSynth. It has been made because to make sound export easier. It is not meant to replace tools like BeHappy or other advanced audio encoding GUI's, but it is meant to be easy and fast to use.

The filter will probably be included in AviSynth 2.6, but it works nicely with AviSynth 2.5.

Currently the supported file formats are:

* AC3
* MP3
* MP2
* OGG
* WavPack
* FLAC
* Monkey Audio Codec (APE)
* Microsoft WAV format
* Apple/SGI AIFF format
* Sun/NeXT AU format
* RAW PCM data
* Sonic Foundry's 64 bit RIFF/WAV (WAVE64)
* Core Audio File format
* Broadcast Wave Format (BWF)
* Command Line encoding.

Add SoundOut() to your script, where you would like to export audio. A GUI should pop up, when you open your script.

The main GUI window looks like this:


An encoding property window:


It is possible to use SoundOut as an ordinary filter, running inside the script and giving parameters for each output mode. The parameters consists of two things: General Parameters, which can be used for all filters, and filter specific parameters, which gives parameters to the active output module.

Feel free to report problems, requests and comments here.

Code:
Changelist:
v1.1.1
- Downgraded FLAC to v1.2.0, to avoid backwards incompatible 24 bit files.
- Conversion tune-up.
- OverWriteFile set to "No" was not respected.
- Client sample requests shown in GUI.

v1.1.0
- Added WavPack output module.
- Added Sample type selection to WAV Output.
- Updated FLAC to v 1.2.1 - 24 bit/sample seems broken, so only 8 & 16 bit are enabled.
- Fixed bug in FLAC to enable files larger than 2GB.
- FLAC now uses the same GUI as other filters.
- Aften updated.
- Re-enabled Aften multithreading.
- Faster 3DNOW! float to 24 bit conversion.

v1.0.3
- Vorbis, AC3 and MP3 now checks if file can be created.
- Fixed hang in aften on multiprocessor machines.
- Added wait parameter, how many seconds should SoundOut wait on autoclose.
- Avoid lockup if encoder cannot be initialized and set for direct output.
- Fixed OverwriteFile was not always being respected.

v1.0.2
- Updated libaften to rev534.
- Fixed overwriteFile not being recognized in script.
- Fixed crash if mp2 file could not be opened for writing.
- Exit blocked, even if filter is (almost) instantly destroyed, if script is set for output.
- AC3 is now reporting the actual samples encoded (including padding).

v1.0.1
- Updated libaften to rev. 512.
- Added overwriteFile="yes"/"no"/"ask". Default is Ask.

v1.0.0
- The application will not exit, as long as an encode window is open.
- Fixed "nofilename" not being recognized in script.
- LFE no longer overridden by registry, when using GUI.

v0.9.9
- Added ReplayGain calculation to Analyze.
- Parent filters are now blocked, or silent samples are returned, if the filter is currently exporting sound.
- Video is automatically added, if none is present. (black 32x32 RGB32)
- Buttons for export are disabled when output window is open.
- Main window is now minimized when export module is selected.
- Fixed Analyze bug on 16 bit samples.
- Fixed WAVEFORMATEXTENSIBLE channel mapping in Commandline Output.
- AC3 output: LFE option disabled when not relevant.
- AC3 output: LFE option named properly.

v0.9.8
- Added Analyze option to calculate average, maximum and RMS levels. Only available through GUI.
- WAVEFORMATEXTENSIBLE in commandline out attempts to set channel maps based on channel number.
- Fixed thread race issue on very fast encoders.
- Minor GUI tweaks.

v0.9.7
- Added channelmapping to AC3 output.
- Added LFE channel indicator switch to AC3 output.
- GUI now spawned in a new thread, fixing GUI lockup in foobar2000 and similar.
- Fixed general thread race issue, where a fast encoder might lead to incomplete output.
- Fixed WAVE_FORMAT_EXTENSIBLE header without info in CmdLine Output.
- Fixed "Format" not working on Commandline output.
- Fixed Filename dialog not appearing.
- Forced final samplereading to be correct.
- Removed "private" option from MP2 GUI and script, as there is no way to set it via twolame.
- Removed DAB Extensions from MP2 GUI, as TwoLame reports it as not functioning.

v0.9.6
- Added complete script customization.
- Added possibility to set output file from script.
- Added window autoclose option to script.
- Added option to script to disable progress window.
- GUI creates message handle thread.
- Settings are now saved to registry if output filter initializes successfully.
- Updated documentation.

v0.9.5
- Added Broadcast WAVE out.
- Fixed OGG Vorbis support.
- Fixed Text fields not being correctly read.
- Fixed AC3 settings not being restored properly.
- Added: MP2 settings are now saved.

v0.9.4
- Added OGG Vorbis support.
- Added: Parameters stored (on save) and read to registry.
- Added: "No filename needed" option in commandline output, to disable output filename prompt.
- Fixed collision between libaften and libvorbis.
- Updated libaften to rev 257.
- Enabled SSE optimizations in libaften.
- Hopefully fixed issue with commandline executable filename becoming garbled.

v 0.9.3
- Added Commandline piping output.
- Added MP3 / LAME output.
- Fixed AC3 VBR Error sometimes wrongly being displayed.
- Fixed AC3 DRC Setting not being respected.
- Various GUI bugfixes.

v 0.9.2
- Updated AC3 GUI.
- Fixed crash in WAV output.
- More stats during conversion.

v 0.9.1
- Added AC3 Output.
- Extension automatically appended, if none is given.
- Added new parameter handling.
- Fixed last block not being encoded.
- Added WAV peak chunk, as an option.
Download from here: http://klauspost.googlepages.com/SoundOut-1.1.1.zip
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 14th October 2007 at 20:52.
sh0dan is offline   Reply With Quote
Old 31st December 2006, 09:39   #2  |  Link
Kurtnoise
Swallowed in the Sea
 
Kurtnoise's Avatar
 
Join Date: Oct 2002
Location: Aix-en-Provence, France
Posts: 5,183
Sounds good...

Some requests :
  • Add a boolean argument in SoundOut() to enable/disable gui.
  • Add a new argument in SoundOut() to pass command line and codec name.
  • Add an argument to close the gui when process is finished.

Something like:
SoundOut(clip, bool "gui"=false, string "codec"= MP2, string "cmd"=-j )

Don't know if it's doable but it sounds interesting...btw, I'm waiting mp3 and vorbis support.

Last edited by Kurtnoise; 31st December 2006 at 09:44.
Kurtnoise is offline   Reply With Quote
Old 31st December 2006, 11:16   #3  |  Link
buzzqw
HDConvertToX author
 
Join Date: Nov 2003
Location: Cesena,Italy
Posts: 6,552
it is very Very VERY interesting... a way to elimitate bepipe and not only !(not a bad program at all... just for .net..)

a truly excellent work Sh0dan !

i fully agree with Kurtnoise13 about request.. in particular

Quote:
Add a new argument in SoundOut() to pass command line and codec name.
just an information... the resampleaudio/normalize/ssrc fuction how will must used ?

before invoking SoundOut() right ?

thanks again

BHH
__________________
HDConvertToX: your tool for BD backup
MultiX264: The quick gui for x264
AutoMen: The Mencoder GUI
AutoWebM: supporting WebM/VP8
buzzqw is offline   Reply With Quote
Old 31st December 2006, 15:35   #4  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@Kurtnoise13: Good ideas. I have an almost similar plan right now, but implementing codecs with their GUI is first priority. I have to re-do options, since I completely bypass the command-line interface.

Vorbis is next on the list.

@buzzqw: Yes - you have to prepare the sound before invoking the plug-in. I have chosen not to implement features that duplicate AviSynth behaviors (like resampling, channel numbers, etc).

The current to-do list:

* More codecs.
* Store settings in registry, so they are remembered.
* Presets.
* Modify settings from script.
* Make it even easier to use.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 31st December 2006, 21:10   #5  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Sorry by my AviSynth ignorance but after make an avs file like, for instance:

WavSource("d:\test.wav")
ssrc(44100)
SoundOut()

What is the app to open this avs?
tebasuna51 is offline   Reply With Quote
Old 1st January 2007, 13:36   #6  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@tebasuna51: Exactly. You can open it in any application that supports AviSynth - Virtual dub, Media player, etc.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 1st January 2007, 17:03   #7  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Whit:
-VirtualDub 1.6.17:
Error: No video stream found
The dialog window pop up isn't open.

-Media Player Classic (XP):
Pop up window ok, with correct Sound Info.
Click in Save WAV/AIF/CAF
Wav type: Microsoft WAV
Save As... dialog (we must write the extension, isn't added automatically)
Finished...
Result: a wav header without data (correct datalength=0)
the wav header have a subchunk 'fact' correct but unnecessary.
the wav header have a subchunk 'PEAK' not standard, unnecessary and potentially dangerous.

Wav type: MS WAVE with WAVEFORMATEX
Same problems: without data (only header) and unnecessary subchunks 'fact' and 'PEAK'.

Wav type: RAW PCM
Of course the result is a empty file.

Save MP2:
Empty file

Save FLAC:
86 bytes header.

Save APE:
128 bytes file.
tebasuna51 is offline   Reply With Quote
Old 1st January 2007, 17:14   #8  |  Link
foxyshadis
ангел смерти
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Lost
Posts: 9,340
Maybe there's some requirement in MPC (or SoundOut?) to have a blankclip as long as the audio, like virtualdub.
__________________
There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order. ~ Ed Howdershelt
foxyshadis is offline   Reply With Quote
Old 1st January 2007, 18:43   #9  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Same results in mpc with:
Code:
WavSource("D:\test.wav")
AudioDubEx(BlankClip(length=Int(1000*AudioLengthF(last)/Audiorate(last)), width=32, height=32, pixel_type="RGB24", fps=1000), last)
SoundOut()
Now work with VirtualDub, the outputs is only headers but without the undesired subchunks 'fact' and 'PEAK'.

Resume the problems:
- The Save As... dialog don't fill the extension
- The wav headers can vary with the app
- Data empty
- With Media Player Classic: undesired subchunks in header
- With VirtualDub need a video clip
tebasuna51 is offline   Reply With Quote
Old 1st January 2007, 23:00   #10  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@tebasuna51: I cannot reproduce the empty output files. Seems very weird. It must be a crash in the encoder thread. Would it be possible for you to make something I can use to reproduce?

I'll look at the WAV headers. It seems like it is possible to disable the peak header. The auto-extension is also one of the things I'll look at.

This should be enough to add video. Since the video length isn't considered:
Code:
AudioDub(BlankClip(), last)
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 2nd January 2007, 03:58   #11  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Quote:
Originally Posted by sh0dan View Post
@tebasuna51: I cannot reproduce the empty output files. Seems very weird. It must be a crash in the encoder thread. Would it be possible for you to make something I can use to reproduce?
I don't know how make something to reproduce. My test file is very simple, a verified wav file:
Code:
******************************** 02/01/2007
LeeWavBi 1.0 analizando 
el fichero de 11520044 bytes:
D:\Internet\AudioTest\SoundOut\6c_16ip.wav
-------------------------------------------
ChunkID .....: RIFF
ChunkSize ...:  11520036 
Format ......: WAVE
Subchunk1ID .: fmt 
Subchunk1Size:  16 
AudioFormat .:  1        (Integer data)
NumChannels .:  6 
SampleRate ..:  48000 
ByteRate ....:  576000 
BlockAlign ..:  12 
BitsPerSample:  16 
OffsetData ..:  45 
DataLength ..:  11520000 
Duration  ...:  20 sec., (0h. 0m. 20 s.)
-----------------------------------------
You know the avs, tested with/without ssrc() and with only AudioDubEx(BlankClip(), last).
I use AviSynth 2.5.7 RC-3 [Dec 31st] now.
As you can see in this image:

The Sound Info is correct and the Conversion status don't show any error and seems finished ok. The output header is also correct but without data.

Edit: the same problem with stereo wav.
tebasuna51 is offline   Reply With Quote
Old 3rd January 2007, 13:33   #12  |  Link
hanfrunz
Registered User
 
hanfrunz's Avatar
 
Join Date: Feb 2002
Location: Germany
Posts: 534
i am curios and have no avisynth-computer here... what would happen if you shuttle through the video when played back? Is this also saved to the output file? Or does the filter request all frames/samples once and writes them? And where can i find the sourcecode?
hanfrunz is offline   Reply With Quote
Old 3rd January 2007, 14:42   #13  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Quote:
Originally Posted by hanfrunz View Post
what would happen if you shuttle through the video when played back? Is this also saved to the output file? Or does the filter request all frames/samples once and writes them? And where can i find the sourcecode?
I'm not sure if you ask me, but:

If I load in VirtualDub this avs:
Code:
WavSource("D:\Internet\AudioTest\SoundOut\2c_16ip.wav")
AudioDubEx(BlankClip(length=Int(25*AudioLengthF(last)/Audiorate(last)), width=32, height=32, pixel_type="RGB24", fps=25), last)
ssrc(44100)
SoundOut()
forgetting the SoundOut window, and using VirtualDub controls,
the audio is played correctly and with Save As... is saved correctly.
The audio can be extracted (Save wav) from the output video and is exact to input audio but 44100 Hz.
tebasuna51 is offline   Reply With Quote
Old 3rd January 2007, 17:51   #14  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@tebasuna51: I have added some more security and debugging information, but I'm in the middle of adding AC3 and new parameter handling, so I can't release a new version just yet - but I'm definitely looking into the issue.

@hanfrunz: Video should pass through the filter, and encoding is done in two separate threads, so you can export sound while you are encoding, if that's what you'd like.

Source is in the 2.6 branch:

http://avisynth2.cvs.sourceforge.net...v=avisynth_2_6

GUI Resources have been created using a free tool called "resED", so the project can be used with VC 2005 Express.

http://www.radasm.com/projects/projects.html
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 3rd January 2007 at 17:55.
sh0dan is offline   Reply With Quote
Old 4th January 2007, 23:37   #15  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@tebasuna51: I found the bug, while implementing AC3. The last block of samples will never be encoded, so on small samples, that will create 0-byte files, adn others will miss the end.

I still have to do some testing, but I expect a new version some time this weekend.
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 5th January 2007, 03:57   #16  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
Quote:
Originally Posted by sh0dan View Post
@tebasuna51: I found the bug, while implementing AC3. The last block of samples will never be encoded, so on small samples, that will create 0-byte files, adn others will miss the end.
You are right I need samples > 22 sec to obtain output. Thanks for your job, I wait your new version to make more test.
tebasuna51 is offline   Reply With Quote
Old 7th January 2007, 03:55   #17  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
New version uploaded, see first post for changes.

I have not spent much time testing, as I expect a new version soon, but there is AC3 output now (more options coming) and there is a rather large bug-fix to ensure the entire sound is exported.

Edit: There is a crash-bug in WAV-out. I'll release a new version later today, as I'm still implementing new stuff.
__________________
Regards, sh0dan // VoxPod

Last edited by sh0dan; 7th January 2007 at 14:13.
sh0dan is offline   Reply With Quote
Old 7th January 2007, 14:24   #18  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
My first test with small samples works ok. Also the ac3 encode.

About the ac3 parameters I want send you my opinion:

I know Aften have a lot of parameters and is not convenient show all to end user because can be confused.
The expert user always can use Aften in CLI mode to obtain all of features.
The most know ac3 encoder is Sonic Foundry SoftEncode and I want propose a subset of their parameters to be offered to end user of SoundOut:

- BitRate with Auto option, at least in CLI mode this works (always CBR, we need ac3, instead aac, to provide compatibility with DVD and AVI and VBR don't work, let VBR to expert users)

- Dialog Normalization, the default -31 dB is ok but is a important parameter.

- Dolby Surround Mode, only the user can know if the original sound 2.0 is Dolby ProLogic encoded. Parameter requested in Doom9 forum.

- Dynamic Range Compression, or DRC Profile (in test phase in Aften).

Now some preprocessing options:

- DC high-pass filter
- Bandwidth low-pass filter
- LFE low-pass filter
- 90 degree phase shift for surround channels, not yet implemented in Aften (future option)

There are parameters like 'Use block switching' or 'Accurate Bit-Allocation', and others, not directed to end users but for test or developing purpose.
tebasuna51 is offline   Reply With Quote
Old 7th January 2007, 14:42   #19  |  Link
sh0dan
Retired AviSynth Dev ;)
 
sh0dan's Avatar
 
Join Date: Nov 2001
Location: Dark Side of the Moon
Posts: 3,480
@tebasuna51: Great to know. I completely agree with what you say! I haven't spent much time with aften, so I don't know what is important. I basicly took a look at aftenGUI, and copied, what seemed important. So you propose to:

* Remove VBR Option?
* Remove Block switch/accurate bitalloc, and leave it at defaults.
* Add Dialog Normalization.
* Add "Dolby Surround Mode" - is this only relevant for 2 channel audio? What about the "EX" DS Modes - are they important?
* Add BW low-pass filter.
* Are mix-levels important? And why are only -3 to -6 available in aftenGUI?
__________________
Regards, sh0dan // VoxPod
sh0dan is offline   Reply With Quote
Old 7th January 2007, 16:36   #20  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 5,372
* Remove VBR Option?
Yes, or warn isn't compatible with standalone DivX/DVD players (and other PC players)

* Remove Block switch/accurate bitalloc, and leave it at defaults.
Yes, Aften isn't finished yet and these parameters are for test.

* Add Dialog Normalization.
The most important parameter with bitrate and DRC.

* Add "Dolby Surround Mode" - is this only relevant for 2 channel audio? What about the "EX" DS Modes - are they important?
Yes is only for 2.0 but is ignored for other number of channels. If the two channels are obtained by a downmix dpl (there are Avisynth functions to do, see BeHappy) we can activate this flag and decoders (soft or hardware) can read this flag an set automatically to dpl mode (recover FL,FR,C,SL,SR).
Activate the DS "EX" Mode flag mean the Surround Center channel is encoded in SL,SR channels. I don't know any free tool to do so, only know commercial encoders with their proper ac3 encoder, then I think is unnecesary now. Maybe, in the future, we can supply 7 channels to Aften and use this flag.

* Add BW low-pass filter.
Really this 3 filters (DC high-pass, Bandwidth low-pass and LFE low-pass) have similar importance and can be implemented before the encoder but if exist can be used all.

* Are mix-levels important? And why are only -3 to -6 available in aftenGUI?
Mix-levels are only the recommended values if the decoder need make a downmix and want accept the info from the encoder. I can't imagine when we need put other than defaults.
The values are discrete because are encoded in BSI stream with only 2 bits for CenterMixLevel or SurroundMixLevel.
tebasuna51 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 15:21.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.