Log in

View Full Version : VC-1 Encoder SDK - Professional released


Pages : 1 2 3 [4] 5

Sagittaire
19th February 2009, 20:36
Anyway multithread mode don't work ...

zambelli
19th February 2009, 21:10
@sagittarie

You need to enter a decimal number for the affinity so try:

-threads 2 -affinity -3
or
-threads 2 -affinity -2
or
-threads 2 -affinity -1
or
-threads 2 -affinity -0

That about all the ideas I have... Good Luck.
Correct. Setting the number of threads also requires an affinity mask. If you set the affinity mask to 0, that will instruct the encoder to leave the thread affinitization to the OS.

This should therefore work:
-threads 2 -affinity 0


On a more general note... The sample code that shipped with the SDK is really just that: sample code. If you guys want to make it into a functional utility, somebody needs to implement better parameter parsing, range checking, compatibility checking, etc. ASF muxing could also be enhanced, as well as muxing to non-ASF formats. Finally, audio encoding would be easy to add for somebody with DirectShow or WMF SDK dev knowledge.

If anybody is interested in doing this work, ping me privately and I can help you better understand the SDK.

zambelli
19th February 2009, 21:18
Interesting. If I just switch -profiletype to 2, I fail with a -20 instead of a -30, but I still fail. There's probably a clue in there.

Darn it, I guess I'll have to file a bug on my own product :)
It's unlikely to be a bug on the VC-1 Encoder SDK itself. Simple and Main profile encoding was well tested. It's more likely a bug in the sample code, which wouldn't be all that surprising since its purpose is primarily to demonstrate how to write an encoding app - and not to actually be the encoding app.

Sagittaire
20th February 2009, 00:24
Correct. Setting the number of threads also requires an affinity mask. If you set the affinity mask to 0, that will instruct the encoder to leave the thread affinitization to the OS.

This should therefore work:
-threads 2 -affinity 0



... don't work. I use all possible combinaison with my c2d ... and multithred don't work here.

Comatose
23rd February 2009, 16:42
Can't get it to work... tried encoding a 24000/1001 Blackness clip with Sagittaire's bat (copypasted) and I get error -90.

NorthPole
24th February 2009, 14:25
Ok here is a new build v0.5...

http://www.mediafire.com/?dcx3lmtygu8

Fixed the quantization problem.

I tried these option and they worked.

-adaptivequant 5 -dquantoption 2 -dquantpstrength 2 -dquantbstrength 0
-adaptivequant 1 -dquantoption 3 -dquantpstrength 2 -dquantbstrength 2

Still working on the thread bug...

Also update the command line help

@comatose

Download this updated version. All the command line switches work with this fixed version.

