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 Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st March 2011, 09:09   #1  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
avs2pipe

avs2pipe is a tool to output y4m video, wav audio, dump some info about the
input avs clip or suggest x264 blu-ray encoding settings.

Usage: avs2pipe [audio|video|info|x264] input.avs
audio - output wav extensible format audio to stdout.
video - output yuv4mpeg2 format video to stdout.
info - output information about aviscript clip.
x264bd - suggest x264 arguments for blu-ray disc encoding.


Download:

http://doobrymedia.com/avs2pipe-0.0.3.zip


It simply takes a path to an avs script that returns a clip with audio and/or
video and outputs it as a y4m (--video) or wav (--audio) stream to stdout. It
can also generate information about the clip (--info) in an easily parsable
format for gui's.

The advantage of avs2pipe over other solutions, other than it doing multiple
things in one and supporting more colorspaces is that it links directly with
avisynth.dll via the C interface, so it compiles with both Visual Studio and
MinGW and when used with wine in linux simply requires that the avisynth dll's
are in PATH, so no need to have vfw configured correctly. Also as it uses
WAVE_FORMAT_EXTENSIBLE for wav output and directly takes data from avisynth
it will output exactly the same data as avisynth uses internally.


Source is provided in the src folder and is released under the GPL-3.0.
In addition to the source is:

src\avisynth25 - header and link lib from AviSynth 2.5.8
src\avisynth26 - header from http://git.videolan.org/?p=x264.git;...th_c.h;hb=HEAD
link lib from AviSynth AVS 2.6.0 Alpha 2 [090927]


Projects and scripts to build the source are located in:

vs2010 - Project for Visual Studio 2010 Express
mingw - Batch file MinGW on Windows, sh script for MinGW under Linux


The YUV4MPEG2 output is inspired by Avs2YUV by Loren Merritt, it is basically
the same method, converted from C++ to C. The changes are:

Interlaced Support - Picks up the flags for interlaced content from
AssumeFieldBased(), AssumeTFF() etc. and will pass this
on to programs such as x264 eliminating the need to add
flags to the encoder command.

Extended Color Spaces - Thanks to Chikuzen when compiled against AviSynth 2.6
there is support for a whole host of extra colorspaces.


The WAV output is coded from scratch using specs from "the internet" and so
could be full of problems, altho I have not found any in testing yet.



Examples:

avs2pipe info input.avs
avs2pipe info input.avs > info.txt

avs2pipe video input.avs | x264 --stdin y4m - --output video.h264
avs2pipe audio input.avs | neroAacEnc -q 0.25 -if - -of audio.aac

avs2pipe audio input.avs > output.wav


Included Binaries:

avs2pipe_gcc.exe - compiled with MinGW gcc 4.5.2 on Windows
avs2pipe_vs.exe - compiled with Visual Studio 2010 Express cl 16.00.30319.01

avs2pipe26_gcc.exe - gcc compiled for AviSynth 2.6 Alpha 2
avs2pipe26_vs.exe - VS2010 compiled for AviSynth 2.6 Alpha 2


Changes:

Version 0.0.3 - Added Blu-Ray x264 command generator based on specs from
http://sites.google.com/site/x264bluray/
Added Support for new Colorspaces in AviSynth 2.6 with code
written by Chikuzen
Version 0.0.2 - Added Support for Interlaced Output, AssumeFieldBased etc.
Version 0.0.1 - Removed Progress Output for "Speed"
Pre-Alpha - Initial Release on doom10.org


Forum Links:

Original - http://doom10.org/index.php?topic=759
Doom9 Continuation - http://forum.doom9.org/showthread.php?t=160383

---

Hi,

Last year I wrote a little program called avs2pipe which combines avs2yuv and wav output into a single program.

The main advantage over the current solutions, and the reason I wrote it, is that it is in C and so can be compiled with gcc (mingw) under linux, or visual studio, and when used in a "wine" environment just requires the avisynth dlls to operate.

However I abandoned it as it worked for my task and no one really seemed that interested, but I just found people refering to it on google, so...

