Author Topic: loading WMV, with WMA2 audio  (Read 3288 times)

Offline Gweilo

  • Member
  • Posts: 8
    • View Profile
loading WMV, with WMA2 audio
« on: September 19, 2010, 11:13:03 PM »
I have some WMVs that I am trying to process in Avisynth.

I use Win2k and don't have a recent version of WMP installed, so that is probably the reason I'm having problems.
I really don't want to install WMP just to do this, though if I could just get the codecs required, I'd do that.

Here's the MediaInfo report:

Code: [Select]
General
Complete name                    : OoM_1.wmv
Format                           : Windows Media
File size                        : 18.9 MiB
Duration                         : 2mn 41s
Overall bit rate mode            : Constant
Overall bit rate                 : 977 Kbps
Maximum Overall bit rate         : 1 205 Kbps


Video
ID                               : 2
Format                           : VC-1
Format profile                   : MP@HL
Codec ID                         : WMV3
Codec ID/Info                    : Windows Media Video 9
Codec ID/Hint                    : WMV3
Description of the codec         : Windows Media Video 9
Duration                         : 2mn 41s
Bit rate mode                    : Constant
Bit rate                         : 1 000 Kbps
Width                            : 738 pixels
Height                           : 416 pixels
Display aspect ratio             : 16:9
Frame rate                       : 29.970 fps
Bit depth                        : 8 bits
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.109
Stream size                      : 19.3 MiB
Language                         : English (US)

Audio
ID                               : 1
Format                           : WMA
Format version                   : Version 2
Codec ID                         : 161
Codec ID/Info                    : Windows Media Audio
Description of the codec         : Windows Media Audio 9.1 - 192 kbps, 48 kHz, stereo (A/V) 2-pass CBR
Duration                         : 2mn 41s
Bit rate mode                    : Constant
Bit rate                         : 192 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 48.0 KHz
Bit depth                        : 16 bits
Stream size                      : 3.71 MiB (20%)
Language                         : English (US)


Just
Code: [Select]
FFmpegSource2("OoM_1.wmv")gave video without any problem.

I tried
Code: [Select]
FFmpegSource2("OoM_1.wmv",atrack=-1)
AssumeFPS("ntsc_video")

** corrected script**

But got an error message
Code: [Select]
FFAudioSource: Not an audio track
FFMS@.avsi, line 38

Trying track = 0, 1, 2, 3 also fails.




So I tried

Code: [Select]
DirectShowSource("OoM_1.wmv", fps=29.97, convertfps=true)
Initially that also failed to play audio.

I went to ffdshow audio config and activated "WMA 8/9" to libavcodec.
Then I could play it on WMP Classic, but it played very slowly and stuttered.
(VLC always played it fine, using its own decoder.)

The DirectShowSource script as above now played audio, but the video was screwed up (skewed at 45 degrees).

So I cobbled together a working script:

Code: [Select]
FFmpegSource2("OoM_1.wmv")
AssumeFPS("ntsc_video")
AudioDub(DirectShowSource("OoM_1.wmv", fps=29.97, convertfps=true))

Which worked, though also playing very slowly, and when I saved to a new format, was a few seconds out of sync.

So:
1) Can ffmpegsource be made to work on the audio?
or
2) Are there a better codecs to allow DirectShowSource to do it?


 
« Last Edit: September 20, 2010, 07:13:24 AM by Gweilo »

Offline poisondeathray

  • Member
  • Posts: 90
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #1 on: September 20, 2010, 05:35:29 AM »
atrack=-1

ffmpegsource2("video.wmv", atrack=-1)

Offline Gweilo

  • Member
  • Posts: 8
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #2 on: September 20, 2010, 07:12:33 AM »
atrack=-1
Sorry, typo, I did have -1 in my script originally. I then tried a few other  options (-1, 0, 1, 2, 3), all failed to find any audio. I pasted in the last variation I tried, fixed that now.

Later I found another WMV with "Windows Media Audio 9.1 Professional" audio and have found nothing at all that could play it so far.






 
« Last Edit: September 20, 2010, 07:23:28 AM by Gweilo »

Midzuki

  • Guest
Re: loading WMV, with WMA2 audio
« Reply #3 on: September 20, 2010, 08:13:48 AM »
Quote from: Gweilo
I use Win2k and don't have a recent version of WMP installed, so that is probably the reason I'm having problems.

Normally you'd just need to install the package named "wmfdist11.exe",
however I don't know how-well it would work under Windows 2000  ???


Quote
Later I found another WMV with "Windows Media Audio 9.1 Professional" audio and have found nothing at all that could play it so far.