Currently, I can only get this version to work with 2 channel audio sources because the encoder requires wavextensible formatted input for 5.1, etc (which avisynth can't do correctly). Therefore, you can create a wmv with 2 channels audio by using a valid 2 channel prx (profile) file.
For 5.1 wma audio, you can use zambelli's command line script with a valid 5.1 wav file or 5.1 wavepack file. For > 4GB wav files you can use soundout to generate a intermediate 5.1 wavepack file then send it into zambelli's command line script.
There is still a bug in the framerate for the asf container that I haven't had a change to look at yet. So to mux a vc-1 es and a 5.1 wma, use tsmuxer to put the video vc-1 es into a transport stream. Then use elecards asfmuxer to mux the ts video only into a asf container. Finally, use windows media stream editor to put the asf video and 5.1 wma together into a valid wmv file.

buzzqw
24th February 2009, 15:17
would be possible to implement direct audio encoding, without using prx profile ? (like using -a_codec , -a_bitrate ...)

thanks!

BHH

NorthPole
24th February 2009, 17:13
would be possible to implement direct audio encoding, without using prx profile ? (like using -a_codec , -a_bitrate ...)

thanks!

BHH

Yep, I'm hoping to get to that point.... sometime. Still learning

buzzqw
24th February 2009, 17:23
thanks for your work NorthPole!

BHH

zambelli
3rd March 2009, 02:38
There is still a bug in the framerate for the asf container that I haven't had a change to look at yet.
Yeah, that's a known issue with the SDK sample code - it forgot to set a few key properties on the ASF Writer. I can help you out with that. You have my work e-mail now so just shoot me an e-mail anytime.

would be possible to implement direct audio encoding, without using prx profile ? (like using -a_codec , -a_bitrate ...)
NorthPole: You'll want to take a look at these docs - http://msdn.microsoft.com/en-us/library/bb288699(VS.85).aspx. You can talk to the WMA codecs directly and just pass compressed audio samples into the ASF Writer, like with VC-1 samples.

ss3
10th March 2009, 01:57
It's unlikely to be a bug on the VC-1 Encoder SDK itself. Simple and Main profile encoding was well tested. It's more likely a bug in the sample code, which wouldn't be all that surprising since its purpose is primarily to demonstrate how to write an encoding app - and not to actually be the encoding app.

Bump!

Lyris
14th March 2009, 12:14
Apologies if it's been posted, but I can't find this on search:
I'm attempting to use AVS2ASF to generate a VC1 stream for use in Blu-ray Disc authoring (tests).

Everything I encode stutters badly. The encoder codes all the frames I ask it to, but something goes wrong on playback.
Anyone else having this issue? I've looked at all the options but can't find a fix.

My source:
.AVS Script, YV12, 1920x1080, 23.976fps.

My command:
avs2asf -i bbb.avs -o bbb.vc1 -framerate 23.976 -rate 35000 -peakrate 39800 -ratecontrol 3 -complexity 5 -profiletype 2 -bframes 2 -maxkeydist 6 -vbv 300000 -videotype 0 -threads 4

The stutter occurs in PowerDVD for Windows, as well as on Sony BDP-S5000ES hardware player that I have here for review.

benwaggoner
14th March 2009, 16:47
Apologies if it's been posted, but I can't find this on search:
I'm attempting to use AVS2ASF to generate a VC1 stream for use in Blu-ray Disc authoring (tests).

Everything I encode stutters badly. The encoder codes all the frames I ask it to, but something goes wrong on playback.
Anyone else having this issue? I've looked at all the options but can't find a fix.

My source:
.AVS Script, YV12, 1920x1080, 23.976fps.

My command:
avs2asf -i bbb.avs -o bbb.vc1 -framerate 23.976 -rate 35000 -peakrate 39800 -ratecontrol 3 -complexity 5 -profiletype 2 -bframes 2 -maxkeydist 6 -vbv 300000 -videotype 0 -threads 4

The stutter occurs in PowerDVD for Windows, as well as on Sony BDP-S5000ES hardware player that I have here for review.
What did you use to mux the .vc1 into a BD image?

FWIW, Complexity 5 is going to be very slow overkill for HD at those rates. 3 would robably be every bit as good.

Sagittaire
14th March 2009, 16:58
Apologies if it's been posted, but I can't find this on search:
I'm attempting to use AVS2ASF to generate a VC1 stream for use in Blu-ray Disc authoring (tests).

Everything I encode stutters badly. The encoder codes all the frames I ask it to, but something goes wrong on playback.
Anyone else having this issue? I've looked at all the options but can't find a fix.

My source:
.AVS Script, YV12, 1920x1080, 23.976fps.

My command:
avs2asf -i bbb.avs -o bbb.vc1 -framerate 23.976 -rate 35000 -peakrate 39800 -ratecontrol 3 -complexity 5 -profiletype 2 -bframes 2 -maxkeydist 6 -vbv 300000 -videotype 0 -threads 4

The stutter occurs in PowerDVD for Windows, as well as on Sony BDP-S5000ES hardware player that I have here for review.

Your profil is simply bad ...

thread 4 work for you ... ???

Lyris
15th March 2009, 21:37
Ben, thanks for your input. It was a trial version of Netblender DoStudio. Can't afford Scenarist at the moment, sadly.

Does the "Complexity" setting affect compatibility at all? Or is this purely a setting that defines the encode process? I'll try lowering it and report back.

Sagittaire: not totally sure how I would test this - would Windows Task Manager's 4 CPU indicaters show it? (I've just had to reinstall everything, so will heck this out soon).

