Trimming a WMV/WMA video/audio file -> MKV -- Cannot Open Muxer

Started by rfg, November 27, 2016, 01:27:36 AM

Previous topic - Next topic

rfg

Sorry.  This is probably an FAQ somplace, but I couldn't find the answer.

I have an .wmv file which contains a single VC-1/MP@HL/WMV3 video stream and a single WMA/version2 audio stream.  I can load this into Avidemux, no problem, and I can hit the Play button and it plays (but no audio comes out of my speakers) and Avidemux then even allows me to trim off the front part of the file (i.e. at some key frame)but when I go to save ithe resulting trimmed file (using "copy" for both video and audio) into a .mkv file/container, I get the error "Cannot open Muxer".  Why?  And what is the fix or workaround?  (I understand that perhaps avidemux doesn't know how to -encode- either VC-1/WMV3 or any flavor of WMA, but in this case I am -not- asking it to do that.  I am only asking it to trim the file at a key frame.  So what's the problem?  If this a bug or just a non-feature?

P.S.  I never really noticed before now, but even when I load a nice friendly MP4/AVC/AAC file into Avidemux and then hit the Play button, I can see the video stream playing, but there's no audio.  What gives?  How come?  Bug or feature?

Jan Gruuthuse

Quote from: rfg on November 27, 2016, 01:27:36 AM
P.S.  I never really noticed before now, but even when I load a nice friendly MP4/AVC/AAC file into Avidemux and then hit the Play button, I can see the video stream playing, but there's no audio.  What gives?  How come?
Avidemux Menu => Edit => Preferences => [Audio]
If AudioDevice shows Dummy, select a working solution here. (OS/Hardware dependend)

Jan Gruuthuse

Quote from: rfg on November 27, 2016, 01:27:36 AM

I have an .wmv file which contains a single VC-1/MP@HL/WMV3 video stream and a single WMA/version2 audio stream.  I can load this into Avidemux, no problem, and I can hit the Play button and it plays (but no audio comes out of my speakers) and Avidemux then even allows me to trim off the front part of the file (i.e. at some key frame)but when I go to save ithe resulting trimmed file (using "copy" for both video and audio) into a .mkv file/container, I get the error "Cannot open Muxer".  Why?  And what is the fix or workaround?  (I understand that perhaps avidemux doesn't know how to -encode- either VC-1/WMV3 or any flavor of WMA, but in this case I am -not- asking it to do that.  I am only asking it to trim the file at a key frame.  So what's the problem?  If this a bug or just a non-feature?

Update 1st to latest avidemux for your OS or use universal app (Linux): http://www.avidemux.org/nightly/

If that does not work:
Import audio from the video clip, drag and drop on audacity (windows requires audacity FFmpeg import/export library, found on Optional Downloads). And export audio to the wanted format

rfg

Quote from: Jan Gruuthuse on November 27, 2016, 07:13:58 AM
Quote from: rfg on November 27, 2016, 01:27:36 AM
P.S.  I never really noticed before now, but even when I load a nice friendly MP4/AVC/AAC file into Avidemux and then hit the Play button, I can see the video stream playing, but there's no audio.  What gives?  How come?
Avidemux Menu => Edit => Preferences => [Audio]
If AudioDevice shows Dummy, select a working solution here. (OS/Hardware dependend)
Thanks.  I should have really looked at and then described at this issue better before I posted.

I switch back and forth between Ubuntu and Windows7, depending on which seems to work best for the task at hand.  On Ubuntu, where I have Avidemux 2.6.15 installed, I actually -do- get audio when playing back MP4/AAC files.  But still no audio there when playing WMV/WMA files.  I would just follow your suggestion and go to:
Avidemux Menu => Edit => Preferences => [Audio]

but on Ubuntu I'll be damned if i can figure out how to even get the main Avidemux menu to come up. :-(  Could you give me a hint?

(Humm... weird.  I have a lot of .WMV files.  I tried several on Ubuntu where I have 2.6.15 installed, and mostly there's no audio on playback.  But for one of them, there -was- audio, but only for about 1 second at the start and then it cut out entirely.  Like I say, weird.)

Oh!  And by the way, have you ever noticed that with 2.6.15 if it is used under Ubuntu on AMD hardware (VDPAU) if you put the mouse down on the timeline and then use the mouse wheel to reposition the timeline cursor, the frame that's displayed in the video preview window doesn't properly update -until- you move the mouse cursor entirely out of the Avidemux window.  When you do that, then just as it crosses the outer edge of the Avidemux window... SNAP!  The frame displayed in the video preview sub-window then updates.

I'm guessing it may have something to do with VDPAU because over in the xterm window that I launched avidemux from, at the instant the mouse crosses the edge of the avidemux window (which is also the instant when the video preview updates to the correct frame) I see some "console" message there in that xterm windows saying something about VDPAU at that instant, every time.

rfg

Quote from: Jan Gruuthuse on November 27, 2016, 07:18:14 AM
Quote from: rfg on November 27, 2016, 01:27:36 AM

I have an .wmv file which contains a single VC-1/MP@HL/WMV3 video stream and a single WMA/version2 audio stream.  I can load this into Avidemux, no problem, and I can hit the Play button and it plays (but no audio comes out of my speakers) and Avidemux then even allows me to trim off the front part of the file (i.e. at some key frame)but when I go to save ithe resulting trimmed file (using "copy" for both video and audio) into a .mkv file/container, I get the error "Cannot open Muxer".  Why?  And what is the fix or workaround?  (I understand that perhaps avidemux doesn't know how to -encode- either VC-1/WMV3 or any flavor of WMA, but in this case I am -not- asking it to do that.  I am only asking it to trim the file at a key frame.  So what's the problem?  If this a bug or just a non-feature?

Update 1st to latest avidemux for your OS or use universal app (Linux): http://www.avidemux.org/nightly/

If that does not work:
Import audio from the video clip, drag and drop on audacity (windows requires audacity FFmpeg import/export library, found on Optional Downloads). And export audio to the wanted format
Thanks, I guess, but you didn't really explain what the problem is here, and I'm the curious type, so I really would like to understand what goes on under the covers here.  What does the error "Cannot open Muxer" actually MEAN?  I mean did the MKV muxer just up and suddenly decide to take a little late fall vacation in the south of France for a week or three?
It's perplexing, but I'd like to understand, if possible.

Oh!  and by the way, i got that same error when trying to save chopped parts of WMV/WMA files to MKV files under -both- Windows7 -and- Ubuntu.

Jan Gruuthuse

#5
- On ubuntu:
-- VDPAU is geared towards NVIDIA gpu
-- for GPU cards manufactured by AMD select the proprietary fglrx driver

- WMV/WMA: not all is supported on avidemux (Windows Media Video (WMV) is a compressed video file format for several proprietary codecs developed by Microsoft.)
- Avidemux Menu, depending on ubuntu settings, is accessed either by hovering over the avidemux window title bar (see attached screen shot below) or desktop title bar.

Switching between Ubuntu and Windows7: none of them are installed as a virtual system? (one installed in the other, could have hardware issues)
As long as these are installed alongside (dual boot/boot selectable) there should be no problem.

on ubuntu 64-bit download from http://www.avidemux.org/nightly/appImage/ the avidemuxUniversal_amd64_161124_89.app.
Set property (right click on app)
Mark in tab [Permissions] Execute: [v] Allow executing file as program.
This runs avidemux without installing anything on ubuntu, all is present within the app. See what issues are still there.


eumagga0x2a

Quote from: rfg on November 27, 2016, 09:06:05 AM
I have an .wmv file which contains a single VC-1/MP@HL/WMV3 video stream and a single WMA/version2 audio stream.  I can load this into Avidemux, no problem, and I can hit the Play button and it plays (but no audio comes out of my speakers)

Could you please provide a sample?

QuoteAvidemux then even allows me to trim off the front part of the file (i.e. at some key frame) but when I go to save ithe resulting trimmed file (using "copy" for both video and audio) into a .mkv file/container, I get the error "Cannot open Muxer".  Why?

The reason why setting up muxer failed would be clearer if you post the Avidemux log. Generally this error is printed if either guessing the format or creating the output file fails.

QuoteAnd what is the fix or workaround?  (I understand that perhaps avidemux doesn't know how to -encode- either VC-1/WMV3 or any flavor of WMA, but in this case I am -not- asking it to do that.  I am only asking it to trim the file at a key frame.  So what's the problem?  If this a bug or just a non-feature?

Difficult to tell without the log, likely WMV3 is not supported for MKV in Avidemux.

rfg

Where's the log file and do I need to do anything specail to enable logging?

Regarding providing a sample, probably not.  Proprietary, ya know.

Anyway, I managed to find an interesting work-around that's adequate for me.  As it turns out, if I use ffmpeg to convert -just- the audio track to AAC and then ask ffmpeg to put the WMV(video)+AAC(audio) into a MKV container, and if I then load this result into avidemux, *then* it seems that I actually *can* use avidemux to chop the file *and* export the resulting chopped file to an MKV container.  No problem.

Or alternatively, it also appears that if I tell avidemux to copy the video but convert the WMA audio track to AAC, then in this case also, outputting to an MKV container works just fine.

But I am preferring the ffmpeg approach just because I built ffmpeg from sources and included the Fraunhofer FDK AAC encoder, which is supposed to be the best (and I'm guessing is probably better than either of the two that are built in to avidemux).

Is it possible to -easily- build avidemux with the Fraunhofer FDK AAC encoder?  If so, are their some idiot-proof instructions someplace for doing that?

AQUAR

If it can read the audio for the conversion then its seems strange there is no audio sound.
Might be something that needs looking into.

Jan Gruuthuse

Quote from: rfg on November 28, 2016, 08:22:19 AM
Is it possible to -easily- build avidemux with the Fraunhofer FDK AAC encoder?  If so, are their some idiot-proof instructions someplace for doing that?
AAC (FDK) is available in avidemux 2.6.15

rfg

OK, just two quick notes and then I'll go off and try to download the nightly and see if it cures these two small issues.

First, on Ubuntu, the menu choices that you've shown in the black bar at the top of the avidemux window simply do not show up at all in that black top bar unless I maximize the Avidemux window so that it covers the whole screen.  (When the avidemux window is not maximized, the black top bar is just solid black, with only the three round control buttons showing at the far left of the bar.)

Second, unlike for you, there is no FDK option in the audio encoders drop down menu.

These two small problems are present in the avidemux that I installed from, I believe, the standard Ubuntu repository, but I'll check to make sure about that if someone will tell me how to do that.  (I'm really a FreeBSD guy and largely ignorant of the whole packages system on Debian/Ubuntu, so I don't know where or how to check to see which repository was used when I installed this thing.)

Anyway, the thing claims to be version 2.6.15.

Jan Gruuthuse

#11
1) Menu
---------
Ubuntu: System Settings: Appearance:  [behaviour] Tab:
Show the menus for a window
( ) In the menu bar
(*) In the window's title bar

this on Unity Desktop

2) fdk
-------
check if libfdk-aac0 is present on your computer

dpkg -l libfdk*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                               Version                Architecture           Description
+++-==================================-======================-======================-=========================================================================
ii  libfdk-aac-dev:amd64               0.1.2-1                amd64                  Fraunhofer FDK AAC Codec Library - development files
ii  libfdk-aac0:amd64                  0.1.2-1                amd64                  Fraunhofer FDK AAC Codec Library - runtime files


if missing please install:
sudo apt-get update && sudo apt-get install libfdk-aac0

rfg

Sorry for the tardy reply.  I got caught up in other matters yesterday.

Regarding that Ubuntu/unity menu setting... THANKS!  I didn't know about that at all, but it sure helps.  Now the menu is visible in the top black bar, even when the avidemux window is not maximized... well... at least when I mouse over the bar.  (Seems goofy that they disappear all the menu items when the mouse is not over the bar, but obviously some Ubuntu engineer thought that would be a Good Idea.)

Regarding the FDK library, yea, it looks like I do have it installed:

$ dpkg -l libfdk*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version      Architecture Description
+++-==============-============-============-=================================
ii  libfdk-aac-dev 0.1.3+201408 amd64        Fraunhofer FDK AAC Codec Library
ii  libfdk-aac0:am 0.1.3+201408 amd64        Fraunhofer FDK AAC Codec Library


but the audio output menu of avidemux is still not showing FDK as an option.  I'll make a screenshot and post it if you like, but honestly, the only AAC options that are showing in the pull down menu are:

AAC (Faac)
AAC (lav)

I'll try to download that nightly build now and try and see what that does.  (Sorry, I didn't get to do that yet.)

rfg

OK, so I downloaded the nightly, as you instructed, ran it, and sure enough, it is providing FDK as an option for audio conversion to AAC (along with Faac and lav).

So, it's just the Avidemux 2.6.15 that I got... probably from the official Ubuntu repository... that doesn't have the FDK codec.

And actually, that might not be entirely surprising.  I had the same issue with ffmpeg.  The FDK library apparently has a license that isn't 100% GPL compatible, so there are no pre-built versions of ffmpeg anywhere online that have FDK included.  If you want it, you gotta build ffmpeg yourself from sources (as I did).

So my guess is that whoever built Avidemux and put it into the Ubuntu repository probably looked at the FDK stuff and said "Oh!  That's not 100% GPL, so we will only put up a pre-built version of Aviemux that doesn't include that."

Well, that's my best guess anyway.

rfg

Just want to say "Thanks!"  for the help.  I'm pretty darn happy with this nightly, and will be using that, going forward, since it mostly does what I want and it seems entirely stable so far.

Mind you it still has the issue that it also is refusing to save a WMV/WMA file to an output .MKV file.  Same error as I reported already... a little pop-up box pops up and says "Muxer Cannot open".

Because I started Avidemux (nightly) from an xterm window, I can (and will) share with you all the messages that came up in that xterm window after the point where I hit "Save" in the GUI.  I hope this is the log file data you asked for.  If there is some other/additional log file somplace else that you want also, you should let me know.

===============================================================
...
  [HandleAction] 22:41:02-662  ************ SAVE_VIDEO **************

  [admSaver] 22:41:31-887  [Save] Encoder index=0
  [save] 22:41:31-887  Audio starting time 00:07:35,222
  [save] 22:41:31-887  [A_Save] Saving..
  [checkCutsAreOnIntra] 22:41:31-887  Checking cuts start on keyframe..
  [switchToSegment] 22:41:31-887  Trying to switch to seg 0 with startTime in reference pic= 0 ms
  [seektoTime] 22:41:31-887  First frame of the new segment is a keyframe at 100ms
  [seektoTime] 22:41:31-887  Seek to time without decoding ok
  [switchToSegment] 22:41:31-887  Switched ok to segment 0 (dontdecode=1)
Seeking.. curseq:2 wanted seq:1 packet=0
Seeking done, starting at seq=1
[checkCutsAreOnIntra] 22:41:31-887  seg:0 refDTS=100100
  [checkCutsAreOnIntra] 22:41:31-887  seg:0 imgDTS=18446744073709551615
  [checkCutsAreOnIntra] 22:41:31-887  Segment 0 ok
  [setupVideo] 22:41:31-887  Simple copy mode engaged
  [ADM_videoStreamCopy] 22:41:31-887  Creating copy video stream, start time=455.22 s
  [ADM_videoStreamCopy] 22:41:31-887  Some B frames are non droppable, increasing delat by 0 us
  [ADM_videoStreamCopy] 22:41:31-888  PTS/DTS delta=109861 us
  [ADM_videoStreamCopy] 22:41:31-888   Fixating start time by 109861
  [ADM_videoStreamCopy] 22:41:31-888   Starting DTS=455112, PTS=455222 ms
  [goToTime] 22:41:31-888   go to time 455.11 secs
  [goToTime] 22:41:31-888  => seg 0, rel time 455.11 secs
  [setupAudio] 22:41:31-888  Setting up 1 audio track(s)
  [setupAudio] 22:41:31-888  [audioTrack 0] Creating audio encoding stream, starttime 00:07:35,112(copy)
  [audioCreateCopyStream] 22:41:31-888  Creating audio stream copy with compensation : startTime=00:07:35,112
  [audioCreateCopyStream] 22:41:31-888  and shift =00:00:00,000
  [ADM_audioStreamCopy] 22:41:31-888  Creating copy stream, startTime=00:07:35,112, shift=0
  [goToTime] 22:41:31-888   go to time 455.11 secs
  [goToTime] 22:41:31-888  => seg 0, rel time 455.11 secs
[FF] Muxer opened
[FF] Using 5 bytes for video extradata
[initVideo] 22:41:31-888  Video has extradata and muxer requires globalHeader, assuming it is done so.
[FF] Video initialized
[MP3] TimeBase for video 1001/30000
[FF] Bitrate 96
[FF]: Unsupported audio
================================================================

Note that as before (with the "official" pre-built Ubuntu package) if I elect to convert justthe WMA audio track to AAC before I try to save to a .MKV output file, then there's no problem.  So it really does seems that it is only the act of attempting to do a straight copy of an input WMA audio track that is giving Avidemux the heartburn.  (But as I said before, ffmpeg seems able to do this, even though, as i understand it, ffmpeg also doesn't itself have the capability to encode WMA.  But it can at least copy a WMA track, which, apparently, Avidemux cannot.)

P.S.  Please notice the message in the above:

    Some B frames are non droppable, increasing delat by ...

Small typo there?

P.P.S.  The exact description of the problematic audio track in this case, according to the mediainfo tool is as follows:

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.2 -  96 kbps, 44 kHz, stereo 2-pass VBR
Duration                                 : 9mn 21s
Bit rate mode                            : Variable
Bit rate                                 : 95.9 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 44.1 KHz
Bit depth                                : 16 bits
Stream size                              : 6.42 MiB (1%)
Language                                 : English (US)