View Full Version : WMCmd.vbs WME9 script update released - 10/11/07
zambelli
23rd March 2007, 08:15
I'm starting a new thread devoted to WMCmd.vbs script updates (as the old one was more about the WVC1 beta codec package).
WMCmd.vbs
Windows Media Encoder Command Line Script Utility
Disclaimer: Although I do work for Microsoft, please understand that this is not an official Microsoft update. WME9 is considered a legacy product so it's unlikely there will be any official WMCmd.vbs updates coming from Microsoft in the future.
The latest version was released on October 11, 2007. You can download it here:
http://www.citizeninsomniac.com/WMV/#WMCmd
What is it?
Windows Media Encoder 9 Series (http://www.microsoft.com/downloads/details.aspx?FamilyID=5691ba02-e496-465a-bba9-b2f1182cdf24) is best known as a standalone encoder application, but it actually shipped with an entire encoder SDK that allowed 3rd parties to develop their own WM encoder interfaces. A proof-of-concept command-line utility written in VBScript and based entirely on the encoder SDK was included with WME9. That is WMCmd.vbs. When run from the command-line with cscript.exe, this utility provides all the power and (most of the) features of WME9 to the advanced user who prefers the speed and robustness of a command-line encoder.
Why an update?
The original script was released with WME9 in 2002. No subsequent updates to WME9 (such as the x64 release) updated the script, but as updates to the codecs were released through new WMP and WM Format releases, it became obvious that changes to the old script were necessary to get the most out of the new codecs.
What's new?
The updated WMCmd.vbs added support for WVC1 (WMV9 Advanced Profile) encoding, WMA10 Professional encoding, advanced WMV9 settings, AviSynth input, better progress reporting, additional metadata support, revised documentation, video quality presets, etc. The full changelog is posted here and here (http://www.citizeninsomniac.com/WMV/readme.txt).
Requirements: Windows Media Encoder 9 Series (http://www.microsoft.com/downloads/details.aspx?FamilyID=5691ba02-e496-465a-bba9-b2f1182cdf24) or its SDK
Windows Vista users should also download and install hotfix KB929182 (http://support.microsoft.com/default.aspx/kb/929182) before using WMCmd.vbs.
Although WME9/WMCmd.vbs will work with both WM Format 9 (WMP9) and WM Format 9.5 (WMP10) codecs, it is recommended that you update to the latest WM Format 11 codecs (http://www.citizeninsomniac.com/WMV/#Codecs), currently available for download in XP and included in Vista. Advanced video encoding settings will only work with v11 codecs.
Full command-line help: http://www.citizeninsomniac.com/WMV/WMCmd.txt (also available when you run "cscript.exe wmcmd.vbs" without any arguments)
Changelog:
10-11-2007:
-----------
Added -v_qp option as an alternative to -v_quality for 1-pass VBR encoding (which is in fact a fixed QP encoding mode). Whereas -v_quality uses an abstract 0 to 100 scale, -v_qp maps directly to quantizer parameter values in the 1.0 to 31.0 range (in 0.5 increments).
Encoder registry settings are now removed immediately after the encoder session is started because the codec only reads them once at the beginning of the encode so there's no reason for them to hang around until the end of the encoding session. This ought to improve parallel encoding jobs interoperability too.
The script no longer indiscriminately destroys existing encoder registry settings. At the beginning of each encoding session it saves the existing registry settings and then restores them at the end. This improves usability in cases where one set of advanced encoder settings is set externally (manually or via PowerToy) while another is used from the command-line.
Deprecated -v_percopt in favor of new -v_adz option because valid range for -v_percopt didn't make much sense. -v_percopt will continue to work as before but it is no longer documented. -v_adz value range now matches that of "Perceptual Option" (Adaptive Dead-Zone) in WMV9 PowerToy. If both -v_percopt and -v_adz are specified, -v_percopt values will override -v_adz values.
Redefined and fully documented -v_preset quality presets. They should now better reflect their speed and quality rankings.
Made -v_compopt 1 into an Advanced Profile exclusive option because some of its components were exclusive to Advanced Profile. It's best to be on the safe side.
5-21-2007:
----------
Added -log option for redirecting all text output to a file.
Updated some descriptions for advanced video settings.
Added a FAQ section to this release document.
4-14-2007:
----------
IMPORTANT CHANGE: Remapped -v_mslevel (Motion Search Level) values to correctly reflect the codec implementation. 0 is now the default luma search and 3 and 4 are adaptive chroma modes.
Added an -a_input option that allows specifying an alternative audio source to the one present in the main -input source. This makes it possible to use separate video and audio source files from the command-line, as it's always been possible in the WME9 GUI.
Updated the documentation, expanded sections on dquant and perceptual optimization options. Very useful options for preserving fine detail.
Fixed a bug where simultaneous encoding jobs would get simultaneously killed as soon as one encoding job finished.
3-22-2007:
----------
Added a -v_preset option that introduces 5 intuitive video quality presets:
Fast, Good, Better, Best and Insane. Unlike the -v_compopt 1 preset that is defined within the codec, -v_preset values are defined in the script and can be easily changed and refined in future versions.
Added -v_complexity as an alias for -v_performance expressed on a 0-5 scale.
Fixed bug that sometimes caused the script to hang or overwrite certain parameters when an external configuration file (-config) was loaded.
Improved the unknown source duration workaround by having the script automatically add the new file extension (like Avisynth .avs) to the list of formats WMP is allowed to play. No more security dialogs on first launch!
Added profile compliance checking for advanced WMV9 settings - will not set certain registry keys if Simple or Main profiles are selected.
Added code to check if WMEncoder object is initialized correctly before proceeding with encode.
Removed the -help? option which launched WME9 CHM help file from cmd line.
Removed old Complex Profile (CP) support entirely - translates to AP now.
Changed Lookahead maximum value to 30.
Updated the documentation, corrected some vague and erroneous descriptions.
8-25-2006:
----------
Fixed a bug in configuration saving (-s_config) and loading (-config) functions that prevented command-line parameters containing quotation marks from being processed correctly.
Added code to check whether specified video profile (-v_profile) is supported by the video codec used (-v_codec). For example, can't use SP or MP with WVC1.
5-19-2006:
----------
Added support for WVC1 encoding (WMV9 Advanced Profile video codec).
Added support for WMA10 Professional low-bitrate encoding and changed WMA codec identifiers to be version-agnostic (i.e. WMASTD instead of WMA9STD)
Added command-line parameters for advanced video settings otherwise exposed only through the registry. For details, see: http://www.microsoft.com/windows/windowsmedia/howto/articles/codecadvancedsettings.aspx
Added support for Avisynth (.avs) script sources and worked around a related duration bug in the source plugin.
Rewrote the encoding progress screen so that it estimates encoding time, ETA and encoding speed.
Added command-line parameters for music centric metadata such as album, track number, release year, genre, etc.
Added metadata summary to the output screen.
Added documentation for the new advanced video settings to the inline help.
Reorganized inline help documentation and grouped settings in a more intuitive way.
Fixed bug where encoder script would sometimes hang at the end of encoding process.
Improved error handling for bad source files.
zambelli
23rd March 2007, 08:19
Copying here from an old post:
Yep, the encoder script now supports .avs inputs. The truth of the matter is that it always did. You see, WME9 has a concept of source plugins which allows it to treat file inputs, screen captures and device captures in a very similar fashion. It uses its own AVI source plugin to read AVI files, and that plugin cannot retrieve the duration property from AVS scripts - for one reason or another. So the AVS workaround was to retrieve the duration using some other method. Wmcmd being VBScript based, it wasn't possible to use DirectShow or VfW, so I used the next best thing: WMP ActiveX control. If for some reason the duration can't be retrieved again (i.e. XP with absolutely no WMP present), you'll still be able to encode - you just won't have the pretty progress bar to tell you how long you need to take the lunch break for. :)
zambelli
23rd March 2007, 08:47
The most interesting addition to the 3-22-2007 release might be the new -v_preset parameter, so let me elaborate on it a bit...
Dealing with WMV9 encoding at home and at work, I would often get asked about "best" encoding parameters for various scenarios. As I was updating the script with other things recently, it occurred to me that some of these "best encoding practices" could be added as presets to the encoder script, allowing people to easily improve WMV quality (or encoding speed) without worrying too much about all the various parameters. Consider it an attempt at a one-size-fits-all quality solution, similar to the --preset switch in LAME MP3 encoder, for example.
The closest we had to this up until now was the -v_compopt 1 switch, but that one was actually implemented inside the codec. The new presets are implemented entirely in the script which means we can tweak and refine them as we come up with better encoding settings.
The current presets are as follows:
fast - Up to 1.5x faster than default with an acceptable quality tradeoff. The preset sets:
Complexity = 2 (-v_performance 40)
Lookahead = 30 (-v_lookahead 30)
Loopfilter = On (-v_loopfilter 1)
Overlap Filter = On (-v_overlap 1)
Motion Search Level = Auto w/ Integer Chroma (-v_mslevel 0)
good - Similar speed as default but with more accurate motion search. This one is probably safe to use when otherwise you'd use no advanced features. The preset sets:
Complexity = 3 (-v_performance 60)
Lookahead = 30 (-v_lookahead 30)
Loopfilter = On (-v_loopfilter 1)
Motion Search Level = Auto w/ Integer Chroma (-v_mslevel 0)
better - Up to 1.5x slower than default but more efficient in ratecontrol. The big boost here are B-frames, along with expanded MV range and adaptive chroma search. The preset sets:
Complexity = 3 (-v_performance 60)
Lookahead = 30 (-v_lookahead 30)
Loopfilter = On (-v_loopfilter 1)
Motion Search Level = Auto w/ Integer Chroma (-v_mslevel 0)
Motion Search Range = Auto (-v_msrange 0)
Motion Vector Cost = Dynamic (-v_mvcost 1)
B-frames = 1 (-v_bframedist 1)
best - Up to 5x slower than default but with noticeably better quality. This will probably be "best enough" for most folks. One complexity level higher than "better", with MB-adaptive motion matching. The preset sets:
Complexity = 4 (-v_performance 80)
Lookahead = 30 (-v_lookahead 30)
Loopfilter = On (-v_loopfilter 1)
Motion Search Level = Integer Chroma (-v_mslevel 3)
Motion Search Range = Auto (-v_msrange 0)
Motion Vector Cost = Dynamic (-v_mvcost 1)
B-frames = 1 (-v_bframedist 1)
Motion Match Method = Auto (-v_mmatch 0)
insane - Insanely slow but if time is not a concern... It will provide the highest quality in most cases. True chroma search, Hadamard motion matching... It's painfully slow, so beware. The preset sets:
Complexity = 4 (-v_performance 80)
Lookahead = 30 (-v_lookahead 30)
Loopfilter = On (-v_loopfilter 1)
Motion Search Level = True Chroma (-v_mslevel 4)
Motion Search Range = Auto (-v_msrange 0)
Motion Vector Cost = Dynamic (-v_mvcost 1)
B-frames = 1 (-v_bframedist 1)
Motion Match Method = Hadamard (-v_mmatch 2)
Setting additional parameters will override any values set by the preset. Using video presets with -v_compopt 1 is not recommended.
These initial presets are based on just my own ideas of tradeoffs between speed and quality. If you have better ideas for presets, please share them.
tchaikovsky
23rd March 2007, 15:43
Nice work !
lazyn00b
23rd March 2007, 21:12
Thanks a lot, Zambelli, the presets look really good. Based on my modest experience tweaking these settings, it looks like your "better" preset is going to be the sweet spot for my purposes (compressing recorded HDTV at a reasonable speed).
zambelli
23rd March 2007, 22:05
Thanks a lot, Zambelli, the presets look really good. Based on my modest experience tweaking these settings, it looks like your "better" preset is going to be the sweet spot for my purposes (compressing recorded HDTV at a reasonable speed).
Thanks, glad it's working out for you. What kind of slowdown are you seeing with "better" compared to "good" or default? The numbers I posted were done fairly quickly, based on some encodes I did on my Athlon64 3500+, so I'd love to get more feedback about performance ratios in general.
buzzqw
24th March 2007, 22:47
thanks Zambelli!
in next update AutoMKV will include 5 new profile, based on these preset and with wvc1 as codec
Also thanks for the new vbs! a lot more stable and reliable !
BHH
jubilex
26th March 2007, 03:34
I'm still a bit unclear on the v_performance setting. By your presets, it looks like setting this higher will improve quality, but in my frame-by-frame comparisons, I've seen no improvement in quality whatsoever -- v_performance 0 looks every bit as good as v_performance 80. The only difference I've seen is that the higher setting will produce a smaller file, and will take *dramatically* longer to encode.
zambelli
26th March 2007, 06:34
I'm still a bit unclear on the v_performance setting. By your presets, it looks like setting this higher will improve quality, but in my frame-by-frame comparisons, I've seen no improvement in quality whatsoever -- v_performance 0 looks every bit as good as v_performance 80. The only difference I've seen is that the higher setting will produce a smaller file, and will take *dramatically* longer to encode.
Sounds like you're encoding in 1-pass VBR mode. In that mode higher complexity/performance will only decrease the size of the encoded file because the quality is fixed (hence the name "Quality VBR"). In every other mode the bitrate will stay the same but the quality will improve due to better motion estimation algorithms used.
Also, encoding times change dramatically between 0 and 80. You can go literally from faster-than-realtime encoding to wake-me-up-when-it's-done encoding.
buzzqw
5th April 2007, 07:43
@Zambelli
can you please look here
http://forum.doom9.org/showthread.php?p=979619#post979619 ? thanks!
feel free to reply here or on automkv thread
thanks again
BHH
ACrowley
5th April 2007, 09:33
thank you
I have one question :
Normally I use ProCoder to encode WVC1.
And i set the WM9 AP Settings with your WMV9 PowerToy.
But i cant find the Complexity Option in the Editor ?
The Option in ProCoder is at Auto and i cant change it.
I think when i set it manually via Registry for WMV9 AP, ProCoder must use Complexity=3 ?
But ProCoder takes more time to encode with the same WMV9 Ap Settings .
And the Lookahead Option ..i can ony select 16 and not 30 in your editor ? 30 not supported at the moment in PowerToy?
EDIT :
2nd Question is now clear.
Ill encode HDDVD/BlueRay to WWVC1 with 1pass CBR 720p 8Mbps 60000Buffer and "better Preset.
Commandline:
cscript.exe c:\windows\wmcmd.vbs -input g:\videoinput.avs -output g:\videooutput.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_preset better -v_bitrate 8000000 -v_keydist 3 -v_buffer 600000 -v_quality 100 -s_config own.weu
zambelli
6th April 2007, 05:19
I have one question :
Normally I use ProCoder to encode WVC1.
And i set the WM9 AP Settings with your WMV9 PowerToy.
But i cant find the Complexity Option in the Editor ?
The complexity can't be set via the registry - it needs to be set by the encoder application.
The Option in ProCoder is at Auto and i cant change it.
I think when i set it manually via Registry for WMV9 AP, ProCoder must use Complexity=3 ?
But ProCoder takes more time to encode with the same WMV9 Ap Settings .
The default complexity is 3, but if ProCoder is taking longer - perhaps it's not using the default complexity. You could try encoding something in ProCoder, measuring the time it takes to encode, and then try encoding the same source in wmcmd.vbs with various complexities - and see which complexity takes the same amount of encoding time. Don't use any advanced settings for that test though.
And the Lookahead Option ..i can ony select 16 and not 30 in your editor ? 30 not supported at the moment in PowerToy?
Well, I changed the range in the script, but the Lookahead distance maximum is in fact hardcoded to 16 - so I'll probably be changing that back in the next script release. I got a little ahead of myself on that one.
cscript.exe c:\windows\wmcmd.vbs -input g:\videoinput.avs -output g:\videooutput.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_preset better -v_bitrate 8000000 -v_keydist 30 -v_buffer 600000 -v_quality 100 -s_config own.weu
If using CBR mode, you generally don't want to use quality 100. That'll force the encoder to drop frames when the bitrate gets too low to maintain high image quality. If the encoder reports dropped frames or a framecount significantly smaller than the source framecount, change quality to 50 or lower. Otherwise, you can leave it for this encode.
ACrowley
6th April 2007, 06:23
If using CBR mode, you generally don't want to use quality 100. That'll force the encoder to drop frames when the bitrate gets too low to maintain high image quality. If the encoder reports dropped frames or a framecount significantly smaller than the source framecount, change quality to 50 or lower. Otherwise, you can leave it for this encode.
Mh... i never had Problems with dropped Frames from 1pass CBR encodes and quality 100. Not with SoftwarePlayers or Xbox360.
Xbox360 Playback is the main reason for my encodes
When i set it down to 50 isnt the Quality lower ?
And the encode is definitely faster with wmcmd.vbs copared with ProCoder..for the first look.
This encode now with wmcmd.vbs and the same WMV9 AP Settings took around 20h.
Its a 1080p HDDVD/VC1 164minutes 2.35:1 AR.
I encode to 1280x528( cropped) 8mbps WVC1 and the commandline from above.
With ProCoder a similar encode (same avs script,WVC1 Settings) took minimum 24h to encode !
However, i will use wmcmd.vbs in the future, so i have safely full control over all WMV9 AP Settings
A question about ProCoder:
What is the encoder doing in CBR 1pass encodes ?
I mean the File writing beginns until the Process Bar is in the Middle around 50%..other WMV encoders in 1pass CBR Mode starts to write directly at the beginning
Is it a kind of caching or analyzing whether ist 1pass ?
killerhex
7th April 2007, 23:36
hey how do i create presets for this encoder
buzzqw
8th April 2007, 09:20
for truly preset integrated in wmcmd.vbs (like these one ceated by Zambelli, fast, insane,better,good...) you must edit the wmcmd.vbs and add some line of code (not much... )
BHH
zambelli
8th April 2007, 09:52
for truly preset integrated in wmcmd.vbs (like these one ceated by Zambelli, fast, insane,better,good...) you must edit the wmcmd.vbs and add some line of code (not much... )
And if anyone has feedback about existing presets or suggestion for how to tweak them - I'm all ears.
Sagittaire
8th April 2007, 10:35
And if anyone has feedback about existing presets or suggestion for how to tweak them - I'm all ears.
Possible to active adaptative bframe ... ???
ACrowley
8th April 2007, 15:08
First i thought it was my mistake, but its true
From my current encode to WVC1 720p 9Mbps 1pass CBR :
cscript.exe C:\windows\wmcmd.vbs -input d:\test.avs -output d:\test100.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_bitrate 9000000 -v_preset better -v_keydist 30 -v_buffer 60000 -v_quality 100
The End Filesize is calculated to 7.5gb, but with Quality 80 its only 5,2 GB ?!
Test Sample encodes on H264 1080p Source:
These are the Statistics fter wmcmd.vbs encoding :
1 : v_quality 80 :
Video :
Codec: Windows Media Video 9 Advanced Profile
Expected bit rate: 9000000 bps
Average bit rate: 5912122 bps
Expected fps: 25
Dropped frame count: 0
Total coded frames: 535
Average sample rate: 25
Dropped bytes: 0 bytes
Total bytes: 15847906 bytes
Overall:
Encoding time: 171 seconds
Average bit rate: 5912122 bps
File size: 15933546 bytes
File duration: 21,393 seconds
2. v_quality 100
======== Encoding Completed ========
Video :
Codec: Windows Media Video 9 Advanced Profile
Expected bit rate: 9000000 bps
Average bit rate: 8986305 bps
Expected fps: 25
Dropped frame count: 0
Total coded frames: 535
Average sample rate: 18,848
Dropped bytes: 0 bytes
Total bytes: 24957774 bytes
Overall:
Encoding time: 177 seconds
Average bit rate: 8986305 bps
File size: 25077546 bytes
File duration: 21,393 seconds
So you can see with quality 80 the Output Filesite is smaller Q 80 is only 15MB, Q 100 is 23.9
The Average Bitrate with Q 80 is only at 5.9Mps
With Quality 100 its more efficient ?! with 8.9mbps
No dropped Frames with Q 100...i never had any dropped Frames in the past
So, whats up here ? Why controlls Quality Targetsize / Bitrate in 1pass CBR Mode ?
Mh...maybe ill switch to 2pass VBR
Clown shoes
8th April 2007, 17:33
I am very interested in encoding for maximum quality so the insane profile looks great. Would I gain anything from changing -v_performance to 100 and motion search level to luma and chroma? I have a dual quad core system, so hopefully that will cut the increased encoding time a little.
There seems to be very few people now using a two pass vbr system. Is there any reason for this bar encoding time? I want to encode my HD material to HQ files that will work on my Xbox360, getting as much out of the source as possible. Surely 2 pass VBR is the way to go?
My cmd line is as follows;
cscript.exe C:\Windows\wmcmd.vbs -input C:\test.avs -output C:\test.wmv -v_codec WVC1 -videoonly -v_mode 4 -v_bitrate 8000000 -v_peakbitrate 15000000 -v_preset insane -v_keydist 15 -v_buffer 60000
Clown shoes
8th April 2007, 21:33
I'm having problems encoding my audio with WMCmd.vbs I'm using an avisynth script Nicac3Source("C:\WMV encoding\Test\SAMPLE PID 081 T01 3_2ch 448Kbps DELAY 199ms.ac3", DRC=1) and my cmd line is cscript.exe C:\Windows\wmcmd.vbs -input C:\audio test.avs -output C:\audio.wma -a_codec WMAPRO -a_mode 0 -a_setting 440_48_6_24 -audioonly when I run my .bat it closes immediately. Any obvious mistakes I'm making?
zambelli
8th April 2007, 21:44
First i thought it was my mistake, but its true
cscript.exe C:\windows\wmcmd.vbs -input d:\test.avs -output d:\test100.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_bitrate 9000000 -v_preset better -v_keydist 30 -v_buffer 60000 -v_quality 100
So, whats up here ? Why controlls Quality Targetsize / Bitrate in 1pass CBR Mode ?
The v_quality is not the problem here. The problem is that you are encoding a 22 second source using a 60 second buffer. The ratecontrol can't possibly be accurate if it doesn't even get a chance to fill the buffer. The filesize you are getting is completely inproportionate to the bitrate - that should've been a clue right there. If you're using CBR, you must never set the buffer longer than the source itself - or else the ratecontrol will never have a chance to be correct.
zambelli
8th April 2007, 22:02
I am very interested in encoding for maximum quality so the insane profile looks great. Would I gain anything from changing -v_performance to 100 and motion search level to luma and chroma? I have a dual quad core system, so hopefully that will cut the increased encoding time a little.
-v_performance 100 will be much slower, but the quality increase will be so miniscule (if at all) it is really not worth it. Trust me. Motion Search in "insane" is already set to include full chroma at all times.
"Insane" is pretty much as good as it gets in motion estimation. Room for additional improvements exist in tweaking the v_bdeltaqp value (try 1 or 2 for start), v_dquantoption (2 if anything) and v_percopt (2 or 3 might work). The latter 2 options are likely to introduce some smoothing in certain areas in exchange for preserving finer detail in others. They are "perceptual optimizations". The video might look worse in an A/B comparison to the source, but it might actually be more visually pleasing when no reference is available. They're aren't "one size fits all" settings, though.
There seems to be very few people now using a two pass vbr system. Is there any reason for this bar encoding time? I want to encode my HD material to HQ files that will work on my Xbox360, getting as much out of the source as possible. Surely 2 pass VBR is the way to go?
Most Xbox users have reported that the current WMV decoder can't handle bitrates above a certain level - so that's why most people are using CBR for Xbox encoding. The good news is that there will possibly be a new WMV decoder in the next Xbox dashboard update that will be capable of handling high bitrates as good as the HD-DVD VC-1 decoder currently can.
cscript.exe C:\Windows\wmcmd.vbs -input C:\test.avs -output C:\test.wmv -v_codec WVC1 -videoonly -v_mode 4 -v_bitrate 8000000 -v_peakbitrate 15000000 -v_preset insane -v_keydist 15 -v_buffer 60000
You might be able to run that on the Xbox. Search the forums a little, see what other users have reported as practical high bitrates currently smoothly handled by the Xbox. BTW, the v_buffer setting won't do anything in that cmd line - it's the v_peakbuffer setting that matters in peak-constrained VBR mode. It is 5 sec by default.
I'm having problems encoding my audio with WMCmd.vbs I'm using an avisynth script Nicac3Source("C:\WMV encoding\Test\SAMPLE PID 081 T01 3_2ch 448Kbps DELAY 199ms.ac3", DRC=1) and my cmd line is cscript.exe C:\Windows\wmcmd.vbs -input C:\audio test.avs -output C:\audio.wma -a_codec WMAPRO -a_mode 0 -a_setting 440_48_6_24 -audioonly when I run my .bat it closes immediately.
Can you verify that the .avs plays back in GraphEdit or MPC? When played in MPC, what kind of info is the "Pin Info" tab showing under Play-->Filters-->Audio Switcher-->Properties? For stereo audio you might see something like this:
AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 1
cbFormat: 18
WAVEFORMATEX:
wFormatTag: 0x0001
nChannels: 2
nSamplesPerSec: 48000
nAvgBytesPerSec: 192000
nBlockAlign: 4
wBitsPerSample: 16
cbSize: 0 (extra bytes)
That pin info indicates what kind of audio format the Avisynth script is outputting and may help me troubleshoot the issue. I agree that multichannel audio input is somewhat of a sore spot in Wmcmd.vbs right now. I'll look into the option of adding separate audio inputs from the command line (currently -input expects audio and video muxed) and perhaps support for multi mono WAV inputs, if nothing else works.
Clown shoes
8th April 2007, 22:39
The .avs is being opened in Graphedit with ac3filter and displays all the channels correctly. The MPC pin info is as follows;
AM_MEDIA_TYPE:
majortype: MEDIATYPE_Audio {73647561-0000-0010-8000-00AA00389B71}
subtype: MEDIASUBTYPE_PCM {00000001-0000-0010-8000-00AA00389B71}
formattype: FORMAT_WaveFormatEx {05589F81-C356-11CE-BF01-00AA0055595A}
bFixedSizeSamples: 1
bTemporalCompression: 0
lSampleSize: 1
cbFormat: 40
WAVEFORMATEX:
wFormatTag: 0xfffe
nChannels: 6
nSamplesPerSec: 48000
nAvgBytesPerSec: 576000
nBlockAlign: 12
wBitsPerSample: 16
cbSize: 22 (extra bytes)
WAVEFORMATEXTENSIBLE:
wValidBitsPerSample: 16
dwChannelMask: 0x0000003f
SubFormat: {00000001-0000-0010-8000-00AA00389B71}
pbFormat:
0000: fe ff 06 00 80 bb 00 00 00 ca 08 00 0c 00 10 00 þÿ..€»...Ê......
0010: 16 00 10 00 3f 00 00 00 01 00 00 00 00 00 10 00 ....?...........
0020: 80 00 00 aa 00 38 9b 71 €..ª.8›q
What other options would I have to seperately encode audio to .wma? Windows media encoder throws an error when I try using it.
zambelli
8th April 2007, 23:18
What other options would I have to seperately encode audio to .wma? Windows media encoder throws an error when I try using it.
If you decode the AC3 to 6 mono WAV files using BeSweet, WME9 will take the 6 mono inputs and let you encode to multichannel WMA Pro.
Clown shoes
8th April 2007, 23:21
OK, I've worked out the problem. There was a space in the name of my .avs that was tripping up the command line. Once I took that out, it worked perfectly. I did notice one thing however. During my tests I tried encoding the raw .ac3, which was accepted without issue, but there was a small boosting of the levels which caused them to clip slightly. The .avs didn't have that problem.
zambelli
9th April 2007, 01:05
OK, I've worked out the problem. There was a space in the name of my .avs that was tripping up the command line. Once I took that out, it worked perfectly. I did notice one thing however. During my tests I tried encoding the raw .ac3, which was accepted without issue, but there was a small boosting of the levels which caused them to clip slightly. The .avs didn't have that problem.
When encoding from .ac3, AC3Filter or whatever other AC3 DShow decoder you have handles the decoding. When you use .avs, you're explicitly using Nic's AC3 plugin for decoding.
Clown shoes
9th April 2007, 01:52
Thanks Zambelli,
The reason I mention the audio issue is because it only becomes apparent once the .wma has been produced and only then when the source was the .ac3. The levels when the source is decoded normaly are fine and also when Nic's filter is used. It's just strange that .ac3 to .wma via WMCmd.vbs is the only workflow where I see this boosting of the levels.
I have read through the thread you refered to from last year regarding VC1 on the xbox360 and it appears my settings are well within safe limits. Halim even said that at 24fps, a bitrate of 20000kbps might be possible. if I wanted to produce 1080p files that would play back smoothly on the 360, do you think my settings of 8000kbps average and 15000kbps peak would be too high? There was also mention of the bitrate limitations being fixed in the next dashboard update. Is there any news on a ball park release date? Sorry I know that's not your your department, but I know you know some of the guys that do work more in that area :)
ACrowley
9th April 2007, 07:17
The v_quality is not the problem here. The problem is that you are encoding a 22 second source using a 60 second buffer. The ratecontrol can't possibly be accurate if it doesn't even get a chance to fill the buffer. The filesize you are getting is completely inproportionate to the bitrate - that should've been a clue right there. If you're using CBR, you must never set the buffer longer than the source itself - or else the ratecontrol will never have a chance to be correct.
ok..but V_quality is surly the Problem here
Same Results with all Buffer sizes 2,3,5,default on the sample
Also the Full 156min Movie is only 5.2 Gb and not 7.5 GB (without Audio).
Q 100 always give me exactly the calculated Targetsize
Same Problem on Full Movie
Quality 80:
Expected bit rate: 9000000 bps
Average bit rate: 5912122 bps
Q 100
Expected bit rate: 9000000 bps
Average bit rate: 8986305 bps
I think i will stick with Q100...cause i had never dropped Frame or somewhat
zambelli
9th April 2007, 09:45
Same Problem on Full Movie
Quality 80:
Expected bit rate: 9000000 bps
Average bit rate: 5912122 bps
Q 100
Expected bit rate: 9000000 bps
Average bit rate: 8986305 bps
:confused: But these are the same exact bitrate numbers you quoted earlier for a 23 second source. You're saying the bitrates turned out exactly the same for a 23 second source and 156 minute source? That doesn't sound right.
ACrowley
9th April 2007, 10:57
Yes ?
Same Source ,same commandline ,same CBR Bitrate
Gives me the same Results, the Log is from the Sample ,yes, but the Full encode shows the same.
I dont have the Log for the Full encode...but believe me its the same Problem
However....with Q80 its over 2Gb to small, thats the Main Point
I can reproduce it with any Source. Everytime the same Problem. So ,its not my mistake or somewaht.
Its simply the Q 80 what makes the Output File smaller with lower average Bitrate as it should be in 1pass CBR
@clownshoes
So far i can say about Peak Bitrate and Xbox360 is that i noticed choppy Playback sometimes.
It was a 9mbps Bitrate with 13.5Mbps Peak and the Video was choppy/freezing
With CBR no Problems.
zambelli
9th April 2007, 18:52
Yes ?
Same Source ,same commandline ,same CBR Bitrate
Gives me the same Results, the Log is from the Sample ,yes, but the Full encode shows the same.
I dont have the Log for the Full encode...but believe me its the same Problem
OK, something is fundementally wrong here. The chances of encoding a 23-second source and 156-minute source and getting the exact same bitrate as result - are almost impossible. That's like scoring the same lottery numbers twice in a row.
However....with Q80 its over 2Gb to small, thats the Main Point
I'm not sure your target bitrate calculation is correct either. A 7.5 GB target would require a bitrate of ~6828 kbps for a 156 minute source. Even if you got 9000 kbps, the size would be more than 7.5 GB.
I can reproduce it with any Source. Everytime the same Problem. So ,its not my mistake or somewaht.
Well, I'm not necessarily saying it's your mistake, but it sounds like there's a bigger problem present than codec ratecontrol just being slightly off.
Its simply the Q 80 what makes the Output File smaller with lower average Bitrate as it should be in 1pass CBR
I think there's something else going on here. How long does it currently take to encode your 156 minute source? What version of WM Format or WMP do you have installed?
Would you be able to upload an encoded 23-second WMV sample somewhere? Quality 80 or 100, doesn't matter.
twan69666
9th April 2007, 19:35
Hey Clownshoes,
The spring dashboard update is rumored to be out May 7th, and will be adding H.264 support along with some better mpeg 4 support. Im still going to tinker with HDDVD backups, but hopefully this update begins to unlock the 360's power
Clown shoes
9th April 2007, 21:52
Yeah, I read that today. Excellent news :)
ACrowley
10th April 2007, 07:13
OK, something is fundementally wrong here. The chances of encoding a 23-second source and 156-minute source and getting the exact same bitrate as result - are almost impossible. That's like scoring the same lottery numbers twice in a row.
I'm not sure your target bitrate calculation is correct either. A 7.5 GB target would require a bitrate of ~6828 kbps for a 156 minute source. Even if you got 9000 kbps, the size would be more than 7.5 GB.
Well, I'm not necessarily saying it's your mistake, but it sounds like there's a bigger problem present than codec ratecontrol just being slightly off.
I think there's something else going on here. How long does it currently take to encode your 156 minute source? What version of WM Format or WMP do you have installed?
Would you be able to upload an encoded 23-second WMV sample somewhere? Quality 80 or 100, doesn't matter.
i only told you the Results form the sample and the Full encode are similar. not the same!
For the Full Movie the encoded CBR Bitrate of 9mbps is only at 5.xMbps and not cloe to 9mbps as lile as with Q 100
Theres is nothing wrong here...believe me
Im encoding for a long time since today, and im not a Idiot or a newbie on this encoding Stuff
I use the latest WM11 Build wirh WVC1 with latest wmcmd.vbs
YOUR Calculator :
1h56min with a 8138MB (DVD9) Target and 640kbps Audio is : 9076.599
ALL encodes are by far to small with Q 80
With 120minutes and 185minutes, 20sec Samples... Wether Bitrate for VBR is calculated. ALL are to small with to low average Bitratel!
Why dont you make a small test by your own ?
Im sure your 1pass CBR encode with Q80 is smaller (with lower effective average Bitrate) and im sure everybody can reproduce it
I dont say the Codec Rate Control is wrong...works perfect (1passs CBR Q100/ 2pass VBR ),but in CBR 1pass the Quality Parameter seems to have this effect
Clown shoes
10th April 2007, 09:21
Yes I can confirm this. I just encoded a 2 hour film with similar settings to Crowley, except I left Q at the default of 75. cscript.exe C:\Windows\WMCmd.vbs -input I:\Serenity.avs -output H:\Serenity.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_preset better -v_bitrate 9000000 -v_buffer 600000 Calculations tell me this should have come in at nearly 8gig, however the file I have is just under 5gig.
zambelli
10th April 2007, 09:48
OK, I'll look into it and run some tests. BTW, Clownshoes, that 600 sec buffer is way too big (unless it was a typo). At 9 Mbps that means a decoder would need to allocate 640MB of memory to play back the video. I'd be very careful about ever allocating more than 60 seconds for the video buffer length.
buzzqw
10th April 2007, 09:56
just for report a humble test with Matrix film
Aimed at 700MB, this is the command line
cscript.exe WMCmd.vbs -input "movie.avs" -output "movie.wmv" -v_codec WVC1 -v_mode 3 -v_bitrate 564000 -s_config "wmv_crb" -v_preset best -v_dquantoption 3 -v_bdeltaqp 1 -a_codec wmapro -a_mode 0 -title "VTS_02_0" -year 2007 -copyright "Done with AutoMKV! 0.80b" -a_setting 128_48_2_24
after 07h:49m:42s have a pleasing 704*304 wmv of 710mb.. just a little more mb then expected... (bitrate computed is correct)
BHH
Clown shoes
10th April 2007, 10:08
I think the issue is only with video mode 0, constant bitrate.
@Zambelli, yes thanks for noticing that. An extra pesky 0 got into my script :)
ACrowley
10th April 2007, 12:31
Sounds like you're encoding in 1-pass VBR mode. In that mode higher complexity/performance will only decrease the size of the encoded file because the quality is fixed (hence the name "Quality VBR"). In every other mode the bitrate will stay the same but the quality will improve due to better motion estimation algorithms used.
Also, encoding times change dramatically between 0 and 80. You can go literally from faster-than-realtime encoding to wake-me-up-when-it's-done encoding.
I dont know what i should tell you more...
I encode in 1pass CBR , -v_codec wvc1 -v_mode 0
Batch :
cmd /k cscript.exe C:\windows\wmcmd.vbs -input g:\Parfuem\Parfuem.avs -output g:\parfuem\parfuem.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_bitrate 7020000 -v_preset better -v_buffer 60000 -v_quality 100
However, i have no dropped Frames .. so i use Q100
Q 100 holds exactly the definied Bitrate ,works perfect ,No Problems
And when the new xbox360 Update is there ,perhaps i encode 2pass VBR Peak
Clownshoes can REPRODUCE IT !!, so ....its 100% not my mistake
Clown shoes
10th April 2007, 12:47
@Crowley
I'm going to try a 2 pass peak encode now. Average 9000kbps peak 12000kbps. That should stay within current acceptable limits for the 360. I can't wait untill the update when we can really test out VC1 capabilities.
cscript.exe C:\Windows\WMCmd.vbs -input I:\Serenity.avs -output H:\Serenity.wmv -v_codec WVC1 -videoonly -v_mode 4 -v_preset best -v_bitrate 9000000 -v_peakbitrate 12000000 -v_buffer 60000
@Zambelli, can you tell me the difference between the performance and complexity settings? and do they have any use in a peak VBR encode?
ACrowley
10th April 2007, 13:12
me to...VC1 becomes Mutithreading with the Update..nice
12Mbps Peak should be close to the max. Peak for the current Decoder
On my U571 HDDVD reencode in 720p WVC1 ~9Mbps and 13.5Mbps Peak it was not smooth
But i am satisfied with 1pass CBR at high Bitrates.
With preset better ,a 60000Buffer ,Q100,and min. 7Mbps for 720p, min. 14Mbps for 1080p ,it delivers very good Quality
After the Update i will encode 2pass VBR Peak.
But 1 Problem is left with the 360 and Peak Bitrate.
So far i know The Update is only for the Dashboard!
For H264 i know it surely, No MediaCenter and H264.
When its for WMV9 AP too, we can only use VC1 High in Dashboard/GameDrive/ MediaConnect
We will see
zambelli
10th April 2007, 19:13
@Zambelli, can you tell me the difference between the performance and complexity settings? and do they have any use in a peak VBR encode?
Yes, performance/complexity is used in every mode. It affects many things, most related to motion estimation precision. 60/3 is the default. You can try 80/4 and 40/2 for slower/faster encoding, but I wouldn't recommend going higher or lower than that.
Clown shoes
10th April 2007, 19:43
What I meant was, complexity is listed under the wmcmd.vbs readme as "Same as v_performance but expressed on a scale from 0 to 5" So do they do exactly the same thing? and if so, why do they both exist?
zambelli
11th April 2007, 04:39
What I meant was, complexity is listed under the wmcmd.vbs readme as "Same as v_performance but expressed on a scale from 0 to 5" So do they do exactly the same thing? and if so, why do they both exist?
Yes, they're exactly the same. Internally the codec complexity levels are mapped on a scale from 0 to 5, so it's always been unnecessarily confusing to have v_performance on a 0 to 100 scale in 20 point increments. It just made more sense to call complexity what it is and express it on its native scale.
zambelli
12th April 2007, 05:06
cscript.exe C:\windows\wmcmd.vbs -input g:\Parfuem\Parfuem.avs -output g:\parfuem\parfuem.wmv -v_codec WVC1 -videoonly -v_mode 0 -v_bitrate 7020000 -v_preset better -v_buffer 60000 -v_quality 100
Well, I tried this on two sources: one a 704x384 24p 3 minute source, and the other a 1280x720 25p 2.5 minute source. I used a target bitrate of 1000kbps and 7000kbps respectively.
I tried quality 100, 80 and 50 and the bitrates came out about the same, within 2% of the target bitrate. So I'm really not sure what's causing the bitrate issues you're seeing. :confused:
Can you try using a smaller bitrate and see if you get similar behavior? How about if you use a higher bitrate?
zambelli
12th April 2007, 11:58
New version of WMCmd.vbs is out. Here's the changelist:
4-12-2007:
----------
IMPORTANT CHANGE: Remapped -v_mslevel (Motion Search Level) values to correctly reflect the codec implementation. 0 is now the default luma search and 3 and 4 are adaptive chroma modes. If you're using WMCmd.vbs in another tool (i.e. AutoMKV), make sure you update your code.
Added an -a_input option that allows specifying an alternative audio source to the one present in the main -input source. This makes it possible to use separate video and audio source files from the command-line, as it's always been possible in the WME9 GUI.
Updated the documentation, expanded sections on dquant and perceptual optimization options. Very useful options for preserving fine detail.
Fixed a bug where simultaneous encoding jobs would get simultaneously killed as soon as one encoding job finished.
NHRaider
12th April 2007, 12:28
noob question...
When I run the script, I get the warning: "Warning: Encoder failed to retrieve duration attribute from source plug-in. Trying alternate method now...".
When I use the calculated frames from EVO in video.avs (below), it doesn't come back with the calculated time, percentage complete, etc. It will encode the movie but the script looks like it doesn't complete and never closes and provide the stats for encoding. Also, the movie doesn't allow fast forward etc. (Note: the output file will not have a duration in Explore when I look at the directory)
If I don't specify framecount in the video.avs it will find a duration and give me the % completion, etc. However, the video stops at 50 minutes during playback but the audio will continue. (Note: the output file will have a duration in Explore when I look at the directory and will be the correct duration time 1:39)
How can I run the script to get the fastforward feature and also get duration information so I know progress on the encoding??
*********************************************
For the video.avs:
Directshowsource("video_only.GRF", fps=23.976, audio=false, seekzero=false, seek=true).trim(0,140000)
Generate.bat:
cscript.exe "c:\program files\windows media components\encoder\wmcmd.vbs" -input "audioandvideo.avs" -output "output.wmv" -v_codec wmv9 -v_mode 0 -v_bitrate 8000000 -v_keydist 30 -v_buffer 600000 -v_quality 75 -a_codec WMAPRO -a_mode 0 -a_setting 384_48_6_16
ACrowley
12th April 2007, 14:52
seems to be normal when you encode via Directshowsoucre ,that wmcmd use a alternative Method to load the Source..
Dont know what it means, but i have thge same Mesaage without Problems.
Your seeking Problem:
You can seek the output after the encode is finished cause the wmv index is complete. Then you have your duration and full seeking.
When you want to fix a aborted output , run it through WMStreameditor
I made a lot of HDDVD VC1 encodes with Directshowsource and SonicVideoDecoder.
WMcmd shows me the correct Source duration in seconds and after encoding the Stats have the correct Framecount with encoded frames and the Output is perfect
For example :
C:\Programme\Windows Media-Komponenten\Encoder>cmd /k cscript.exe C:\windows\wmc
md.vbs -input g:\Parfuem\Parfuem.avs -output g:\parfuem\parfuem.wmv -v_codec WVC
1 -videoonly -v_mode 0 -v_bitrate 7020000 -v_preset better -v_buffer 60000 -v_qu
ality 100
Microsoft (R) Windows Script Host, Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. Alle Rechte vorbehalten.
Microsoft (R) Windows Media Encoder Command Line Script Utility
Copyright (C) Microsoft Corporation. All rights reserved.
Warning: Encoder failed to retrieve duration attribute from source plug-in.
Trying alternate method now......
Source duration retrieved: 8853,943 seconds.
Encoded: 8853,6s (100%) Elapsed: 17:14:02 Left: 00:00:02 [0,14x]
======== Encoding Completed ========
Video :
Codec: Windows Media Video 9 Advanced Profile
Expected bit rate: 7020000 bps
Average bit rate: 6719201 bps
Expected fps: 23,976
Dropped frame count: 0
Total coded frames: 212282
Average sample rate: 23,952
Dropped bytes: 0 bytes
Total bytes: 7436396454 bytes
Overall:
Encoding time: 62053 seconds
Average bit rate: 6719201 bps
File size: 7470570538 bytes
File duration: 8853,934 seconds
C:\Programme\Windows Media-Komponenten\Encoder>
zambelli
12th April 2007, 18:47
When I run the script, I get the warning: "Warning: Encoder failed to retrieve duration attribute from source plug-in. Trying alternate method now...".
Yeah, that's normal when using .avs as sources.
If I don't specify framecount in the video.avs it will find a duration and give me the % completion, etc. However, the video stops at 50 minutes during playback but the audio will continue. (Note: the output file will have a duration in Explore when I look at the directory and will be the correct duration time 1:39)
How can I run the script to get the fastforward feature and also get duration information so I know progress on the encoding??
Are you encoding the video and audio separately? If you're muxing them together in the .avs file, can you verify they are the same length?
WMcmd is just relying on DirectShow and WMP to report the correct lengh of the .avs source. If you can get it to play back in WMP - it will report the correct length in Wmcmd too.
buzzqw
12th April 2007, 19:18
just to report that the update version will crash cscript.exe using -a_input (on win 2003 server) BUT is ok on winxp pro...
on win2k3 without using the -a_input but feeding wmcmd.vbs with avs that dubbed audio and video is working
One more: seems that -v_percopt isn't use in your preset (at last looking inside wmvcmd.vbs), why ?
BHH
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.