Lyris
16th March 2009, 06:50
Changing the complexity didn't help, but changing the -maxkeydist to 24 did - not sure why I had it set to 14, maybe an early morning typo :)

Sagittaire
16th March 2009, 08:02
Changing the complexity didn't help, but changing the -maxkeydist to 24 did - not sure why I had it set to 14, maybe an early morning typo :)

-maxkeydist use second for unity. BD profil use maxgop at 24 frame if you use maxbitrate > 15 Mbps. Here good BD profil:

@REM -----------------------------------------------------------
@REM
@REM Profil BluRay 1080p23.976 2 passes extra high quality
@REM
@REM -----------------------------------------------------------


@REM Source file name (suffit de mettre la source ici)
set E_SRC=HDDVD.avs

@REM Set of bitrates (ici le bitrate)
set E_BR=12000

@REM Set of max bitrates (ici le bitrate max)
set MAX_BR=40000

@REM Set of Buffer (ici le buffer)
set BUF_BR=3750000

@REM Profil (ici le nom des fichiers de sortie)
AVS2ASF.exe -i %E_SRC% -o azerty.vc1 -rate %E_BR% -peakrate %MAX_BR% -vbv %BUF_BR% -framerate 23.976 -ratecontrol 3 -profiletype 2 -maxkeydist 24 -bframes 1 -adaptiveGOP -inloop 1 -overlap 0 -complexity 4 -motionsearchlevel 2 -mesearchmethod 1 -mbcost 1 -mvcost 1 -mvrange 4 -adaptivequant 1 -threads 1
pause

ACrowley
16th March 2009, 10:22
I get a Error with this Profile

Encoding in ES (Elementry Stream) mode

Failure in CVC1EncASF::set_advancedProps
error = -30
Failure in CVC1EncASF::Init
hr = 0
VC1 SDK Error = -30

Final error code: -30


And why -thread 1 ? Are there still Problmes with more Threads ?

Bframes 1 ? For example Mainconcept Reference use 3 bframes for the VC1 Bluray Profile

Sagittaire
16th March 2009, 18:24
I get a Error with this Profile

strange ... work for me.
It's compliant BD profil.


And why -thread 1 ? Are there still Problmes with more Threads ?

Multithread don't work for me with c2d and winXP.



Bframes 1 ? For example Mainconcept Reference use 3 bframes for the VC1 Bluray Profile

More is not always better:

1) Even for really advanced codec like x264 more than 1 bframe don't improve quality with large margin. In most case more than 3 bframe with x264 is completely useless and codec will use in most case only 1 bframe.

2) 7 bframes is compliant with BD. Anyway VC1 SDK implementation from MS don't use adaptative bframe. For me 1 bframe produce the best visual result. 3 no adaptive bframe is not good for quality in general case.

benwaggoner
17th March 2009, 19:35
Multithread don't work for me with c2d and winXP.
What happens when you use it?

We've got plenty of companies shipping the SDK on multicore XP (both Pro and Embedded) boxes and we haven't had any complaints about multithreading now working.

1) Even for really advanced codec like x264 more than 1 bframe don't improve quality with large margin. In most case more than 3 bframe with x264 is completely useless and codec will use in most case only 1 bframe.
For film/video source, 1 B-Frame is almost always optimal for VC-1.

2) 7 bframes is compliant with BD. Anyway VC1 SDK implementation from MS don't use adaptative bframe. For me 1 bframe produce the best visual result. 3 no adaptive bframe is not good for quality in general case.
Actually, I thought BD was limited to 3 B-frames; HD DVD could do the full 7.

