+ Reply to Thread
Results 1 to 8 of 8

Thread: Command line tool to extract wma from wmv?

  1. #1

    Command line tool to extract wma from wmv?

    Hello all,

    Is there a command line tool to extract wma from wmv without recoding/encoding? (ie., I don't want any processing and just need the original stream).

    I tried ffmpeg but it gave me this error.
    [NULL @ 00000000003fc880] Requested output format 'wma' is not a suitable output format
    audio.wma: Invalid argument

    Thank you in advance.
    Quote Quote  

  2. #2

    Re: Command line tool to extract wma from wmv?

    Should work with mka as output format. E.g.:

    Code:
    ffmpeg -i in.wmv -map 0:a:0 -c:a copy -y out.mka
    Quote Quote  

  3. #3

    Re: Command line tool to extract wma from wmv?

    Did you try "-f wma"? ffmpeg seems to expect "-f asf" instead. At least that's what ffmpeg choose if you omit the -f option completely and just name the output "whatever.wma". (Use -map and -c:a as shown by fornit.)

    But do you really need the original, compressed stream or do you want to work/edit further on it? Then choose a lossless output format like PCM/WAV.
    Quote Quote  

  4. #4
    Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Posts
    2,344

    Re: Command line tool to extract wma from wmv?

    Advanced Systems Format (asf) is the canonical container for Windows Media Audio.
    Quote Quote  

  5. #5
    Member
    Join Date
    Sep 2007
    Location
    Canada
    Posts
    28,714

    Re: Command line tool to extract wma from wmv?

    Another option is the command line version of asfbin

    Assuming video is stream 1 (sometimes wmv stream numbering can be swapped; audio can be first as stream 1)
    Code:
    "asfbin" -i "input.wmv" -o "output.wma" -nostr 1
    Quote Quote  

  6. #6

    Re: Command line tool to extract wma from wmv?

    Quote Originally Posted by sneaker View Post
    Did you try "-f wma"? ffmpeg seems to expect "-f asf" instead. At least that's what ffmpeg choose if you omit the -f option completely and just name the output "whatever.wma". (Use -map and -c:a as shown by fornit.)

    But do you really need the original, compressed stream or do you want to work/edit further on it? Then choose a lossless output format like PCM/WAV.
    You were right! Thank you for the pointer. I got rid of "-f wma" and ffmpeg produced the wma file just as what I wanted.

    However, the original audio stream was 96Kpbs (according to MediaInfo) and the output file is 128kbps so looks like ffmpeg did do some minor recoding. Is there any option to tell ffmpeg to preserve the original bitrate?
    Quote Quote  

  7. #7

    Re: Command line tool to extract wma from wmv?

    What does the ffmpeg log say? If it says it copied the track(*) then I would trust it and assume MediaInfo was working incorrectly. MediaInfo isn't always accurate with >1 tracks + variable bitrate when it comes to detecting the average bitrates.


    (*) I.e. you used -c:a copy or -c copy and the log shows something like:
    Code:
    Stream mapping:
       Stream #0:0 -> #0:0 (copy)
    Quote Quote  

  8. #8

    Re: Command line tool to extract wma from wmv?

    Quote Originally Posted by sneaker View Post
    What does the ffmpeg log say? If it says it copied the track(*) then I would trust it and assume MediaInfo was working incorrectly. MediaInfo isn't always accurate with >1 tracks + variable bitrate when it comes to detecting the average bitrates.


    (*) I.e. you used -c:a copy or -c copy and the log shows something like:
    Code:
    Stream mapping:
       Stream #0:0 -> #0:0 (copy)
    Thanks, sneaker. I added "-c:a copy" and looks like it worked. Thank you!

    Code:
      Input #0, asf, from 'R:\hcm1m7cap011\M7VIREC01\VIREC165\ADNC0400V0096A\Vi0165201
    8\Vi0165201808\Vi016520180810\Vi016520180810111500112000000100.wmv':
      Metadata:
        WMFSDKNeeded    : 0.0.0.0000
        DeviceConformanceTemplate: MP@ML
        WMFSDKVersion   : 12.0.7601.17514
        IsVBR           : 0
      Duration: 00:05:00.11, start: 0.000000, bitrate: 497 kb/s
        Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp
    , 96 kb/s
        Stream #0:1(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 384x288,
    400 kb/s, 25 fps, 25 tbr, 1k tbn, 1k tbc
    Output #0, asf, to 'D:\Dinh\MRL\AudioRefs\0165\20180810111500.wma':
      Metadata:
        WMFSDKNeeded    : 0.0.0.0000
        DeviceConformanceTemplate: MP@ML
        WMFSDKVersion   : 12.0.7601.17514
        IsVBR           : 0
        WM/EncodingSettings: Lavf58.17.101
        Stream #0:0(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, stereo, fltp
    , 96 kb/s
    Stream mapping:
      Stream #0:0 -> #0:0 (copy)
    Press [q] to stop, [?] for help
    size=    2598kB time=00:02:21.52 bitrate= 150.4kbits/s speed= 160x
    video:0kB audio:1662kB subtitle:0kB other streams:0kB global headers:0kB muxing
    overhead: 56.301533%
    Exiting normally, received signal 2.
    Quote Quote  

+ Reply to Thread

Similar Threads

  1. Replies: 7
    Last Post: 16th Aug 2018, 18:00
  2. Recommended command line cross-platform download tool, not youtube-dl?
    By colorstar in forum Newbie / General discussions
    Replies: 0
    Last Post: 12th Dec 2017, 07:38
  3. tsMuxeR command line
    By t00 in forum Blu-ray Ripping
    Replies: 7
    Last Post: 19th Nov 2017, 12:20
  4. PotPlayer: Command Line
    By burningbush in forum Software Playing
    Replies: 5
    Last Post: 7th Dec 2013, 17:54
  5. How to Use x264 Command Line
    By Anonymous344 in forum Newbie / General discussions
    Replies: 37
    Last Post: 2nd Nov 2013, 08:49

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts