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 > Video Encoding > New and alternative video codecs

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd January 2009, 07:03   #121  |  Link
Celeritas
Registered User
 
Join Date: May 2007
Posts: 8
I have been able to get the video to convert, but in the past I have been using 6 mono wav files in WME (via WMCmd.vbs) to add a 5.1 channel soundtrack. I have been experimenting with the -pr option, but I can't seem to make a .prx file that AVS2ASF likes. I only know enough about avs files to add a single wav, so the avs will play, but AVS2ASF balks at the .prx file, even though I am creating it with WME. If I leave the audiodub section out of the avs file, it works but picks up no audio.

Code:
My avs file looks like:
a=DirectShowSource("C:\Users\Public\Videos\HD Transcodes\vob\video-indexed.avi", audio=false)
b=WavSource("C:\Users\Public\Videos\HD Transcodes\vob\audio.C.wav")
audiodub(a,b)
Trim(0,100) #to make it short for testing
ConvertToYV12()

The current contents of the .prx file:
<?xml version="1.0"?>

<WMEncoder major_version="9"
    minor_version="0"
    Name="WMEncoder10810"
    AutoIndex="0"
    SynchroniesOperation="0" >
    <Description />
    <Attributes >
        <WMENC_LONG Name="SurroundMix" Value="-3" />
        <WMENC_LONG Name="CenterMix" Value="-3" />
        <WMENC_LONG Name="LFEMix" Value="-12" />
    </Attributes>

    <SourceGroups >
        <SourceGroup Name="Source 1" >
            <Source Type="WMENC_AUDIO" Scheme="multichannel" >
                <UserData >
                    <WMENC_STRING Name="FrontLeft" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.L.wav" />
                    <WMENC_STRING Name="FrontRight" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.R.wav" />
                    <WMENC_STRING Name="FrontCenter" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.C.wav" />
                    <WMENC_STRING Name="LowFrequency" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.LFE.wav" />
                    <WMENC_STRING Name="BackLeft" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.SL.wav" />
                    <WMENC_STRING Name="BackRight" Value="C:\Users\Public\Videos\HD Transcodes\vob\audio.SR.wav" />
                </UserData>

            </Source>

            <EncoderProfile id="Multiple bit rates audio (CBR)" />
            <UserData >
            </UserData>

        </SourceGroup>

    </SourceGroups>

    <File LocalFileName="C:\Users\Public\Videos\HD Transcodes\vob\audio.wma" />
    <WMEncoder_Profile id="Multiple bit rates audio (CBR)" >
    <![CDATA[        <profile version="589824" 
             storageformat="1" 
             name="Multiple bit rates audio (CBR)" 
             description=""> 
                   <streamconfig majortype="{73647561-0000-0010-8000-00AA00389B71}" 
                   streamnumber="1" 
                   streamname="Audio Stream" 
                   inputname="Audio409" 
                   bitrate="640008" 
                   bufferwindow="-1" 
                   reliabletransport="0" 
                   decodercomplexity="" 
                   rfc1766langid="en-us" 
 > 
             <wmmediatype subtype="{00000162-0000-0010-8000-00AA00389B71}"  
                   bfixedsizesamples="1" 
                   btemporalcompression="0" 
                   lsamplesize="27307"> 
           <waveformatex wFormatTag="354" 
                         nChannels="6" 
                         nSamplesPerSec="48000" 
                         nAvgBytesPerSec="80001" 
                         nBlockAlign="27307" 
                         wBitsPerSample="24" 
                         codecdata="18003F0000000000000000000000E0000000"/> 
            </wmmediatype>
            </streamconfig>
    </profile> 
    ]]>
    </WMEncoder_Profile>

    <UserData >
        <WMENC_LONG Name="Encoding\Bitrate0\Video0\CustomW" Value="320" />
        <WMENC_LONG Name="Encoding\Bitrate0\Video0\CustomH" Value="240" />
        <WMENC_STRING Name="Encoding\Audio0" />
        <WMENC_STRING Name="Encoding\Video0" />
        <WMENC_STRING Name="Encoding\Script0" />
    </UserData>

</WMEncoder>