Also, I should mention there's some B-Frame scalability in the decoder; it'll turn off B-frames during fades in order to get intensity compensation, and will insert BI frames at flashes. It's just the default B-frame pattern itself doesn't change.

timna
19th March 2009, 20:46
I am trying to develop real-time live stream application using VC-1 SDK with Vista 32bit VS2005.

After doing a bit of research, I thought doing main profile would be a good idea for start. So here I am, trying to figure out how to configure CVC1Encoder.

However, no matter what I configure with it (for main profile), it always returns 'ERR_INVALIDSETTING'.

Here is example setting that I am doing. Someone who has any success in this can perhaps help me.

// Create the VC-1 encoder class.
m_pEncoder = new CVC1Encoder;

CONFIG_PROPERTIES config;
ZeroMemory(&config, sizeof(CONFIG_PROPERTIES));

config.dBitRate = 800;
config.dwComplexityLevel = 2;
config.dwQP = 20;
config.dFrameRate = 30;
config.bInterlacedSource = FALSE;
config.dwMaxKeyFrameDistance = 10;
config.dwMaxHeight = 240;
config.dwMaxWidth = 320;
config.dwNumOfBFrames = 1;
config.dPeakBitRate = 1200;
config.dwProfile = 1;
config.dwRateControlMode = 0;
config.dwVBVBufferInBytes = 3000000;

DWORD code = m_pEncoder->Configure(config);

I thought that perhaps it is a problem with my VC++ project setting or some sort so I set this right into AVI2ASF sample, still same error pops out.

timna
23rd April 2009, 00:53
I was able to solve the problem by getting help from Alex.

The problem is that for CBR case dPeakBitRate needs to be set to 0 and dFrameRate is double that for 15 fps it need to be as 10000000/666666. dwQP was set to 60 since it was not in seconds but in frames. dwVBVBufferInBytes was set to dBitRate/8*1000*seconds (where seconds time for buffer).

The real-time quality for VC-1 is stunning. With only using 50KB or less for bandwidth, it was producing great pictures for me.

I hope this helps.

DrBonzo
12th May 2009, 19:16
Someone was asking for a GUI for this encoder - here's one:

http://extranet.spitzinc.com/download/public/misc/VC123.zip

This is a Visual Studio '08 project that uses MFC. It's basically AVI2ASF plus a big dumb dialog for all the parameters. This is a work in progress on the way to becoming a fairly narrow-purpose in-house tool, but others might find it useful for experimenting with the VC-1 encoder. I've left a pre-built executable in the Release folder for anyone without an IDE.

Read UsageNotes.txt

I'd be happy to entertain suggestions for improvement, but can't promise to implement anything . . .

b66pak
12th May 2009, 19:41
thanks...
_

benwaggoner
13th May 2009, 05:18
Someone was asking for a GUI for this encoder - here's one:

http://extranet.spitzinc.com/download/public/misc/VC123.zip

This is a Visual Studio '08 project that uses MFC. It's basically AVI2ASF plus a big dumb dialog for all the parameters. This is a work in progress on the way to becoming a fairly narrow-purpose in-house tool, but others might find it useful for experimenting with the VC-1 encoder. I've left a pre-built executable in the Release folder for anyone without an IDE.
Very cool!

I suppose zambelli and I should start offering suggestions for how to constrain the options so that it doesn't let you do illegal combinations...

DrBonzo
13th May 2009, 12:57
Very cool!

I suppose zambelli and I should start offering suggestions for how to constrain the options so that it doesn't let you do illegal combinations...

That would be great. For me, the hardest thing about working with the SDK is the minimal information I get from the error returns. I've tried to incorporate as much info from the docs as I can about parameter limits and such, but there's clearly a lot of cross-dependencies that either aren't documented or that I've missed. If only the settings validation source code from the encoder could be released . . .

benwaggoner
13th May 2009, 15:09
That would be great. For me, the hardest thing about working with the SDK is the minimal information I get from the error returns. I've tried to incorporate as much info from the docs as I can about parameter limits and such, but there's clearly a lot of cross-dependencies that either aren't documented or that I've missed. If only the settings validation source code from the encoder could be released . . .
Well, first off, if you have any active questions, ask away.

DrBonzo
26th May 2009, 17:34
Well, first off, if you have any active questions, ask away.

Well, OK. Here's a couple:

First, here's a set of parameters that gives an ERR_INVALIDSETTINGS from Configure(..):

interlaced "0"
lbpresent "0"
lookahead "1"
adaptivegop "1"
tff "0"
rff "0"
denoise "0"
inloop "0"
median "0"
overlap "0"
noiseedge "0"
closedentrypt "1"
allowinvalid "1"
rate "12000.00"
framerate "30.00"
peakrate "1.00"
complexity "3"
qp "31"
maxkeydist "30"
bframes "1"
profiletype "2"
ratecontrol "0"
vbv "1500000"
deltamvrange "0"
mbcost "0"
motionsearchlevel "2"
mesearchmethod "0"
mvcost "0"
mvrange "0"
adaptivequant "0"
dquantbstrength "0"
dquantpstrength "0"
dquantoption "0"
bdeltaqp "1"
dh "1920"
dw "1920"
eh "1920"
ew "1920"
keypop "0"
threads "1"
affinity "0"
videotype "0"
outmode "0"
i "Z:\ScidomeHD\BlackHoles_Trailer\1920x1920_Source\BH_Trailer_1920_Lagarith_NoAudio.avi"
o "Z:\ScidomeHD\BlackHoles_Trailer\1920x1920_Source\BH_Trailer_1920_Lagarith_NoAudio.wmv"
pr "C:\devSpace\VC123\SciDomeAudio.prx"

The encoder seems to think it's Configure(..)ed anyway, though, and is willing to continue. A more serious and puzzling problem is the following:

The input is a 2100 frame 1920x1920 clip. At the end of the encode loop, GetWriterStatistics(..) reports that there were a total of 2100 frames, but only 89 coded. A little additional instrumentation in the loop showed that there were a total of 2011 ERR_NO_OP_FRAMEs with 2002 consecutive and 9 flushed in CVC1EncASF::FlushVideo(). The output file plays fine, but it appears to be only the first 3 seconds of the input, consistent with the number of reported coded frames. CVC1Encoder::EncodeFrame(..) reports no errors other than ERR_NO_OP_FRAME.

I'm sort of clueless about what else to look for. Any ideas?

benwaggoner
26th May 2009, 17:57
Well, OK. Here's a couple:

First, here's a set of parameters that gives an ERR_INVALIDSETTINGS from Configure(..):

...
peakrate "1.00"
...

The input is a 2100 frame 1920x1920 clip. At the end of the encode loop, GetWriterStatistics(..) reports that there were a total of 2100 frames, but only 89 coded. A little additional instrumentation in the loop showed that there were a total of 2011 ERR_NO_OP_FRAMEs with 2002 consecutive and 9 flushed in CVC1EncASF::FlushVideo(). The output file plays fine, but it appears to be only the first 3 seconds of the input, consistent with the number of reported coded frames. CVC1Encoder::EncodeFrame(..) reports no errors other than ERR_NO_OP_FRAME.

I'm sort of clueless about what else to look for. Any ideas?
It's not supposed to matter as you're doing a CBR encode, but your peak bitrate is set to 1 Kbps. The behavior you're seeing would be compatible with the encoder just being able to give you a few QP31 frames at that bitrate.

Perhaps try setting it to the same as your bitrate, or just don't set it?

DrBonzo
27th May 2009, 14:26
It's not supposed to matter as you're doing a CBR encode, but your peak bitrate is set to 1 Kbps. The behavior you're seeing would be compatible with the encoder just being able to give you a few QP31 frames at that bitrate.

