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:
If the sync is off, I'll make a WAV of the audio track using wma2wav and then script like this:Code:DirectShowSource("D:\filename.wmv", fps=25 #or whatever rate)
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.Code:a=FFVideoSource("D:\filename.wmv", threads=1) b=FFaudioSource("D:\filename.wav") audiodub(a,b)
Does anyone have any other methods of making a successful avisynth edit of a WMV?
+ Reply to Thread
Results 1 to 16 of 16
-
-
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)
-
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.. -
Possibly because you don't have the LSmash plugin?
http://avisynth.nl/index.php/LSMASHSource
https://forum.videohelp.com/threads/394946-AviSynth-Busted#post2565312 -
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.
-
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...
-
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 -
Last edited by El Heggunte; 10th Sep 2025 at 10:09. Reason: clarity
"Programmers are human-shaped machines that transform alcohol into bugs." -
Originally Posted by Pooksahib
-
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. -
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)? -
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. -
Sounds promising, thanks. I created an edit using
Code:FFVideoSource("D:\filename.wmv", timecodes="timecodes.txt")
Last edited by pooksahib; 11th Sep 2025 at 10:14.
-
Similar Threads
-
Audio Sync Issue in Avisynth+
By Forenzik in forum Video ConversionReplies: 31Last Post: 17th Nov 2023, 13:21 -
Unable to get an avisynth recode to stay in sync
By pooksahib in forum Video ConversionReplies: 4Last Post: 15th Jan 2023, 01:35 -
Keeping sync editing dvdr of vhs?
By spiritgumm in forum EditingReplies: 0Last Post: 17th Dec 2022, 15:08 -
Keeping accurate color between source, avisynth/virtualdub and re-encode
By mrwhitethc in forum Video ConversionReplies: 3Last Post: 29th Mar 2022, 16:26 -
Using avisynth on a WMV file with corrupt audio
By pooksahib in forum Video ConversionReplies: 17Last Post: 21st Oct 2020, 23:53