The error message I get is:
------------Start Encode-----------
Failure in CASFFileWriter::LoadCustomProfile
hr = 80070002
Failure in CASFFileWriter::Init
hr = 80070002
Failure in VC1Enc::InitFileWriter
hr = 80070002
VC1 SDK Error = 0
Failure in CASFFileWriter::Destroy
hr = c00d002b
Failure in CVC1EncASF::DestroyFileReader
hr = c00d002b

Failure in Encode
hr = 80070002
VC1 SDK Error = 0
Total elapsed time in seconds = 18.557000

The command I am using is:
C:\Users\John\Downloads\Software\Multimedia\AVS2ASF-0.3_20080312\Release>avs2asf 
-i "C:\Users\Public\Videos\HD Transcodes\vob\video.avs" -o "C:\Users\Public\Videos\HD Transcodes\Serenity-VC1.asf" 
-rate 8000 -framerate 23.976 -peakrate 12000 -maxkeydist 4 -profiletype 2 
-bframes 2 -vbv 300000 -pr "C:\Users\Public\Videos\HD Transcodes\vob\audioencode.prx"

Last edited by Celeritas; 23rd January 2009 at 07:11.
Celeritas is offline   Reply With Quote
Old 23rd January 2009, 17:09   #122  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
@Celeritas

add this to your avs file will give you 5.1 audio:
Code:
audio1 = WavSource("fl.wav")
audio2 = WavSource("fr.wav")
audio3 = WavSource("c.wav")
audio4 = WavSource("lfe.wav")
audio5 = WavSource("sl.wav")
audio6 = WavSource("sr.wav")
fl = GetChannel(audio1, 1)
fr = GetChannel(audio2, 1)
c = GetChannel(audio3, 1)
lfe = GetChannel(audio4, 1)
sl = GetChannel(audio5, 1)
sr = GetChannel(audio6, 1)
b = MergeChannels(fl, fr,c, lfe, sl, sr)
Not sure how that will work with avs2asf because I don't us the audio options.
NorthPole is offline   Reply With Quote
Old 23rd January 2009, 19:28   #123  |  Link
ss3
Registered User
 
Join Date: Jan 2008
Posts: 12
Quote:
Originally Posted by benwaggoner View Post
Alex and I both used to be on the codec team. He's now on the Silverlight evangelism team:

http://www.alexzambelli.com/blog

Anyway, SP and MP simply aren't part about the VC-1 elementary stream spec. Can you explain what you're trying to do? Perhaps you could just make AP with SP/MP feature subsets?
Ben,
this is what I cam looking for

A VC1 encoder which can encode in ES (i.e VC1) the AP Profile with multiple slices
and SP/MP based elementary stream encoder i.e with RCV encapsulation.

the reason I am looking for multiple slices is I need to compare the performance of error concealment of VC1 and 264 multiple slices
And SP/MP because I need to use ref decoder which doesnot accept wmv format
Any pointers/help please?
ss3 is offline   Reply With Quote
Old 24th January 2009, 22:45   #124  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
Here is a modified version of Nic's program:

I fixed the aspectratio error described on page 5 of this thread. Also, I fixed the rate control CBR modes 0 & 2 and the 1 pass VBR mode 1. Previously you could only use modes 3 and 4.

Works fine for me in all modes.
http://www.mediafire.com/?3m5x8mmn0rt
NorthPole is offline   Reply With Quote
Old 24th January 2009, 23:47   #125  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
thanks a lot...but no documentation?...could you post some examples with the new modes?
_
b66pak is offline   Reply With Quote
Old 25th January 2009, 00:40   #126  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
The encoder defaults to mode 1... which is 1-pass VBR with a quantizier setting of 8. You only need to supply the input and output files and these switches

-framerate <xxxx> -profiletype <x> -bframes <x> -maxkeydist <x>

Examples are at the end of the command line help.

This is from the command line help

Code:
*************************************

VC-1 AVS2ASF v0.4 Encoding Sample


Original Sample AVI2ASF code Copyright (C) Microsoft Corporation.
All rights reserved.

Avisynth, YV12 & Raw support added by Nic.
Aspect Ratio, Help and Rate Control Mode changes by Northpole.


*************************************
The required parameters are based on the default rate control mode 1,
1-pass VBR with a Fixed QP of 8.
If you change the rate control mode, simply specify appropriate values
for the required parameters.

Syntax: 
AVS2ASF.exe -i <inputfile> -o <outputfile> 
	-framerate <frame rate> -profiletype <profile type>
	-bframes <number of b frames> -maxkeydist <maximum key frame distance>
	[Optional 1] <value1> [Optional 2] <value2> ...


Command line options:

-i <input AVI file name>

-o <output ASF file name>

[-rate] <output rate (kilobits per second)>
	The range is 1 to 135000.
	Not used when Rate Control Mode equals 1.

[-complexity] <encoder complexity>
	0 to 5, 0 = best performance, 5 = best quality.

[-qp] <quantization parameter (QP)>
	Fixed QP if -ratecontrol equals 1 (1-pass VBR)
	Max QP if -ratecontrol equals 0 or 2 (CBR)
	The range is 1 to 31.
	Not applicable when Rate Control Mode equals 3 or 4.

[-framerate] <source frame rate>

[-interlaced] Specifies interlaced source.

[-maxkeydist] <maximum distance between key frames>

[-bframes] <number of B-frames per P-frame>
	Range is 0 to 7.

[-peakrate] <peak bit rate (kilobits per second)>
	The range is 1 to 135000.
	Not used when Rate Control Mode equals 0, 1, 2, or 4.

[-profiletype] <type specifier>
	0 = Simple, 1= Main, 2 = Advanced.

[-ratecontrol]
	0 = 1-pass CBR
	1 = 1-pass VBR fixed QP
	2 = 2-pass CBR
	3 = 2-pass peak constrained VBR
	4 = 2-pass unconstrained VBR.

[-vbv] <size of vbv buffer>
	The range is 1 to 157696 for Simple profile, 1 to 5001216 for Main profile
	and 1 to 33792000 for Advanced profile.
	VBVBuffer = Bit rate in kbps x buffer duration in seconds x 125.
	Recommended buffer duration = 8 seconds.
	Not used when Rate Control Mode equals 1 or 4.

[-colorformatflags] <colorformatflag> <colorprimaries> <transferchar> 
		    <matrixcoef>
	- If colorformatflag is 1, then you must specify colorprimaries, 
	  transferchar, and matrixcoef.
	- If colorformatflag is 0, then no need to specify colorprimaries,
	  transferchar, and matrixcoef because the decoder will generate them
	  for you.

[-denoise] <0 or 1>
	Turn on or off denoise filter.

[-inloop] <0 or 1>
	Turn on or off in-loop filter.

[-median] <0 or 1>
	Turn on or off median filter.

[-overlap] <0 or 1>
	Turn on or off overlap smoothing.

[-noiseedge] <0 or 1>
	Turn on or off noise edge removal.

[-deltamvrange] <delta mv range index>
	0 = off, 1= horizontal, 2= vertical, 3 = h + v.

[-motionsearchlevel] <level>
	0 = Luma only. (Default)
	1 = Luma w/ nearest-int chroma. 
	2 = Luma w/ true chroma.
	3 = Macroblock-adaptive with true chroma. 
	4 = Macroblock adaptive with nearest int chroma.

[-mesearchmethod] <phase>
	0 = off, 1 = always use hadamard, 2 = adaptive sad/hadamard 

[-mbcost] <cost method>
	0 = SAD/Hadamard, 1 = RD cost.

[-mvcost] <cost method>
	0 = static, 1 = dynamic.

[-mvrange] <mv range>
	0 to 3 are increasing ranges. 4 is macroblock adaptive.

[-dquantoption] <level>
	0 to 3, 0 = off, 1 = I frame only, 2 = I/P frame only, 3 = I/P/B frame.

[-adaptivequant] <adaptive quantization>
	0 to 21

[-dquantpstrength] <level>
	Range is 0 to 2.
	0 = VC-1 encoder-managed setting.
	Only valid when -dquantoption > 0. 

[-dquantbstrength] <level>
	Range is 0 to 4.
	0 = VC-1 encoder-managed setting.
	Only valid when -dquantoption > 0. 

[-bdeltaqp] <qp increase for B-frames>
	0 to 30

[-closedentrypt] <closed entry point value.

[-dw] <display width (pixels)>

[-dh] <display height (pixels)>

[-ew] <encode width (pixels)>

[-eh] <encode height (pixels)>

[-lbpresent]
	Indicates letterboxing is present.

[-lookahead]
	Indicates use lookahead.
	-ratecontrolmode must equal 0.

