Hydrogenaudio Forums

Hydrogenaudio Forum => Uploads => Topic started by: lvqcl on 2011-08-30 21:13:37

Title: Command-line WMA encoder
Post by: lvqcl on 2011-08-30 21:13:37
Here is command-line WMA encoder. Inspired by this thread (http://www.hydrogenaudio.org/forums/index.php?showtopic=85654).
Requirements: Windows XP or later, Window Media Codecs installed.

Usage examples:

WmaEncode --codec lossless in.wav out.wma
WmaEncode -c lsl in.wav out.wma

WmaEncode --codec pro --quality 90 in.wav out.wma
WmaEncode -c pro -q 90 in.wav out.wma

WmaEncode --mode vbr2pass --bitrate 128 in.wav out.wma
WmaEncode -m vbr2pass -b 128 in.wav out.wma

...etc.

Sources included. Don't expect them to be well-commented though.

---------
changelog:
0.2.9c: another minor fix in WAV parsing.
0.2.9b: minor fixes in WAV parsing. Sources are attached as a separate file.
0.2.9a: new switches -c, -m, -i, -s (short versions of --codec, --mode, --ignorelength, --silent)
0.2.9: maintenance update
0.2.8: allows 2-pass mode for stdin by default
0.2.7: progress indicator added
0.2.6: raw PCM input added
Title: Command-line WMA encoder
Post by: mudlord on 2011-08-30 23:02:03
Any source?
Title: Command-line WMA encoder
Post by: lvqcl on 2011-08-31 15:43:47
The sources will be uploaded later. Want to add comments, etc.
Maybe someone will find bugs in the program meanwhile...
Title: Command-line WMA encoder
Post by: b66pak on 2011-08-31 19:23:45
thanks a lot...
_
Title: Command-line WMA encoder
Post by: mudlord on 2011-08-31 23:42:16
Cool, just was wondering since it would be nice to make a WMAdrop
Title: Command-line WMA encoder
Post by: lvqcl on 2011-09-02 16:24:59
Version 0.2.5 was uploaded. Several bugs were fixed, probably new added.
Sources included.
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-03 17:40:37
thanks a lot...
_

please, could you enable (add) wma/wmv input support? this is very handy for quick wma/wmv multichannel transcoding to wma stereo!
_

you don't have to do something special...WMEncoder has support for .wav and .wmv/.wma input (and pcm in .avi too)...all you have to do is to allow it...
Title: Command-line WMA encoder
Post by: lvqcl on 2011-09-03 17:48:14
you don't have to do something special...WMEncoder has support for .wav and .wmv/.wma input (and pcm in .avi too)...all you have to do is to allow it...


Where and what should be allowed?
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-03 18:03:27
with WMEncoder installed on WinXP i can do this:

Code: [Select]
cmd /c cscript.exe "C:\Program Files\Windows Media Components\Encoder\wmcmd.vbs" -input audio6.wma -output audio2.wma -audioonly -a_codec WMA9PRO -a_mode 0 -a_setting 256_48_2_24


this is a proof that WMEncoder can decode .wmv/.wma...


this line is identical:

Code: [Select]
WMAEncode --codec pro --mode cbr --bitrate 256 --out-channels 2 audio6.wma audio2.wma


but i get:

Code: [Select]
Not a valid WAV file

_
Title: Command-line WMA encoder
Post by: lvqcl on 2011-09-03 18:29:44
All right, but my program doesn't use Windows Media Encoder at all - it uses functions from Wmvcore.dll.
For my encoder to read WMA/WMV files, another reading functions should be added to the program, and I have no plans to do this.
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-04 17:05:27
please, can you add support for raw pcm input?

suggestion for syntax:

--raw: signals raw pcm input
--in-samplerate n: sets intput format with n samples per second
--in-channels n: sets intput format with n channels
--in-bitdepth n: sets intput format with n bits per sample

to avoid confusion maybe "--priority" should become "--lowpriority"
_
Title: Command-line WMA encoder
Post by: Nick.C on 2011-09-04 20:32:45
Mono now working. Thanks!
Title: Command-line WMA encoder
Post by: lvqcl on 2011-09-06 15:18:55
Version 0.2.6, with raw PCM input support.
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-06 18:00:08
thanks a lot...
_
Title: Command-line WMA encoder
Post by: lvqcl on 2011-09-13 17:54:13
Version 0.2.7: progress report was added by request. Also added --silent switch to disable it.
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-13 17:57:56
thanks a lot...
_
Title: Command-line WMA encoder
Post by: dpc666 on 2011-09-16 19:50:37
Thank you so much! Microsoft inexplicably has completely removed any command line support in their wma encoder running under Windows 7.
Title: Command-line WMA encoder
Post by: b66pak on 2011-09-19 18:48:19
thanks a lot...
_
Title: Command-line WMA encoder
Post by: jaro1 on 2011-09-24 14:20:26
Once more many thanks for this encoder, i use it very often, its a shame something like this wasn't made by MS himself, using wme was useless and uncomfortable for me, as i always wanted only audio conversion.
Title: Command-line WMA encoder
Post by: b66pak on 2011-11-03 17:28:58
thanks a lot...change log?
_
Title: Command-line WMA encoder
Post by: Polosa on 2011-11-22 01:00:05
WMA TAG Does not support unicode (UTF-8) text
Title: Command-line WMA encoder
Post by: lvqcl on 2011-11-22 14:39:55
The tags are of type WMT_TYPE_STRING (http://msdn.microsoft.com/en-us/library/windows/desktop/dd757834.aspx) ("null-terminated Unicode string"). And Unicode in Windows (http://msdn.microsoft.com/en-us/library/windows/desktop/dd374081.aspx) means UTF-16.

Title: Command-line WMA encoder
Post by: b66pak on 2011-12-25 18:35:55
thanks a lot...
_
Title: Command-line WMA encoder
Post by: jaro1 on 2011-12-25 18:52:56
Thank you very much for development
Title: Command-line WMA encoder
Post by: jsheridan on 2011-12-30 12:43:50
Thanks alot, i was waiting for this type of app!
Title: Command-line WMA encoder
Post by: xorsyst on 2012-05-10 12:50:11
This is great, thanks.  Any chance of adding a --scale option to scale the input source, as lame and oggenc2 support?
Title: Command-line WMA encoder
Post by: bernhold on 2013-03-23 20:35:06
I have made a small wrapper command line tool for the new Microsoft Expression Encoder WMA Encoder, which supports WMA 9 and WMA Professional 10.

You can use it like:

wmaenc -i input.wav -o output.wma

It requires the Microsoft Expression Encoder to be installed, otherwise it won't work. Do a google search on where to download it. Also, please note this is not a polished piece of software, merely a quick and dirty tool, so there may be errors and quirks. But it does the job for me.

I also attached the source code (c# visual studio) in case you want to see how it's basically done, you may want to write your own version.
Title: Command-line WMA encoder
Post by: emte on 2013-04-06 19:43:48
Hi,

Could you give me exact line I should give foobar to convert a file to wma pro q50?
Title: Command-line WMA encoder
Post by: lvqcl on 2013-04-06 20:25:22
Code: [Select]
--codec pro --quality 50 - %d
Title: Command-line WMA encoder
Post by: eahm on 2013-04-06 22:15:16
EZ CD Audio Converter supports WMA 11. It that version worse than 9 and 10?

http://www.poikosoft.com/help/encoder_versions.html (http://www.poikosoft.com/help/encoder_versions.html)
Title: Command-line WMA encoder
Post by: bernhold on 2013-04-10 22:38:02
EZ CD Audio Converter supports WMA 11. It that version worse than 9 and 10?

http://www.poikosoft.com/help/encoder_versions.html (http://www.poikosoft.com/help/encoder_versions.html)


It says Windows Media Format 11, not WMA 11. WMF is not an audio codec.

http://msdn.microsoft.com/en-us/library/wi...8(v=vs.85).aspx (http://msdn.microsoft.com/en-us/library/windows/desktop/dd757738(v=vs.85).aspx)

At least that's how I understood it, I'm not that familiar with Windows Media Format.

WMA 9 and WMA 10 Professional are the newest codecs currently available.
Title: Command-line WMA encoder
Post by: eahm on 2013-04-11 20:36:13
bernhold, thanks for that.

lvqcl, wha do I need to install to use "-c voice"? I keep getting "Requested encoder not found".
Title: Command-line WMA encoder
Post by: eahm on 2013-04-11 22:09:28
My bad I was using the wrong command, everything works perfectly. Thanks.
Title: Command-line WMA encoder
Post by: temp1 on 2013-04-12 02:40:47
thank u,lvqcl
love it.
fb2k+windows 8 pro
works perfect
Title: Command-line WMA encoder
Post by: lixtary on 2013-07-03 10:41:37
Hi!lvqcl ,thank you very much ,your encode is just what i want to find.this time i can convert music to .wma more conveniently.I'm very glad to see your achievement!!!
Title: Command-line WMA encoder
Post by: Kreisch on 2014-04-23 15:04:09
Thank you for making this handy tool available. I can't seem to get stereo to mono downmix working, though. Here's what I've tried:

Code: [Select]
input file as per ffmpeg:
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16, 1411 kb/s

wmaencode --out-channels 1 "links, rechts.wav"

output file as per ffmpeg:
Stream #0:0(ger): Audio: wmav2 (a[1][0][0] / 0x0161), 44100 Hz, stereo, fltp, 128 kb/s

And it is stereo indeed, verified using my ears. What am I missing?
Title: Command-line WMA encoder
Post by: lvqcl on 2014-04-23 15:17:32
a) WMAencode doesn't downmix itself. It asks Windows Media Runtime to do this (the same is true for --out-samplerate and --out-bitdepth options)
b) 128 kbps mono wma files aren't supported by WM Runtime, so it ignores downmix request.

Try to create 48 kbps WMA file and you'll see that --out-channels 1 works in this case.
Title: Command-line WMA encoder
Post by: Kreisch on 2014-04-23 17:26:40
Thank you for your prompt reply. It works as you're saying.

So, knowing that the Windows Media Runtime does not blindly support any random combination of encoding parameters but only specific ones, the user can find clues about what the combinations are and what parameters to supply by reading wmaencode --print-formats.
Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-15 22:40:01
lvqcl, I just wanted to say thank you for putting this app together. Years ago, while I was working at Microsoft, I had made modifications to the original WMCmd.vbs (http://citizeninsomniac.com/WMV/#WMCmd (http://citizeninsomniac.com/WMV/#WMCmd)) that allowed a lot of advanced functionality for VC-1 and WMA encoding, but I'm glad somebody just skipped the entire WME9 SDK altogether and did a native implementation based on the WM Format SDK (or Media Foundation, whichever one you used). That's definitely the best way to go.


Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-16 02:45:54
I have a feature suggestion too:

It'd be really nice if the tool was able to:

1) print to screen the DLL version of the WMA encoder DMO (wmadmoe.dll) installed on the system

2) embed the WMA encoder DLL version into the "WM/ToolVersion" or "WM/EncodingSettings" ASF attribute, so it's documented which WMA codec version was used


 

