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. |
13th August 2008, 03:36 | #1 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Any wma2wav CLI tool ???
Hi!
Is there any simple tool available which is able to take a .wma file as input and produce an uncompressed .wav as output? Please note that I need a CLI tool to integrate into my own GUI application. Therefore GUI tools or Winamp plugins are useless here. Also I don't want to use MPlayer.exe/MEncoder.exe or ffmpeg.exe, because they are far to bloated for this speicifc task. Furthermore note that I do not want to support DRM'd WMA files. Last but not least the CLI tool should not depend on any external DLL's. So far I found simple CLI decoders like that for all audio formats I had been looking for. But I failed to find anything suitable for damn WMA. There seems to be a CLI tool called "wma2wav" in existence, which basically is a stripped down version ffmpeg. Unfortunately all links I found were broken/down... I'd need a Win32 binary that works like that: wma2wav.exe --input "c:\Foobar.wma" --output "c:\decoded.wav" Any advice would be welcome [UPDATE] I finally took the opportunity to create a simple "wma2wav" tool from the scratch: The latest version of thr 'wma2wav' tool can be found in this post: http://forum.doom9.org/showthread.ph...57#post1524857
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 15th January 2015 at 23:26. |
14th August 2008, 16:55 | #2 | Link |
Mr. Sandman
Join Date: Sep 2003
Location: Haddonfield, IL
Posts: 11,768
|
avisynth, directshowsource with avs2raw or bepipe....
__________________
MPEG-4 ASP Custom Matrices: EQM V1(old), EQM AutoGK Sharpmatrix (aka EQM V2), EQM V3HR (updated 01/10/2004), EQM V3LR, EQM V3ULR (updated 04/02/2005), EQM V3UHR (updated 17/12/2004) and EQM V3EHR (updated 05/10/2004) Info about my ASP matrices. MPEG-4 AVC Custom Matrices: EQM AVC-HR Info about my AVC matrices My x264 builds. Mooo!!! |
14th August 2008, 17:24 | #3 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Dependency on Avisynth and on DirectShow filters -> Not suitable for my "self-contained" application
I'd need something in the tradition of OggDec or FAAD ...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
15th August 2008, 10:02 | #4 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
15th July 2011, 22:08 | #6 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Today I finally took the opportunity to create a simple wma2wav tool from the scratch.
It's based on the Windows Media Format SDK, so it's Windows only. Also currently only output to a "raw" PCM file and output to stdout is possible. (I will add a Wave file writer soon).
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 16th July 2011 at 23:59. |
16th July 2011, 14:32 | #7 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Some improvements, including proper command-line argument parser.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 16th July 2011 at 21:46. |
16th July 2011, 16:26 | #9 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
Since Wave Audio does not have any concept of time stamps (it's basically a simple header in front of "raw" PCM data stream), I don't know how this could be done.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ |
|
16th July 2011, 17:29 | #11 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
What I get from the WM reader is "raw" PCM data. I also get one WAVEFORMATEX per stream (not per sample or frame!), telling me the sampling rate of the (whole?) stream. Consequently I have to assume that the sampling rate is constant. Anything else wouldn't fit into a Wave file anyway, as the Wave header defines a single sampling rate. Actually, unlike variable frame rate, where you simply vary the duration that you display the frame, I can hardly imagine how a variable sampling rate would be supposed to work What I also do get from the WM reader is the timestamp and duration (in seconds) as well as the size (in bytes) of each "chunk" of audio data that I read from the ASF file. Actually I don't use the timestamp and the duration (except for displaying the progress) at all. I simply write one sample after another into the file. All samples I got from WM reader. The only thing that is (or might be) "variable" is the number of samples (bytes) that I receive per GetNextSample() call. And that's no problem at all...
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 17th July 2011 at 00:09. |
|
16th July 2011, 17:58 | #12 | Link |
Unavailable
Join Date: Mar 2009
Location: offline
Posts: 1,480
|
Sorry, I'm unable to explain , I only know that, unless I used Winamp's Disk Writer plugin, or Avisynth's BassAudio, many WMA streams generated WAV files which were shorter than their sources The consequence: video and audio would go out of sync, of course
|
16th July 2011, 18:13 | #13 | Link | |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
If the timestamp of chunk N+1 does not exactly match the "end" (timestamp+duration) of chunk N, then there is either a "gap" or an "overlap". An "overlap" doesn't make much sense to me! For a "gab" we might need to compensate with null samples, if such gaps really exists in real WMA/WMV files. I re-uploaded today's version with a consistency check for timestamps, which will throw a warning if any non-negligible "gaps" or "overlaps" are found! (for my test files this did never happen though)
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 16th July 2011 at 18:15. |
|
16th July 2011, 19:54 | #14 | Link |
Unavailable
Join Date: Mar 2009
Location: offline
Posts: 1,480
|
Hmmm, the new build of your wma2wav seems to be working as it should, at last
Code:
[C:\ASFBIN] =>wma2wav -r -i zzoutput.wma -o zzzz9999.raw wma2wav - Dump WMA/WMV files to Wave Audio [Jul 16 2011] Copyright (c) 2011 LoRd_MuldeR <mulder2@gmx.de>. Some rights reserved. Released under the terms of the GNU General Public License. Input file: zzoutput.wma Output file: zzzz9999.raw Opening input file... OK Analyzing input file... OK [Audio Properties] wFormatTag: 1 nChannels: 2 nSamplesPerSec: 48000 wBitsPerSample: 16 fDuration: 44:28.1 nMaxSampleSize: 17208 Opening output file... OK Inconsistent timestamps: expected 41.002, but got 41. The samples "overlap" for 0.002 seconds! Inconsistent timestamps: expected 234.151, but got 235. There is a "gap" of 0.849 seconds between the samples! Inconsistent timestamps: expected 639.01, but got 639. The samples "overlap" for 0.01 seconds! Inconsistent timestamps: expected 713.965, but got 714. There is a "gap" of 0.035 seconds between the samples! Inconsistent timestamps: expected 1213.17, but got 1213. The samples "overlap" for 0.167 seconds! Inconsistent timestamps: expected 1817.54, but got 1818. There is a "gap" of 0.457 seconds between the samples! Inconsistent timestamps: expected 2191.16, but got 2192. There is a "gap" of 0.838 seconds between the samples! [100.0%] 44:27.8 of 44:27.8 completed, please wait... All done. |
16th July 2011, 20:05 | #15 | Link | |
Registered User
Join Date: Aug 2008
Location: The Land Of Dracula (Romania - EU)
Posts: 934
|
@LoRd_MuldeR thanks a lot...this is a huge help...
_ L.E. i done a test and i got this: Quote:
_
__________________
if you ask a question and somebody give you the correct answer don't forget to leave a "thank you" note... Visit The Land Of Dracula (Romania - EU)! Last edited by b66pak; 16th July 2011 at 20:41. |
|
16th July 2011, 21:03 | #16 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Nope, not yet. But now that I know they exist in some "real" files, I will implement the required padding.
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 16th July 2011 at 23:35. |
16th July 2011, 21:44 | #17 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Okay, here is a new version which will compensate "timestamp gaps" by padding with zero bytes. Also it supports Wave/RIFF output now.
By default it tries to avoid padding for small gaps, because I think padding is bad for audio-only files. But I also added a more "aggressive" compensation mode. (BTW: If somebody could provide me with a sample file that contains "gaps" in the audio stream, this would be helpful for me).
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 17th July 2011 at 13:13. |
17th July 2011, 05:02 | #18 | Link |
Unavailable
Join Date: Mar 2009
Location: offline
Posts: 1,480
|
^ Mea culpa I had checked only that the resulting .WAV had the same length as the WMA source, not whether it remained "in synch" with the respective video track :uglylol: Anyway, the "aggressive padding" generates a .WAV longer than its WMA source, therefore...
Also, after running wma2wav (which IMHO really should be renamed to wmadec or somethig) , the CLI window does not execute .BAT files anymore P.S.: As for the requested sample file, I've PM-ed you. |
17th July 2011, 12:31 | #19 | Link | ||
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Quote:
I noticed that the timestamps/durations almost always do NOT match up exactly, which maybe is due to rounding errors or something like that. Trying to compensate even for very small gaps (like aggressive mode does) will result in stuttering audio. Actually it gives an interesting kill-switch effect ^^ That is why the "standard" mode will ignore tiny gaps. And it's probably the best we can do... Quote:
Maybe it is because I set the console output CP to UTF-8, which is required to correctly print Unicode (UTF-8) characters. Will add code to restore the "original" CP on program exit... Thanks That file has some "overlaps", i.e. the timestamp of the "sample" (chunk of audio samples returned by the WM reader) is actually before the end (timestamp + duration) of the previous "sample". I don't think this should ever by the case (timestamps should be strictly none-decreasing!), so maybe the file is fishy... Anyway, with the standard compensation mode, wma2wav will produce a Wave file of duration 44:27.959, the original WMA had a duration of 44:28.098 (according to Foobar 2000). I think less than 0.2 seconds difference for a 45 minutes samples is pretty much okay
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 17th July 2011 at 12:40. |
||
17th July 2011, 13:12 | #20 | Link |
Software Developer
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,248
|
Yet another update. Will now restore the previous codepage on exit. Also fixed a bug where padding zero bytes would also zero out the next samples!
__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊ Last edited by LoRd_MuldeR; 17th July 2011 at 17:04. |
Thread Tools | Search this Thread |
Display Modes | |
|
|