[-adaptiveGOP]
	Indicates use adaptive GOP.

[-keyPop] <key pop level>
	Indicates use key frame pulse reduction.
	Range is 0 to 4. 0 = Off, 1 -4 are strength levels.

[-threads] <num threads>
	Maximum is 4.

[-affinity] <affinity mask>
	Processor mapping.

[-aspectratio] <aspectratioindex> <aspectratiowidth> <aspectratioheight> 
	If aspectratioindex is 15, then you must specify aspectratiowidth and
	aspectratioheight
	ie. if video is 720x480 at 16x9 aspect ratio, use -aspectratio 15 40 33

[-videotype] <type>
	0 = progressive, 1 = interlaced frames, 2= interlaced fields
	3 = detect interlacing type, 4 = automatic.

[-tff]
	Indicates top field first.

[-rff]
	Indicates repeat first field.

[-pr] <path to .prx file>
	Specifies a .prx file to use for audio profile data.
	By default, the sample looks for an appropriate audio codec.



Example: Mode 0
	AVS2ASF.exe -i video.avs -o encoded.asf -framerate 25 -profiletype 2 
	-bframes 2 -maxkeydist 6 -ratecontrol 0 -rate 3000 -vbv 3000000


Example: Mode 1
	AVS2ASF.exe -i video.avs -o encoded.asf -framerate 25 -profiletype 2 
	-bframes 2 -maxkeydist 6


Example: Mode 2
	AVS2ASF.exe -i video.avs -o encoded.asf -framerate 25 -profiletype 2 
	-bframes 2 -maxkeydist 6 -ratecontrol 2 -rate 3000 -vbv 3000000


Example: Mode 3
	AVS2ASF.exe -i video.avs -o encoded.asf -framerate 25 -profiletype 2 
	-bframes 2 -maxkeydist 6 -ratecontrol 3 -rate 3000 -peakrate 25000 -vbv 3000000


Example: Mode 4
	AVS2ASF.exe -i video.avs -o encoded.asf -framerate 25 -profiletype 2 
	-bframes 2 -maxkeydist 6 -ratecontrol 4 -rate 3000

 Use an output filename with a suffix of .vc1 for VC1 Elementry Stream encoding
NorthPole is offline   Reply With Quote
Old 25th January 2009, 00:44   #127  |  Link
b66pak
Registered User
 
b66pak's Avatar
 
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
thanks...i will give it a try...
_
b66pak is offline   Reply With Quote
Old 27th January 2009, 02:30   #128  |  Link
Celeritas
Registered User
 
Join Date: May 2007
Posts: 8
@NorthPole, thank you. I can get it to play 5.1 with your help, but the 5.1 WAVE_EXTENSIBLE audio is not welcome in WME, so the .prx file can't process it. I've decided to bag the idea of trying to get avs2asf to take 5.1 audio in through a .prx file. I'll just create the 5.1 wma file separately and mux it with Windows Stream Editor.

Last edited by Celeritas; 27th January 2009 at 02:33.
Celeritas is offline   Reply With Quote
Old 30th January 2009, 04:03   #129  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
@celeritas

How did you create your 5.1 wma file? what tool?
NorthPole is offline   Reply With Quote
Old 30th January 2009, 06:52   #130  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,484
Quote:
Originally Posted by NorthPole View Post
Here is a modified version of Nic's program:

I fixed the aspectratio error described on page 5 of this thread. Also, I fixed the rate control CBR modes 0 & 2 and the 1 pass VBR mode 1. Previously you could only use modes 3 and 4.

Works fine for me in all modes.
http://www.mediafire.com/?3m5x8mmn0rt
You can fix the thread mode bug? (impossible to use more than one thread here).
There are probleme with dquant mode too (impossible to use more than level 1 for dequant)
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9

