Avidemux Forum

Participate => User interface and Usability => Topic started by: Bart Z Lederman on June 10, 2018, 03:12:18 PM

Title: Still can't convert WMV properly
Post by: Bart Z Lederman on June 10, 2018, 03:12:18 PM
This is a problem which has been reported in many forums for many years, and even with the newest version 2.7.1 it still exists.

Avidemux can read WMV files, it can play them correctly, but when I save them to a different format there is no sound.  I repeat, the sound plays fine when the file is in avidemux, it demuxes fine, all of the settings seem to work, the saved file says it has an audio track (according to VLC and MediaInfo), but there is actually no audio in the output file and there are no error messages during conversion.

I've tried outputs of AVI+AAC in MP4 containers, xvid+ac3 in AVI containers, and xvid+mp3 in AVI containers, and always get the same results.

I have tried every solution anyone has ever offered in this an other forums, and none of them fix the problem.

Does anyone really know how to get AVI to convert WMV into another format and keep the audio, or is this just something that avidemux should say outright it can't be done?

Any constructive comments are welcome.
Title: Re: Still can't convert WMV properly
Post by: Jan Gruuthuse on June 10, 2018, 03:23:40 PM
avidemux never could as far as I could remember:
QuoteIs probably not going to happen: due to
- Windows Media Components License Agreements
- and other reasons such as:
Quote- ... WMV has been the subject of numerous complaints from users and the press. Users dislike the digital rights management system which is sometimes attached to WMV files. The loss of the ability to restore licenses for WMV files in the Windows Media Player 11 was not positively received ....
- ...
Windows Media Video (https://en.wikipedia.org/wiki/Windows_Media_Video)
Windows Media Audio (https://en.wikipedia.org/wiki/Windows_Media_Audio)
source: WMV output format (http://avidemux.org/smif/index.php/topic,17926.msg81871.html#msg81871)
Title: Re: Still can't convert WMV properly
Post by: eumagga0x2a on June 10, 2018, 03:31:38 PM
Quote from: Bart Z Lederman on June 10, 2018, 03:12:18 PM
I repeat, the sound plays fine when the file is in avidemux

It plays fine. But just once. If you rewind (go to the beginning of the video), the audio is lost. The workaround is not to start reencoding from the first keyframe but from the second one (set the marker A to the second keyframe).

Yes, this is a bug, likely in the Asf demuxer.
Title: Re: Still can't convert WMV properly
Post by: eumagga0x2a on June 10, 2018, 05:17:40 PM
More precisely, it is a bug in asfAudioAccess::goToTime (https://github.com/mean00/avidemux2/blob/master/avidemux_plugins/ADM_demuxers/Asf/ADM_asfAudio.cpp#L94), a simple

diff --git a/avidemux_plugins/ADM_demuxers/Asf/ADM_asfAudio.cpp b/avidemux_plugins/ADM_demuxers/Asf/ADM_asfAudio.cpp
index 7749ccb6..4d24484d 100644
--- a/avidemux_plugins/ADM_demuxers/Asf/ADM_asfAudio.cpp
+++ b/avidemux_plugins/ADM_demuxers/Asf/ADM_asfAudio.cpp
@@ -98,7 +98,7 @@ bool   asfAudioAccess::goToTime(uint64_t dts_us) // PTS!
     int size=_seekPoints->size();
     if(dts_us<=(*_seekPoints)[0].pts || size<2)
     {
-          return setPos( 0);
+        return _packet->goToPacket((*_seekPoints)[0].packetNb);
     }

     for(int i=size-2;i>=0;i--)


works, but results in a short burst of noise at the beginning of video after rewind.
Title: Re: Still can't convert WMV properly
Post by: eumagga0x2a on June 10, 2018, 10:36:15 PM
For WMV, the loss of audio on rewind should be mostly fixed by [demuxers/Asf] Do not lose audio on rewind (https://github.com/mean00/avidemux2/commit/dfc645a26711b869ac4496c3d69c37cc99d17240) (it still happens sometimes for unrelated reasons). No solution for the burst of noise (actually, ~100 ms of the last played audio before rewinding) so far.
Title: Re: Still can't convert WMV properly
Post by: Bart Z Lederman on June 11, 2018, 09:38:58 AM
I've tried converting by opening the WMV file and immediately writing the output without trying to play the file at all. This does not appear to make any difference, the output still has no sound.

I will try skipping forward to the first key frame and then writing the output.

I haven't looked at the source code, but it seems to me that this problem is very well defined, and should be fixable. There are other programs that run on Windows that can do the conversion.  I've successfully converted WMV to AVI using Any Video Converter, VLC, and even ffmpeg from the command line.  The problem is, none of them can do color corrections, or deinterlace, or do other fixes, VLC is very cumbersome for doing conversions, and Any Video Converter sometimes gets the video size wrong.  I'd rather do it in Avidemux if I can.
Title: Re: Still can't convert WMV properly
Post by: eumagga0x2a on June 11, 2018, 10:35:47 AM
Quote from: Bart Z Lederman on June 11, 2018, 09:38:58 AM
I've tried converting by opening the WMV file and immediately writing the output without trying to play the file at all. This does not appear to make any difference, the output still has no sound.

Right, this can't make a difference because Avidemux internally rewinds when saving from the beginning of the video. A this moment we hit the bug and lose the audio.

QuoteI will try skipping forward to the first key frame and then writing the output.

Depending on particular video, just skipping one or two frames may be already enough to avoid the bug. The starting point must be after the first audio seek point (max 500 ms) for that.

QuoteI haven't looked at the source code, but it seems to me that this problem is very well defined, and should be fixable.

It is fixed. Just the side effect of a brief (~50 ms long) noise burst is unsolved. Download and use the next nightly once it has been built and uploaded.