Perhaps try setting it to the same as your bitrate, or just don't set it?

Thanks, Ben.

Yes, setting the peak rate = bit rate made everything work, though I still get the ERR_INVALIDSETTINGS. Since peak rate is part of the struct that gets sent to Configure, not setting it would not seem to be an option, but if I make it 0, the ERR_INVALIDSETTINGS goes away (?!) and the encode seems to work (it's still running). I guess the lesson is to make peak rate zero in the GUI for all but peak-constrained VBR.

I don't understand the peak rate / QP relation - could you offer a line or two of explanation? Actually I don't understand what QP is at all - maybe you've got a pointer to a fuller doc?

benwaggoner
27th May 2009, 14:47
Yes, setting the peak rate = bit rate made everything work, though I still get the ERR_INVALIDSETTINGS. Since peak rate is part of the struct that gets sent to Configure, not setting it would not seem to be an option, but if I make it 0, the ERR_INVALIDSETTINGS goes away (?!) and the encode seems to work (it's still running). I guess the lesson is to make peak rate zero in the GUI for all but peak-constrained VBR.
Cool. Glad that's working.

You might want to take a look with WMSnoop to make sure your output is what you think it should be.

I don't understand the peak rate / QP relation - could you offer a line or two of explanation? Actually I don't understand what QP is at all - maybe you've got a pointer to a fuller doc?
QP=Quantization Parameter. Higher QP is higher quantization, hence more compressed and lower quality.

When you set buffer, that determines the maximum bitrate for any section of the video.

QP sets the maximum compression per frame.

Both constraints will be honored, with frames being dropped as needed. So, using lower QP values mean that minimum quality for a frame goes up, but frames are more likely to be dropped in order to maintain the buffer.

Generally QP=31 is the appropriate default, since dropped frames are really annoying. For typical content, bitrates, and frame sizes, you're not likely to get to QP 31 even once in a file. Your file is probably all QP 31, since you were encoding at 1 Kbps :).

Midzuki
27th May 2009, 15:24
Someone was asking for a GUI for this encoder - here's one:

http://extranet.spitzinc.com/download/public/misc/VC123.zip


You forgot to mention that VC123.exe requires the annoying MSVC9 dlls, which I do not intend to install on my PC.

DrBonzo
27th May 2009, 15:50
You forgot to mention that VC123.exe requires the annoying MSVC9 dlls, which I do not intend to install on my PC.

Yeah, sorry. I sympathize, but that's the way it builds on my machine. Worse, it wants MFC dlls, too.

It's probably possible to use alternate C libs, but you'd have to build from source & finesse the MFC stuff too...

DrBonzo
28th May 2009, 15:31
You forgot to mention that VC123.exe requires the annoying MSVC9 dlls, which I do not intend to install on my PC.

I've added a setup project to this solution and left a .msi setup file in the tree. Upside - you can now install it even if you don't already have the proper libraries; downside - it will install the libraries. Also, the .zip file has grown from less than 1 meg to over 14 meg. It's available at the same URL.

DrBonzo
28th May 2009, 15:37
QP=Quantization Parameter. Higher QP is higher quantization, hence more compressed and lower quality.

. . .


Um, yes, but what specifically does quantization refer to here? It would not seem to be intensity levels or DCT coefficients. The range of values and name make me think that something is limited to 5 bits, but what?

benwaggoner
29th May 2009, 03:14
Um, yes, but what specifically does quantization refer to here? It would not seem to be intensity levels or DCT coefficients. The range of values and name make me think that something is limited to 5 bits, but what?
This is the quantization parameter used to scale the DCT coefficients. Higher values give coarser quantization and cause more detail to fall into the deadzone and disappear. This increases compression artifacts, and compression. Ala:

http://en.wikipedia.org/wiki/Quantization_(image_processing)#Frequency_quantization_for_image_compression

The least compression is QP=1, where the matrix is left alone. The highest in VC-1 is 31, where each coefficient is divided by 31.

There's actually more than 31 steps in VC-1, though, as half-step values can be used from 1.5-7.5.

AlexW
29th May 2009, 03:35
The least compression is QP=1, where the matrix is left alone. The highest in VC-1 is 31, where each coefficient is divided by 31.

wouldn't each coefficient be divided by 2 when QP=1 and 62 when QP=31 in VC-1?

benwaggoner
4th June 2009, 19:59
wouldn't each coefficient be divided by 2 when QP=1 and 62 when QP=31 in VC-1?
Ooops, scale factor, not QP :).

TinTime
19th October 2009, 20:36
I've been using my own version of this code recently (including Nic's changes) so, after a bit of last minute tidying up, I thought I'd pass it on to anyone who's interested.
Download here (http://www.mediafire.com/file/ztl0tdilg4n/AVS2ASF.zip).

First a quick disclaimer. I only use it for encoding AVS to a VC-1 elementary stream (so profile 2 and no audio). I don't think I've broken anything else but you never know :)