Last edited by Sagittaire; 30th January 2009 at 06:54.
Sagittaire is offline   Reply With Quote
Old 30th January 2009, 14:56   #131  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
Quote:
Originally Posted by Sagittaire View Post
You can fix the thread mode bug? (impossible to use more than one thread here. There are probleme with dquant mode too (impossible to use more than level 1 for dequant)
I'll look into it... On the thread bug, I don't have a duo core so I'm not sure how successful I will be.
NorthPole is offline   Reply With Quote
Old 30th January 2009, 15:45   #132  |  Link
buzzqw
HDConvertToX author
 
Join Date: Nov 2003
Location: Cesena,Italy
Posts: 6,552
would be awesome if you can use the audio options as wmcmd.vbs in avs2vc1
also fixing audio encoidng (5.1)


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 30th January 2009, 16:27   #133  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
Quote:
Originally Posted by buzzqw View Post
would be awesome if you can use the audio options as wmcmd.vbs in avs2vc1
also fixing audio encoidng (5.1)
BHH
I have been looking at it but I can't get a 5.1 wma file from wmcmd yet. What profile works with wmcmd or what is your command line. I know nic got it to work but I have not had any luck.
NorthPole is offline   Reply With Quote
Old 30th January 2009, 16:31   #134  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
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
NorthPole is offline   Reply With Quote
Old 30th January 2009, 16:42   #135  |  Link
buzzqw
HDConvertToX author
 
Join Date: Nov 2003
Location: Cesena,Italy
Posts: 6,552
well at least including audio support will be very GOOD!

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 30th January 2009, 17:43   #136  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
@Sagittaire

Have you tried setting both the -threads and -affinity switches when doing an encode? Also, if you use the Dquant option, you have to have the mvcost = 0.
NorthPole is offline   Reply With Quote
Old 31st January 2009, 21:09   #137  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,484
Quote:
Originally Posted by NorthPole View Post
@Sagittaire

Have you tried setting both the -threads and -affinity switches when doing an encode? Also, if you use the Dquant option, you have to have the mvcost = 0.
Yes -threads 2 don't work. I have error when I use it.


*************************************
Encoding in ES (Elementry Stream) mode

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

Final error code: -20

D:\Mes dossiers\Codec\VC1 SDK>pause
Appuyez sur une touche pour continuer...
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9

Last edited by Sagittaire; 31st January 2009 at 21:12.
Sagittaire is offline   Reply With Quote
Old 31st January 2009, 22:10   #138  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
@satittaire

I looked at the code and I believe it is sending the correct command line values (ie thread, affinity etc) to the encoder. The error occurs when the encoder gets the info and tries to apply them. What type of cpu do you have?

This is the info from the SDK

Code:
Each instance of the VC-1 encoder can use up to four threads to distribute encoding tasks. Each thread runs on a separate processor. Each thread processes a different horizontal portion of the frame. Each horizontal portion should be at least 64 rows in height.
Motion search operations only happen within each horizontal portion. Because most motion in video is typically horizontal, such as panning, motion estimation usually works well. However, if the content contains a lot of vertical motion, some slight loss of coding efficiency may occur.

Note that specifying higher values will not raise an error. The encoder will simply use four threads.

The affinity mask specifies which processors to use. Each binary digit (bit) in the affinity mask represents an individual processor. Setting a bit to one makes the VC-1 encoder use the corresponding processor to run an encoding thread. For example, to make the VC-1 encoder use processors zero, one, two, and three, the low-order byte of the affinity mask would be:

00001111

This affinity mask has a corresponding decimal value of 15
So for the four processors example shown above with the low-order byte of 00001111,
I believe that you obtain the affinity value is decimals by
(1 * 2^3) + (1 * 2^2) + (1 * 2^1) + (1 * 2^0) = 8 + 4 + 2 + 1 = 15

Don't know if that helps (or makes any difference) but the SetNumThreads command used within the program passes both the thread and affinity to the encoder. You may try different combinations to see if anything works. Sorry I couldn't be of more help.

Last edited by NorthPole; 31st January 2009 at 22:17.
NorthPole is offline   Reply With Quote
Old 31st January 2009, 23:01   #139  |  Link
Sagittaire
Testeur de codecs
 
Sagittaire's Avatar
 
Join Date: May 2003
Location: France
Posts: 2,484
I have c2d ...

-threads 2 -affinity 00000011 don't work
__________________
Le Sagittaire ... ;-)

1- Ateme AVC or x264
2- VP7 or RV10 only for anime
3- XviD, DivX or WMV9
Sagittaire is offline   Reply With Quote
Old 31st January 2009, 23:44   #140  |  Link
NorthPole
Registered User
 
Join Date: Jan 2006
Posts: 141
@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.
NorthPole 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 05:28.


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