Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: How to set up Converter for WMA 9 (Read 140084 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

How to set up Converter for WMA 9

Reply #75
different problem now...

Quote
1 out of 1 tracks converted with major problems.

Source: "C:\Users\Studio\Music\Beethoven, Ludwig van\Beethoven - Symphonien Nos. 7 & 8\08 Symphonie Nr. 8 F-dur op. 93- 4. Allegro vivace.flac"
  An error occurred while writing to file (The encoder has terminated prematurely with code 0 (0x00000000); please re-check parameters) : "C:\Users\Studio\Music\Beethoven, Ludwig van\WMA Test\08 Symphonie Nr. 8 F-dur op. 93- 4. Allegro vivace.wma"
  Additional information:
  Encoder stream format: 44100Hz / 2ch / 16bps
  Command line: "C:\Windows\System32\cscript.exe" "C:\Program Files (x86)\Windows Media Components\Encoder\WMCmd.vbs" //NoLogo --silent --codec lossless - "08 Symphonie Nr. 8 F-dur op. 93- 4. Allegro vivace.wma"
  Working folder: C:\Users\Studio\Music\Beethoven, Ludwig van\WMA Test\
 
  Conversion failed: The encoder has terminated prematurely with code 0 (0x00000000); please re-check parameters


My parameters:

C:\Windows\System32\cscript.exe
"C:\Program Files (x86)\Windows Media Components\Encoder\WMCmd.vbs" //NoLogo --silent --codec lossless - %d

I found this thread

http://forum.doom9.org/showthread.php?t=123812

looking for hte "cheat sheet"

tried firing up a terminaland changing directory to C:\Program Files (x86)\Windows Media Components\Encoder

then wmcmd.vbs -a_codecs

to see what the correct options were

I got this error in a window marked "Windows Script Host"

Script: C:\Program Files x(86)\Windows Media Components\Encoder\WMCmd.vbs
Line: 18
Char: 2
Error: Variable is undefined: 'WshShell'
Code: 800A01F4
Source: Microsoft VBScript runtime error

I'm about lost now...

How to set up Converter for WMA 9

Reply #76
If anyone interested in lossless WMA with more uptodate Expression encoder with foobar2000 on win7 64bit, then I've added comments to Jon Knepp's script (https://kneppscript.wordpress.com/2011/03/25/encoding-wma-files-using-powershell-and-microsoft-expression-encoder/) on setting it up...

You just need Expression encoder and PowerShell 4 installed. Tagging also works.

foobar_WMACompress.ps1
Code: [Select]
<#

EAC_WMACompress.ps1
Purpose:
 Used to convert/compress individual media files using Microsoft Expression Encoder.

Requirements:
 -  Microsoft Expression Encoder
 (http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5c3c5f97-678c-4c99-a7fc-f84f320c626f)
 -  Expression Encoder requires .NET 4.0 assemblies therefore PowerShell must be
 configured to support the .NET 4.0 CLR (http://msdn.microsoft.com/en-us/library/w4atty68.aspx)
 The following content will need to be saved as 'powershell.exe.config' in the appropriate
 powershell home directory a.k.a. $psHome (e.g. C:\WINDOWS\system32\windowspowershell\v1.0 or
 C:\WINDOWS\syswow64\windowspowershell\v1.0 on 64-bit systems):
 <?xml version="1.0" encoding="utf-8" ?>
 <configuration>
 <!-- [url=http://msdn.microsoft.com/en-us/library/w4atty68.aspx]http://msdn.microsoft.com/en-us/library/w4atty68.aspx[/url] -->
 <startup useLegacyV2RuntimeActivationPolicy="true">
 <supportedRuntime version="v4.0.30319" />
 <supportedRuntime version="v3.5" />
 <supportedRuntime version="v3.0" />
 <supportedRuntime version="v2.0.50727" />
 </startup>
 </configuration>
 -  The Microsoft Expression Encoder libraries are 32-bit only, therefore this script
 will only work under a PowerShell (x86) session when run on a 64-bit system

Created 3/24/2011
By Jon Knepp

New instructions for foobar2000 (on Windows 7 64bit):
 - Install Microsoft Expression Encoder (http://www.microsoft.com/expression/eng/)
 - Install PowerShell (http://microsoft.com/powershell)
 - Replace %USERPROFILE% with direct paths in this script
 - Copy script and wmalpreset.xml into %USERPROFILE%\AppData\Roaming\foobar2000\
 - Create encoder preset in foobar2000:
  Encoder file: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
  Extension: wma
  Parameters: -executionpolicy remotesigned -noninteractive -noprofile -file "%USERPROFILE%\AppData\Roaming\foobar2000\foobar_WMACompress.ps1" %s %d
  Format is: lossless (or hybrid)
  Highest BPS mode supported: 24
  Encoder name: WMA Lossless

Added 1/11/2015
mehemed

#>

param ( [string]$Source,
 [string]$Destination,
 [string]$Comment,
 [string]$Artist = $($AlbumArtist),
 [string]$Title,
 [string]$AlbumArtist = $($Artist),
 [string]$Album,
 [string]$Year,
 [int]$Track,
 [string]$Genre,
 [string]$Preset = $("WMA Lossless 5.1 Audio")
 )

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Expression.Encoder") | Out-Null
$job = New-Object Microsoft.Expression.Encoder.Job

#$systemPresets = [Microsoft.Expression.Encoder.Preset]::SystemPresets
#$jobPreset = $systemPresets | ? { $_.Name -match $Preset }
$encoderPreset = [Microsoft.Expression.Encoder.Preset]::FromFile("%USERPROFILE%\AppData\Roaming\foobar2000\wmalpreset.xml")

if (Test-Path -Path $Source) { $srcFile = Get-ChildItem $Source }
else { throw "Source file ($Source) could not be found." }

if ($Destination) {
 $outFile = Split-Path -Leaf $Destination
 $outputDir = Split-Path -Parent $Destination
}
if (!$outputDir) { $outputDir = $PWD.Path }

try {
 # Define Encoder MediaItem
 $mediaItem = New-Object Microsoft.Expression.Encoder.MediaItem($srcFile)
 # Assign tag metadata to the new MediaItem
 if ($Destination) {    $mediaItem.OutputFileName = $outFile }
 if ($Title) { $mediaItem.Metadata["Title"] = $Title }
 if ($Artist) { $mediaItem.Metadata["Artist"] = $Artist }
 if ($Track) { $mediaItem.Metadata["Track"] = $Track }
 if ($AlbumArtist) { $mediaItem.Metadata["Album Artist"] = $AlbumArtist }
 if ($Album) { $mediaItem.Metadata["Album"] = $Album }
 if ($Year) { $mediaItem.Metadata["Year"] = $Year }
 if ($Genre) { $mediaItem.Metadata["Genre"] = $Genre }
 if ($Comment) { $mediaItem.Metadata["Comment"] = $Comment }

 # Complete job setup
 $job.MediaItems.Add($mediaItem)
 $job.CreateSubfolder = $false
 $job.OutputDirectory = $outputDir
 $job.ApplyPreset($encoderPreset)

 # Define EventHanlder ScriptBlock for EncoderProgress Event
 $onProgress_EventHandler = [ScriptBlock]{
 param ( [PSObject]$Sender,
 [Microsoft.Expression.Encoder.EncodeProgressEventArgs]$e
 )

 $activity = "Encoding '{0}' by {1} as {2}" -f $Title, $Artist, $encoderPreset.Name
 $status = "Encoding '{0}' {1}% Pass {2} of {3}" -f `
 $e.CurrentItem.ActualOutputFileName, `
 [int]$e.Progress, `
 $e.CurrentPass, `
 $e.TotalPasses
 Write-Progress -Activity $activity -Status $status -PercentComplete ([int]($e.Progress))
 }
 # Register onProgress Event Handler with Encoder Job object
 $job.add_EncodeProgress($onProgress_EventHandler)

 # Start Encoding Job
 $job.Encode()
}
catch {
 # Generate log file if error occurs
 $errLog = "{0}\{1}.log" -f $outputDir, $outFile
 "Command Line: {0}" -f $MyInvocation.Line | Out-File $errLog -Append
 $_ | Out-File $errLog -Append
 throw $_
}
finally {
 $job.Dispose()
}


wmalpreset.xml
Code: [Select]
<?xml version="1.0" encoding="utf-8"?>
<!--Created with Expression Encoder version 4.0.4276.0-->
<Preset
  Version="4.0">
  <Job />
  <MediaFile>
    <OutputFormat>
      <WindowsMediaOutputFormat>
        <AudioProfile>
          <WmaAudioProfile
            Codec="WmaLossless"
            Channels="2"
            BitsPerSample="16"
            SamplesPerSecond="44100">
            <Bitrate>
              <VariableQualityBitrate
                Quality="100" />
            </Bitrate>
          </WmaAudioProfile>
        </AudioProfile>
      </WindowsMediaOutputFormat>
    </OutputFormat>
  </MediaFile>
</Preset>

How to set up Converter for WMA 9

Reply #77
What is //NoLogo option for? Is it necessary to add? I do without this option and can't see the difference
please explain

 

How to set up Converter for WMA 9

Reply #78
I know this is an old thread but I managed to get this working in Windows 10 and I thought I'd share the info.

I was looking for a way to play lossless audio in my car with a USB stick and Ford Sync and as it turn out the only lossless codec supported by Ford Sync is WMA Lossess which is rather obscure and not too many people are even aware of it's existence. Because of this, finding the codec in standalone form to use in Foobar was not easy and finding instructions regarding it's use was almost as difficult to find.

Through some digging and stuff I managed to find WMA9 Encoder released by Microsoft despite it no longer being hosted on their site and I've mirrored it twice because this will only become more difficult to find in the future.



WMA 9 Encoder Mediafire Link

WMA 9 Encoder Google Drive Link


The original installer was unpacked to the files you see in the 7z folder because it wouldn't install on Windows 10 in it's original state. This download also includes the needed hotfix to make this work in Windows Vista x64 which also seems to work in Windows 10. Instructions are also included which link to this thread.

Here is what you need to do in Windows 10 x64 and most likely in Vista/7/8.1 to make this work in foobar.

Unpack 7z file
Navigate to the WME encoder 9 Directory and install WMEncoder.msi as administrator (right click)
Then go up one level and install the WindowsMedia 9 Hotfix.exe as administrator.

Then go into foobar and follow these instructions in the OP.

https://www.hydrogenaud.io/forums/index.php?showtopic=47759


After that, you should be good to go

Re: How to set up Converter for WMA 9

Reply #79
I appreciate the OP's effort in writing the tutorial on the first page.

I store my music library in FLAC if I own the original disc the files came from, and MP3 if I don't. (what can I say? When I was in college, Napster was still a thing.) I also have a couple "vintage" (that word makes me cringe a little) Sony Hi-MD players, and I've been struggling for a while to find a way to import my music into Sony SonicStage to copy to my Hi-MD players without losing all the metadata.

SonicStage will read MP3 metadata correctly, and Hi-MD players have native support for MP3 as well, so that's the easy solution, but MP3 is a lossy format, and who likes easy solutions anyway? ;)
SonicStage will read WAV files, and they can either be transcoded to ATRAC3+ or copied bit-for-bit into raw PCM streams on Hi-MD discs, but SonicStage ignores the metadata, so I have to re-enter it manually for each track.
SonicStage can't read FLAC files at all, because it's an old program.

However, I recently (i.e. yesterday) discovered that WMA Lossless exists, and SonicStage can read WMA files and their metadata. So now, when I want to copy an album to a Hi-MD disc for the first time, I can convert the FLAC files into WMA Lossless and import them into SonicStage as an intermediate step. (I only plan to do it on a per-album basis as I decide to copy albums to Hi-MD discs, though, because otherwise I'd have duplicate lossless copies of all my music in two different formats for no reason.)

The files still get transcoded to the lossy ATRAC3+ format when I copy them to a Hi-MD disc, but ATRAC3+ is superior to MP3 at the same bitrate; with ATRAC3+, at 192kb/s I can no longer hear any artifacting, but with MP3 I have to go as high as 256kb/s to get the same result. So it's worth the trouble to transcode to ATRAC3+ so I can fit more music on each disc, for those times when I want to pretend to be some weird kind of Japanese-tech hipster -- and now I can do it without having to re-enter metadata by hand anymore!

Plus I get the satisfaction of knowing I figured out how to do it MY way instead of the easy way. :)

- - -

I miss Winamp. I still use it, and it still runs on Windows 10, but I'm finally making the leap to Foobar because Foobar has ongoing support. The best time to transition away from an abandoned software product is when you still have time to figure out how to make the transition. Winamp made the conversion to WMA Lossless a point-and-click affair, no configuration necessary, but I needed help getting Foobar to do it. This thread gave me that help.

Ironically, I'm running both SonicStage and Foobar inside a Windows XP virtual machine, so hypothetically I could rely on that Windows XP virtual machine to continue running Winamp forever as well, but this way I'm using the same music manager on all 5 of my active Windows machines.

You know what would be cool? A Winamp user interface with a Foobar back-end, so I don't have to learn anything new. ;)