Is there anyone who would be interested in a newer build with the logging removed / optional to increase speed?

Last edited by doobry; 4th April 2011 at 18:12. Reason: New Version
doobry is offline   Reply With Quote
Old 31st March 2011, 10:55   #2  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by doobry View Post
Is there anyone who would be interested in a newer build with the logging removed / optional to increase speed?
Yes, of course

Because you did not reply to Underground78 for a long time, I thought that you had stopped that work.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 31st March 2011, 12:20   #3  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
i am interested too..
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note...
Visit The Land Of Dracula (Romania - EU)!
b66pak is offline   Reply With Quote
Old 31st March 2011, 18:47   #4  |  Link
space1999
Banned
 
Join Date: Mar 2011
Posts: 37
I am interested too (+1)

BTW, does it already support channel-mapping AND "100%-compliant" Wave-Format-Extensible info? Because sometimes I have to use sox.exe for correcting the outputs from wavi.exe...
space1999 is offline   Reply With Quote
Old 31st March 2011, 19:19   #5  |  Link
smok3
brontosaurusrex
 
smok3's Avatar
 
Join Date: Oct 2001
Posts: 2,392
would be interested in ubuntu and especially OSX version.
smok3 is offline   Reply With Quote
Old 31st March 2011, 23:05   #6  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
ok i'll pull out the sources from my dead projects and get it checked and uploaded tomorrow.

as for the channel mapping, at the moment it doesn't remap any channels, but i wrote the wav output from scratch using the specs I found on the internet, so it should be "100%-compliant Wave-Format-Extensible", the urls for the specs should be in comments in the source, so if i can work out channel mapping it will not be hard to add it, the main challenge would be parsing the command line options, as the current method simply matches the first argument.

as for ubuntu and mac os x, assuming you have a working wine install, it should just work... you would only need mingw if you wanted to compile it yourself.
doobry is offline   Reply With Quote
Old 1st April 2011, 03:00   #7  |  Link
tebasuna51
Moderator
 
tebasuna51's Avatar
 
Join Date: Feb 2005
Location: Spain
Posts: 6,890
A program like this don't need make channel mapping.
The channel mapping is a encoder/decoder job. There are enough AviSinth audio decoders than work fine.

@space1999
wavi works fine, maybe is a decoder problem, can you put some sample.
__________________
BeHappy, AviSynth audio transcoder.
tebasuna51 is offline   Reply With Quote
Old 1st April 2011, 03:59   #8  |  Link
space1999
Banned
 
Join Date: Mar 2011
Posts: 37
@tebasuna51

This is really weird, but I swear, some weeks ago, Media Player Classic refused to play a 3.0 WAV file written by wavi, but today, the same file is accepted fine,


Anyway, here goes an example of the difference between the WAVs outputted by wavi and the WAVs rewritten by sox:

Code:
from wavi:

52 49 46 46 3C 61 52 01 57 41 56 45 66 6D 74 20
28 00 00 00 FE FF 03 00 80 BB 00 00 00 65 04 00
06 00 10 00 16 00 10 00 07 00 00 00 01 00 00 00
00 00 10 00 00 80 AA 00 00 38 71 9B 64 61 74 61
00 61 52 01 00 00 00 00 00 00 00 00 00 00 00 00

from sox:

52 49 46 46 3C 61 52 01 57 41 56 45 66 6D 74 20
28 00 00 00 FE FF 03 00 80 BB 00 00 00 65 04 00
06 00 10 00 16 00 10 00 00 00 00 00 01 00 00 00
00 00 10 00 80 00 00 AA 00 38 9B 71 66 61 63 74
04 00 00 00 80 65 38 00 64 61 74 61 00 61 52 01
space1999 is offline   Reply With Quote
Old 1st April 2011, 08:17   #9  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
@tebasuna51

the initial problem that I had was that all the audio 2 pipe type programs for avisynth did not "work fine", all the ones I could find were just vfw programs, or are written in .NET etc, which for me under wine was causing problems.