Title: Command-line WMA encoder
Post by: lvqcl on 2015-01-16 15:45:45
2) embed the WMA encoder DLL version into the "WM/ToolVersion" or "WM/EncodingSettings" ASF attribute, so it's documented which WMA codec version was used

When I open .wma file in Winamp, I can see in its properties:
Code: [Select]
WMFSDKVersion      12.0.7601.17514

so it's sort of documented already.
Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-17 00:00:17
When I open .wma file in Winamp, I can see in its properties: WMFSDKVersion     12.0.7601.17514 so it's sort of documented already.


Oh, good call. I was only checking with MediaInfo, which probably only registers a subset of ASF attributes. When I checked with ASF Viewer, I was able to see the attribute you mentioned. Thanks!
Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-24 00:37:46
lvqcl, I have another question:

Do you know which encoder complexity value (MFPKEY_ENCCOMPLEXITY) you're using for WMA Lossless?

Looks like the default value changed from 100 (worst performance, best efficiency) to 0 (best performance, worst efficiency) between Vista and Win7, which is probably something most people are unaware of. https://msdn.microsoft.com/en-us/library/wi...9(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/ff819329(v=vs.85).aspx)


Title: Command-line WMA encoder
Post by: lvqcl on 2015-01-24 08:09:53
This program uses Windows Media Format SDK, not Media Foundation. So I have no idea and I'm not sure that this property is applicable to WMF SDK.
Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-25 08:03:10
This program uses Windows Media Format SDK, not Media Foundation. So I have no idea and I'm not sure that this property is applicable to WMF SDK.


It's been a while since I've used them, but I believe every MFT property is also exposed as a DMO property and configurable via the IPropertyBag interface.  I'm not sure if the property names are the same or if you have to query the interface first for a complete list, but you should be able to get to them one way or another. https://msdn.microsoft.com/en-us/library/wi...8(v=vs.85).aspx (https://msdn.microsoft.com/en-us/library/windows/desktop/dd443228(v=vs.85).aspx) might shed more light on the matter.

Title: Command-line WMA encoder
Post by: lvqcl on 2015-01-25 11:18:17
According to https://technet.microsoft.com/en-US/ff819329 (https://technet.microsoft.com/en-US/ff819329)
Quote
Available only by using IPropertyStore.

So, no luck.
Title: Command-line WMA encoder
Post by: CitizenInsomniac on 2015-01-26 10:50:09
Available only by using IPropertyStore.

So, no luck.
 

  Is there a way to query IPropertyBag for a list of available properties?

I don't remember specifically for WMA encode, but I do remember for WMV9 (VC-1) encoder that there was a 1:1 mapping between DMO and MFT properties.

Consider that most of these codecs were developed before Media Foundation was introduced in Vista, so it would make sense that their properties were primarily exposed via the DMO interface and then later supplemented via the MFT interface. I'd be very surprised if the DMO property bag was completely disabled.

