VideoHelp Forum




+ Reply to Thread
Results 1 to 16 of 16
  1. I'm always wary of editing a WMV file given the number of times the A/V loses sync. In the first instance, my script is this:
    Code:
    DirectShowSource("D:\filename.wmv", fps=25 #or whatever rate)
    If the sync is off, I'll make a WAV of the audio track using wma2wav and then script like this:
    Code:
    a=FFVideoSource("D:\filename.wmv", threads=1)
    b=FFaudioSource("D:\filename.wav")
    audiodub(a,b)
    As a last resort, I'll make a high quality MP4 copy of the WMV using XMediaRecode and use it for editing but that's not ideal as you're not editing an original file.

    Does anyone have any other methods of making a successful avisynth edit of a WMV?
    Quote Quote  
  2. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    This also opens WMVs:

    Code:
    v=LWLibavVideoSource("D:\VH\Pooksahib\2025-09-10 - 05.wmv")
    a=LWlibavAudioSource("D:\VH\Pooksahib\2025-09-10 - 05.wmv")
    AudioDub(v,a)
    I can't vouch for the audio sync. Worth a try.
    Quote Quote  
  3. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    WMV.. one of the best example of the tragic destiny of all closed and proprietary shitty things they try to impose.

    Very nasty format: lot of troubles, compared to the open alternatives,.. and nothing else..
    Quote Quote  
  4. The LWLibav route failed in my case but thanks for the info, Alwyn.
    Quote Quote  
  5. It served its purpose. Windows totally ruling it, forcing its standards in their browser, early 2000, anyone uploaded a video and anyone could watch it. We forget that it could go really wild west route with lots of fractions and local standards where conversions of those little blocky videos would be converted (if) again and again. Lets not forget that at that time we could send wmv video anywhere and anyone had no problem to play it with wide spread windows, no one had problem to create wmv video from their sources. It could be worse. At the beginning it could be easily a nightmare for end user to have player, codecs (manually gathering) to play Real video, quicktime, mpeg1 and maybe others. Lots of confusion for end user. I bet if it was wild west then, other things similar like mkv, DivX would pop up earlier to make matters even worse at that time, at the beginning.
    Quote Quote  
  6. No, not that, Alwyn, I wouldn't have been able to run the script without the LSmash plugin. I meant that my output file was off, sync-wise. But I've had success by using DirectShowSource for the video and muxing it with the audio off a recode I made with XMediaRecode. Bit of a pain but needs must...
    Quote Quote  
  7. WMV is inherently variable frame rate. You need to force LWlibavVideoSource() to output constant frame rate. Something like:

    LWlibavVideoSource("filename.wmv", fpsnum=30000, fpsden=1000) # for 30 fps output
    Quote Quote  
  8. DECEASED
    Join Date
    Jun 2009
    Location
    Heaven
    Search Comp PM
    Originally Posted by pooksahib View Post
    No, not that, Alwyn, I wouldn't have been able to run the script without the LSmash plugin. I meant that my output file was off, sync-wise.
    That's because LWlibavAudioSource() ignores the audio timestamps of the ASF container. Lots of ASF/WMV files have "gaps" and/or "overlaps" in the audio stream. wma2wav.exe was designed to respect these, but any Avisynth plugin based on ffmpeg or libav proudly ignores them (so far).
    Last edited by El Heggunte; 10th Sep 2025 at 10:09. Reason: clarity
    "Programmers are human-shaped machines that transform alcohol into bugs."
    Quote Quote  
  9. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Originally Posted by Pooksahib
    No, not that, Alwyn, I wouldn't have been able to run the script without the LSmash plugin. I meant that my output file was off, sync-wise.
    Fair enough, I misunderstood your "fail" term.
    Quote Quote  
  10. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    I had to find my old scripts when I worked with shitty WMV9 source material some years ago.. to try to give any suggestion.

    Anyway... after many trials I found that:

    FFmpegSource2("<filename>, fpsnum=24000, fpsden=1001) SHOULD work. You have to change fpsnum/fpsden based on the framerate of your file (in my case was a standard ntsc 23.976xxxx)

    The next method I know it works for sure (I used it for the most part of the job, hundreds of files converted without any issue with it.. then I switched to the other one for few last files.. and it worked as well.. but this second method seemed more reliable to me):

    With this method you process with avisynth only the video.. then remux the re-encoded video with the original audio from the source file using MKVTOOLNIX.

    The trick (that costed me a lot of trials and experiments) is to make ffmpeg2source to generate a timecode for the video that MKVTOOLNIX will then use for the remux (keeping audio sync).

    So in avisynth you have to use:

    FFVideoSource("<filename>, timecodes="timecodes.txt")

    Then remux the newly encoded video with the original audio though MKVTOOLNIX importing the "timecodes.txt" generated by FFMPEG2Source in the "Properties -> Timestamp File"

    Hundreds of files converted this way.. all perfectly in sync.
    Quote Quote  
  11. Originally Posted by jagabo View Post
    WMV is inherently variable frame rate. You need to force LWlibavVideoSource() to output constant frame rate. Something like:
    LWlibavVideoSource("filename.wmv", fpsnum=30000, fpsden=1000) # for 30 fps output
    Originally Posted by krykmoon View Post
    FFmpegSource2("<filename>, fpsnum=24000, fpsden=1001) SHOULD work. You have to change fpsnum/fpsden based on the framerate of your file
    Thanks to you both. Both methods failed on the file I'm currently editing but, never mind, I've made successful edits - see post #7.

    krykmoon - am I correct in thinking that your mkvtoolnix method would only be good for making a copy of the original file (as opposed to editing it with trims etc)?
    Quote Quote  
  12. Kawaiiii
    Join Date
    May 2021
    Location
    Italy
    Search Comp PM
    Originally Posted by pooksahib View Post
    krykmoon - am I correct in thinking that your mkvtoolnix method would only be good for making a copy of the original file (as opposed to editing it with trims etc)?
    No, it wasn't a copy of the original files: you can apply filters and do any kind operation with avisynth to the video before the remux.. but not trimming or cutting frames at the same time : if the audio is misaligned .. you'll inevitably run into problems

    First thing is to sync a/v, then you can trim/cut.

    And you can't do both things in one step.
    Quote Quote  
  13. Sounds promising, thanks. I created an edit using
    Code:
    FFVideoSource("D:\filename.wmv", timecodes="timecodes.txt")
    The output file was video only and there was a timecodes.txt file. I then launched mkvtoolnix and loaded the new video file. In the right hand side of mkvtoolnix there's a "Timestamp file:" box and I filled it in with the location of my timecodes.txt file. Then I clicked "Start multiplexing". Sadly, the file generated by mkvtoolnix is audio-free. What am I doing wrong?
    Last edited by pooksahib; 11th Sep 2025 at 10:14.
    Quote Quote  
  14. Originally Posted by pooksahib View Post
    I then launched mkvtoolnix and loaded the new video file. In the right hand side of mkvtoolnix there's a "Timestamp file:" box and I filled it in with the location of my timecodes.txt file. Then I clicked "Start multiplexing". Sadly, the file generated by mkvtoolnix is audio-free. What am I doing wrong?
    Did you import (into mkvtoolnix) the audio stream from the original A/V file?
    Quote Quote  
  15. I didn't. How can that be done given that mkvtoolnix is not WMV friendly?
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!