avs2pipe directly links with the avisynth.dll which solved me a lot of problems under linux and gives direct access to any avisynth stuff. As far as I can tell wavi etc just use vfw and so have no real idea about avisynth at all.

as for the channel mask, the support is "already" in there, it just sets the mask to 0 at the moment, so i could add wavi style support of just specifying the mask as an int at the command line, but that seems a little user unfriendly. a suggestion for how it should work from a users point of view is welcome. i could for example let people specify a variable in the avs script and pull it out.


@space1999

one of them programs is using a different endianness to the other for the subformat waveex field, which means one of them probably has a mistake in it.

next post should be the same thing as was on doom10, but without progress reporting...

Last edited by doobry; 1st April 2011 at 08:28.
doobry is offline   Reply With Quote
Old 1st April 2011, 09:11   #10  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
Here is the zip file with the source, updated visual studio project files, a batch script to build it on windows using mingw and two pre built binaries...

http://doobrymedia.com/avs2pipe-0.0.1.zip

Comments and suggestions are more than welcome.

@tebasuna51

if you could have a look at the source for anything stupid I'd be grateful, the wav handling is mostly in wave.c and wave.h and is pretty heavily commented as I was trying to work it all out from the specs.
doobry is offline   Reply With Quote
Old 1st April 2011, 13:33   #11  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
Code:
from wavi:

52 49 46 46 3C 61 52 01 57 41 56 45 66 6D 74 20
28 00 00 00 FE FF 03 00 80 BB 00 00 00 65 04 00
06 00 10 00 16 00 10 00 07 00 00 00 01 00 00 00
00 00 10 00 00 80 AA 00 00 38 71 9B 64 61 74 61
00 61 52 01 00 00 00 00 00 00 00 00 00 00 00 00

from sox:

52 49 46 46 3C 61 52 01 57 41 56 45 66 6D 74 20
28 00 00 00 FE FF 03 00 80 BB 00 00 00 65 04 00
06 00 10 00 16 00 10 00 00 00 00 00 01 00 00 00
00 00 10 00 80 00 00 AA 00 38 9B 71 66 61 63 74
04 00 00 00 80 65 38 00 64 61 74 61 00 61 52 01
Had a little look into this, and avs2pipe matches the endianess of sox, (80 00 00 AA...) so i'm guessing that there is a problem with wavi (00 80 AA 00...), or that myself and sox got it wrong.

Grabbed a sample from http://www-mmsp.ece.mcgill.ca/docume...E/Samples.html and it matches sox and myself, the endianess I think can be architecture specific, but as everything is running on x86/x64 I believe they should match.

Last edited by doobry; 1st April 2011 at 17:11.
doobry is offline   Reply With Quote
Old 1st April 2011, 13:34   #12  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
It seems that ver 0.0.1 is only support YUV420 on video.
Do you have any schedule for supporting other colorspaces (YUV422/YUV444) and latest YUV4MPEG2 format?
__________________
my repositories

Last edited by Chikuzen; 1st April 2011 at 13:59.
Chikuzen is offline   Reply With Quote
Old 1st April 2011, 13:40   #13  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
@Chikuzen

I have no schedule for supporting other colourspaces, as I have nothing to test against, i.e. samples, encoders, players, and have not seen the YUV4MPEG2 specs. However I'm more than willing to have a go at adding it if someone comes up with a way for me to test it, and some specs.

At the moment it simply adds a ConvertToYV12 filter to anything that is not YV12.

FYI, a quick google turned up http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 is that what you mean by the new format?

Update: I've had a play and avisynth 2.58 doesn't support YUV422/YUV444 so I assume you are using 2.6, and if so where did you get it, and can you give me a link to the sources.

Last edited by doobry; 1st April 2011 at 17:12.
doobry is offline   Reply With Quote
Old 1st April 2011, 13:57   #14  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
Quote:
Originally Posted by doobry View Post
FYI, a quick google turned up http://wiki.multimedia.cx/index.php?title=YUV4MPEG2 is that what you mean by the new format?
I think that latest format is this.
and you will be able to test about YUV422 by using rawsource.dll .
http://forum.doom9.org/showthread.ph...66#post1470266
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 1st April 2011, 14:17   #15  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
@Chikuzen