If the codecs from WMP11 happen to work under your Win2k setup,
you'll never get more than a stereo downmix for multichannel WMA
(many thanks to Microsoft, as usual).

Offline qyot27

  • Isn't it sad?
  • Member
  • Posts: 106
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #4 on: September 20, 2010, 10:16:53 PM »
Just a bit concerning FFMS2: using AssumeFPS after the source line will not produce the same result as DSS's convertfps parameter.  If you really are dealing with VFR (for simplicity's sake, I always treat WMV as VFR, no exceptions), just an AssumeFPS will make your audio skew - also, I'm not sure about the aliases AssumeFPS accepts, but if they don't also automatically select sync_audio=true, it will cause skew in any case where the source and destination framerates differ at all, VFR or CFR.

To correctly do VFR->CFR framerate conversion with FFMS2, you have to use the fpsnum and fpsden parameters:
Quote
FFmpegSource2("video.ext",atrack=-1,fpsnum=30000,fpsden=1001)
That will make sure the output is 29.97fps, for example.

For using FFMS2 and DSS in tandem (which I typically have to do with FLV files, but whatever...), I typically set it up as follows:
Quote
v=FFVideoSource("video.ext",fpsnum=30000,fpsden=1001)
a=DirectShowSource("video.ext",fps=29.97,convertfps=true,video=false)
AudioDub(v,a)
Are the fps and convertfps params overkill when I tell DSS to only give back audio?  Yeah, most likely, but it soothes my paranoia.  It does, however, seem to cut down on the amount of resources needed, since you're only opening the video stream once, using FFMS2.
« Last Edit: September 20, 2010, 10:20:39 PM by qyot27 »

Offline Gweilo

  • Member
  • Posts: 8
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #5 on: March 01, 2011, 12:14:37 AM »
To correctly do VFR->CFR framerate conversion with FFMS2, you have to use the fpsnum and fpsden parameters:That will make sure the output is 29.97fps, for example.
FFmpegSource2("video.ext",atrack=-1,fpsnum=30000,fpsden=1001)

Thanks! I just stumbled back here, with the same problem, and this does keep sync on my WMVs.




Offline TheFluff

  • Member
  • Posts: 68
  • Excessively jovial fellow
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #6 on: March 01, 2011, 11:43:39 PM »
FFMS2 should support WMA audio a lot better now; if it still doesn't work there's probably a bug somewhere.

Offline Gweilo

  • Member
  • Posts: 8
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #7 on: March 02, 2011, 08:20:23 AM »
FFMS2 should support WMA audio a lot better now; if it still doesn't work there's probably a bug somewhere.
"Now"? Has it been updated recently?

Anyway I used the fpsnum/fpsden options and it stayed in sync.
Better than DSS, which when I encoded via HCEnc gave me "small mismatch" warnings on 90% of the frames on its second pass, indicating I think frame inaccuracy. FFMS2 was 50% slower than DSS though...

Ptalar Bvorm

  • Guest
Re: loading WMV, with WMA2 audio
« Reply #8 on: March 02, 2011, 02:53:15 PM »
Just for the record: apparently, the sync problems between DirectShowSource() and Windows Media Audio are due to the "variable frame size duration" nature of the WMA streams. Setting the parameters "fps=x" and "convertfps=true" is NOT enough to ensure the video and the audio stay in sync after being converted/recompressed. It's good to know that ffms2 currently deals fine with  MicroMedia Audio. :D In a not-so-distant past, I had to use either BassAudioSource(), or Winamp's DiskWriter plugin. :-\
« Last Edit: March 02, 2011, 05:13:38 PM by R. Midzuki »

Offline TheFluff

  • Member
  • Posts: 68
  • Excessively jovial fellow
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #9 on: March 03, 2011, 12:32:04 PM »
"Now"? Has it been updated recently?

2.15 was released a few weeks ago, and it contains a substantial rewrite of the audio reading code.

Offline Gweilo

  • Member
  • Posts: 8
    • View Profile
Re: loading WMV, with WMA2 audio
« Reply #10 on: March 03, 2011, 07:30:01 PM »
2.15 was released a few weeks ago, and it contains a substantial rewrite of the audio reading code.
Thanks for that.
I should pay more attention to the Avisynth news feed (http://blog.niiyan.net/rss)

Also, recently I converted the FFMS2 manual to wiki format and put it at http://avisynth.org/mediawiki/FFmpegSource
I thought it definitely needed to be there, there was just a stub page before.
So it's probably out of date now.
I'll try to update it.
Maybe you could have a look at it and see if it's okay.
« Last Edit: March 03, 2011, 07:43:23 PM by Gweilo »