Also I've tried to add a bit more validation but I'm sure I've missed plenty of illegal parameter combinations.


Anyway, the changes:


Parameters:

Removed -framerate. Framerate is now taken from the input file.

Added -showparms. This will print all of the encoder parms to the command window.

Added -sarx and -sary. These are used to set PixHeight, PixWidth, PixIndex, DisplayHeight and DisplayWidth. They will override -aspectratio, -dw and -dh if they're also set.
e.g. If the input resolution is 704x576 then using -sarx 16 -sary 11 will set...
PixHeight = 11
PixWidth = 16
PixIndex = 15
DisplayHeight = 576
DisplayWidth = 1024
NB. I've hardcoded an exception to these rules. If DisplayHeight is calculated as 480 and DisplayWidth is calculated as 853 then they'll be changed to 1024x576. My goal here is to be able to mux to mkv without having to set display parameters and 853x480 isn't quite right. I wanted to think of a better way to handle non-integer display values but then I hardcoded it and lazyness took over...
e.g. If the input resolution is 704x480 then using -sarx 40 -sary 33 will set...
PixHeight = 33
PixWidth = 40
PixIndex = 15
DisplayHeight = 576
DisplayWidth = 1024


Functionality:

Various default values are set so that it only needs input and output filenames to run. Obviously it probably won't encode as you want but running...

AVS2ASF.exe -i input.avs -o output.vc1

...can provide a starting point, especially if -showparms is specified. Then other parms can be set as needed.


Validation:

I've tried to validate parameters based on the ratecontrol setting. If they're obviously wrong then it will fail, otherwise it will correct the fault.
e.g.
If -rate isn't set for -ratecontrol 2 then it will fail.
If -peakrate is set for -ratecontrol 2 then it will set it to 0 and continue.
In both cases a message will be written out, and there's always -showparms to see what parameter values are ultimately being used.

Kurtnoise
19th October 2009, 21:27
nitpick: you use the win 7 SDK or the old one for the compilation ?

TinTime
19th October 2009, 21:40
The old one - I'm running WinXP at the moment. Presumably any Win 7 libraries will require Win 7?

Kurtnoise
19th October 2009, 21:47
Win 7 SDK supports x86, x64, and IA64 platform architectures for building and running applications on Windows XP SP3, Windows Server 2003 R2, Windows Vista, Windows Server 2008, and Windows 7.

http://www.microsoft.com/downloads/info.aspx?na=40&p=2&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=71deb800-c591-4f97-a900-bea146e4fae1&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f8%2f8%2f0%2f8808A472-6450-4723-9C87-977069714B27%2fReleaseNotes_Win7RTMSDK.Htm

Midzuki
19th October 2009, 22:20
@ TinTime: YES!, your wvc1enc.exe :D is working as it should! :)
So far at least, I mean. :p

"-bframes 0" don't generate an esoteric error message, and the program accepts all the 5 types of ratecontrol. :cool:

Only one small annoyance: when it finishes the encoding, it doesn't close itself, so I have to open another CMD window in order to kill the stubborn application. :)

Anyway, : :goodpost: && :thanks:

Inspector.Gadget
19th October 2009, 22:27
Tintime: Thanks for your build! On my system (64-bit Vista SP2), your ASV2ASF binary crashes at 99% when used with no switches other than -i and -o but apparently generates a compliant VC1 file anyway (OK with mkvmerge, etc.). I've been feeding it the following:

Colorbars()
Trim(0,10000)
ConverttoYV12()

So this strikes me as likely something simple, such as some 64-bit weirdness with your encoders' return code.

Midzuki
20th October 2009, 00:01
Colorbars()
Trim(0,10000)
ConverttoYV12()

Add a "KillAudio()" and see if it makes a difference
(but I agree, the encoder is not ignoring completely the presence of an audio stream, therefore the source code needs to be improved).

Inspector.Gadget
20th October 2009, 00:49
OK, that fixed the error. Definitely related to audio handling. Thanks, Midzuki!

TinTime
20th October 2009, 01:31
http://www.microsoft.com/downloads/info.aspx?na=40&p=2&SrcDisplayLang=en&SrcCategoryId=&SrcFamilyId=71deb800-c591-4f97-a900-bea146e4fae1&u=http%3a%2f%2fdownload.microsoft.com%2fdownload%2f8%2f8%2f0%2f8808A472-6450-4723-9C87-977069714B27%2fReleaseNotes_Win7RTMSDK.Htm

Ah. I'll do some reading :) - thanks.

Only one small annoyance: when it finishes the encoding, it doesn't close itself, so I have to open another CMD window in order to kill the stubborn application. :)

On my system (64-bit Vista SP2), your ASV2ASF binary crashes at 99% when used with no switches other than -i and -o but apparently generates a compliant VC1 file anyway (OK with mkvmerge, etc.).

Add a "KillAudio()" and see if it makes a difference
(but I agree, the encoder is not ignoring completely the presence of an audio stream, therefore the source code needs to be improved).

OK, that fixed the error. Definitely related to audio handling. Thanks, Midzuki!

Thanks for your feedback. Midzuki, you're right. KillAudio() stops it hanging. I've only ever used the code to produce a VC-1 stream, and so I've never tried audio in the input. It clearly throws a wobbly with audio, as generated by Colorbars() for example, when writing a VC-1 stream. Which makes sense (from the code's point of view) - no audio possible in a raw video stream. Although waiting until the end of the encode probably isn't ideal.

So, error handling should be - if output is raw VC-1, audio cannot be present.

Midzuki
20th October 2009, 03:17
Well, here go another $1.99, to whom this may interest. :)
A command-line VC-1 compressor should, ideally, do without the .ASF output option (or... replace it with .TS, .MP4, and .AVI options :D — and I'm serious). From the several VC-1 encodes I have done so far, I perceive that the Microsoft implementation of the open VC-1 standard is "ASF-centric" :( Which means, even when generating an elementary stream, the Microsoft compressors not rarely drop/repeat frames :mad: Only when I use VirtualDub + ffdshow, or cscript.exe + Wmcmd.vbs w/ unconstrained 2-pass VBR, I can be (almost-)sure I won't get skipped/duplicated frames. OK, the ASF container is good for streaming, and was designed to support variable frame-rate and variable sample-rate — however the VC-1 encoders themselves have no good reason to be "optimized for the ASF wrapper". :devil:

benwaggoner
20th October 2009, 03:49
@Midzuki,

Well, VC-1 Simple and Main profiles really require the ASF wrapper. It's only AP that has transport independence. And there's no reason not to support ASF output along with other container types. The bitstream encoding is identical; it's just a different muxing mode.

buzzqw
20th October 2009, 08:07
@TinTime

awesome works! :thanks:

will be possibile to add audio support ?

BHH