What version of avisynth are you using? and if its 2.6 can you point me to the source code.

Last edited by doobry; 1st April 2011 at 17:12.
doobry is offline   Reply With Quote
Old 1st April 2011, 14:31   #16  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
I'm using 2.6.0alpha2(x86) now. http://forum.doom9.org/showthread.php?t=149113
but that RawSource.dll is for 2.5.
2.6.0alpha is completely compatible with 2.5.6 or later.

If you want to develop for 2.6 or later, then see manao's code.
http://forum.doom9.org/showpost.php?...&postcount=473
it includes 2.6 header file.
__________________
my repositories

Last edited by Chikuzen; 1st April 2011 at 14:40.
Chikuzen is offline   Reply With Quote
Old 1st April 2011, 14:48   #17  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
From what I can tell avisynth 2.5 does not support YUV422/YUV444 colourspaces, so if i add support for them it will have to be for 2.6 only.

Had a look at the rawsource source code, and it seems to "mangle" for want of a better word the input into one of the 2.5 supported formats.

I'm not sure exactly what your requirement is, I assume you want to be able to output YUV422 video from avisynth and have avs2pipe provide it as YUV4MPEG2 output without any conversion? If that is the case could you provide me with a small sample of your input YUV4MPEG2 and avs script so I can have a play with it.

Thanks for the header link, but I need the c header avisynth_c.h and the .lib to link with, really I'd like to track down the cvs people are using, but the sourceforge one seems stale, and it seems 2.6 is mostly passed about via forum links to random hosts, which is not good if i'm trying to develop against it.

Last edited by doobry; 1st April 2011 at 14:51.
doobry is offline   Reply With Quote
Old 1st April 2011, 15:16   #18  |  Link
Chikuzen
typo lover
 
Chikuzen's Avatar
 
Join Date: May 2009
Posts: 595
ah, i understood what you say.
I must study how to write the code that convert YUY2 to Planar YUV422.
__________________
my repositories
Chikuzen is offline   Reply With Quote
Old 1st April 2011, 15:34   #19  |  Link
doobry
Totally Clueless
 
doobry's Avatar
 
Join Date: Nov 2010
Location: Edinburgh, UK
Posts: 31
I'm pretty much willing to add any support that people want, provided I can do it, all I really need is a test case and samples so I can make sure it works.

Personally I don't have any current use for anything other than 420 as I've only got DVD / BluRay sources, but I can see how it could be useful, so I'm willing to stick it on the todo list and add some macro's to enable 2.5 & 2.6 builds. Altho in this case I'm kinda stuck without an updated C interface that has support for the colourspaces.

However this has all caused me to add interlaced video support to the YUV4MPEG2 header, which I'm testing now, means I can convert interlaced mpeg2 to interlaced h264 without specifing extra options to x264.

PS. When you learn how to "convert YUY2 to Planar YUV422" please share the info with me, I'm clueless on these formats.
doobry is offline   Reply With Quote
Old 1st April 2011, 16:29   #20  |  Link
Gavino
Avisynth language lover
 
Join Date: Dec 2007
Location: Spain
Posts: 3,431
Quote:
Originally Posted by doobry View Post
Thanks for the header link, but I need the c header avisynth_c.h and the .lib to link with, really I'd like to track down the cvs people are using, but the sourceforge one seems stale
Do you mean this? It looks active to me.
http://avisynth2.cvs.sourceforge.net...nth2/avisynth/

Quote:
and it seems 2.6 is mostly passed about via forum links to random hosts, which is not good if i'm trying to develop against it.
I don't know what forum links you are referring to.
Chikuzen posted the link to the current 2.6 release (see above).
Perhaps you are thinking about the various unofficial MT builds floating around.
__________________
GScript and GRunT - complex Avisynth scripting made easier
Gavino is offline   Reply With Quote
Reply

Tags
avs2pipe

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 - 2024, vBulletin Solutions Inc.