Title: Command-line WMA encoder
Post by: lvqcl on 2015-01-26 15:44:10
Is there a way to query IPropertyBag for a list of available properties?

I have no idea. I'm not very familiar with COM, interfaces, and so on.
Title: Re: Command-line WMA encoder
Post by: ever_boy on 2016-11-12 01:49:14
I do realize this is an ancient thread, but since it talks about windows media encoder, and the owner seems to have a great knowledge about this application...

Is there any chance of making WMAVoice ENCODER available for ffmpeg? That would be very nice since I can't seem to get the same quality at such low bitrates (5~7kbps for dialogues) even with Opus and the such (not to mention it's not natively suported by WMP).
Title: Re: Command-line WMA encoder
Post by: andrew.46 on 2016-11-29 05:02:22
@lvqcl Is there are a bare minimum subset of  Windows Media Format SDK that is required to allow WMAEncode.exe to run? That is: a list of required dlls rather than a simple installation of the full Windows Media Format SDK  package...
Title: Re: Command-line WMA encoder
Post by: lvqcl on 2016-11-29 18:21:01
I don't know about such list. Also remember that you need to register those DLLd anyway (via regsvr32).
Title: Re: Command-line WMA encoder
Post by: andrew.46 on 2016-12-01 01:10:19
I don't know about such list. Also remember that you need to register those DLLd anyway (via regsvr32).

I confess that my aim is to use your encoder under Linux and Wine, so I am trying to work out the most minimal installation required under Wine to get it all running...
Title: Re: Command-line WMA encoder
Post by: John Silver on 2016-12-07 23:27:35
How to make so that at 48 kbps encoding, he circumcised at 16 kHz instead of 12 kHz?
Title: Re: Command-line WMA encoder
Post by: kode54 on 2016-12-07 23:38:33
You likely mean the low pass filtering. Sorry, if you want that much frequency response from that low a bitrate, you'll either need to use WMA Pro, or another codec, such as Opus or AAC HEv2.

(Quick hint, most English speaking people only use that word to refer to the removal of the foreskin from the penis.)
Title: Re: Command-line WMA encoder
Post by: John Silver on 2016-12-08 13:17:08
wma standart play almost all mp3 players. WMA Pro, Opus and AAC HEv2 almost no one plays.
Title: Re: Command-line WMA encoder
Post by: kode54 on 2016-12-09 00:30:23
Good luck finding a high quality third party WMA encoder. Microsoft's encoder won't let you change anything other than the bitrate profile.
Title: Re: Command-line WMA encoder
Post by: JunkieXL on 2020-01-19 00:46:26
Can someone please help me with this encoder?  I'm trying to run a FLAC to WMA (lossless) conversion, but need help pointing to the correct encoder and using the correct parameters.

My car's GraceNote system only supports lossless in WMA format for some odd reason.  No FLAC or ALAC.
JXL
Title: Re: Command-line WMA encoder
Post by: JunkieXL on 2020-01-19 03:02:19
Nevermind.  I figured it out.

Place both WMAEncode,exe and WMAEncode64.exe in the C:/Windows/Program Files (x86)/Foobar2000/Encoders/ folder.

Select custom encoder and set the encoder file as the WMAEncode64.exe file that you just saved.  At least that is what worked for me on Windows 10.

Encoder file: C:/Windows/Program Files (x86)/Foobar2000/Encoders/WMAEncode64.exe
Extension: wma
Parameters: --codec lossless -input %s -output %d

Am I missing anything?

Thanks in advance.
JXL
Title: Re: Command-line WMA encoder
Post by: JunkieXL on 2020-01-26 16:54:05
Update: --silent --codec lossless - %d

Works flawlessly, but the GraceNote POS system does not support gapless playback when connecting your music via a flash drive or SSD.  I can only get gapless playback from my iPod Classic through the USB connection.  Even my Samsung S10 has a pause between tracks when hooked up via USB.... total joke.  What else should I expect from a software designed by a Sony owned company? MP3, AAC, and WMA files loaded on a flash drive, my Samsung S10, and a 500 GB SSD all played and the tags were readable and searchable through the HUD, but there was a pause between each and every track..  kills DJ mixes completely. *GRACENOTE FAILS*

FYI... fully updated GraceNote in my car to the latest and did a bunch of research on it.  Looks like I'll have to shell out $450 to get Android Auto installed in my car from the dealership.  They have an upgrade program going on that replaces the USB hub with a more powerful one and installs Android Auto in the car.  Might fix this mess and allow me to enjoy lossless and gapless music in my ride.
JXL
SimplePortal 1.0.0 RC1 © 2008-2020