LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Converting .asx to something useful (https://www.linuxquestions.org/questions/linux-software-2/converting-asx-to-something-useful-600973/)

IncredibleKarma 11-19-2007 08:11 PM

Converting .asx to something useful
 
So I've so far been confidently hacking my way through my first 2 months on a Linux box, however I've come upon a snag. I've been freeing up some HD space by storing videos on VCD's and I've come across an .asx file I cannot convert. I've tried using tovid to convert the file which generates an ffmpeg command which fails to produce a good file. I've used my own ffmpeg command in a terminal with the same results, and I'm not confident enough after reading the man pages for mpeg2enc to construct the command I want to use. Has anyone converted an .asx video file to say .mpg successfully? Can you help me out?

Here's some of what I get back from the terminal:

Firstly, here's what idvid tells me about the file:
idvid
Video identification script
Part of the tovid suite, version 0.31
http://www.tovid.org
--------------------------------
Analyzing file: 'myfile.asx'. This may take several minutes...
=========================================================
File: myfile.asx
Width: 720 pixels
Height: 480 pixels
Aspect ratio: 1.50:1
Frames: 11466
Duration: 00:06:23 hours/mins/secs
Framerate: 1000.000 frames per second
Video format: WMV3
Video bitrate: 890000 bits per second
---------------------------
Audio track 1 (Stream 0.0, AID 0):
---------------------------
Codec: wmav2
Bitrate: 128000 bits per second
Sampling rate: 44100 Hz
=========================================================
Audio is compliant with the following formats:
Not compliant with (S)VCD or DVD
Video is compliant with the following formats:
Not compliant with (S)VCD or DVD
This video does not seem to be compliant with (S)VCD or DVD
standards. If you burn it to a video disc, it may not work.

Here is the ffmpeg command I am using:
ffmpeg -i myfile.asx -target ntsc-svcd /tmp/myfile.mpg

And here is it's output:
ffmpeg version CVS, build 3276800, Copyright (c) 2000-2004 Fabrice Bellard
configuration: --extra-cflags=-fomit-frame-pointer -DRUNTIME_CPUDETECT --buil d i486-linux-gnu --enable-gpl --enable-pp --enable-zlib --enable-vorbis --enable -libogg --enable-theora --enable-a52 --enable-dts --enable-dc1394 --enable-libgs m --disable-debug --prefix=/usr
built on Oct 4 2006 10:57:36, gcc: 4.0.3 (Ubuntu 4.0.3-1ubuntu5)
[wmv3 @ 0x8336c48]This decoder is not supposed to produce picture. Dont report t his as a bug!
[wmv3 @ 0x8336c48]Profile 1:
frmrtq_postproc=7, bitrtq_postproc=12
LoopFilter=0, MultiRes=0, FastUVMV=0, Extended MV=0
Rangered=0, VSTransform=0, Overlap=1, SyncMarker=0
DQuant=1, Quantizer mode=0, Max B frames=0

Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 30.00 (30/1)
Input #0, asf, from 'myfile.asx':
Duration: 00:06:24.4, start: 1.578000, bitrate: 890 kb/s
Stream #0.0: Audio: wmav2, 44100 Hz, stereo, 128 kb/s
Stream #0.1: Video: wmv3, yuv420p, 720x480, 1000.00 fps
File '/tmp/myfile.mpg' already exists. Overwrite ? [y/N] y
***(this is from subsequent attempts to convert this tricky format)***
Output #0, svcd, to '/tmp/myfile.mpg':
Stream #0.0: Video: mpeg2video, yuv420p, 480x480, 29.97 fps, q=2-31, 2040 kb/s
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 224 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[wmv3 @ 0x8336c48]This decoder is not supposed to produce picture. Dont report this as a bug!
[wmv3 @ 0x8336c48]Profile 1:
frmrtq_postproc=7, bitrtq_postproc=12
LoopFilter=0, MultiRes=0, FastUVMV=0, Extended MV=0
Rangered=0, VSTransform=0, Overlap=1, SyncMarker=0
DQuant=1, Quantizer mode=0, Max B frames=0
Press [q] to stop encoding
[wmv3 @ 0x8336c48]concealing 1350 DC, 1350 AC, 1350 MV errors
[wmv3 @ 0x8336c48]VOP DQuant info
[wmv3 @ 0x8336c48]concealing 1350 DC, 1350 AC, 1350 MV errors
Segmentation fault

When I attempted to convert it using the Tovid GUI it went through the process and reported the encoding a success but did not actually encode any data, producing a result familiar to what should have been but with 0's as amount of data encoded.

If anyone could tell me where it is I've gone wrong it'd be greatly appreciated. Oh, and it may be worth mentioning that my distribution was Ubuntu Dapper Drake, but by now is modified enough to be considered something unrecognizable. Thanks so much.

David the H. 11-21-2007 09:56 AM

There are so many factors involved in multimedia conversion that no one tool is ever able to handle everything. In my experience things that should work often don't, and it sometimes takes a lot of work with different tools to get them converted.

Well, in your case, the video codec is wmv3, and the audio is wmav2. The file you have is actually in .asf format; asx is just an xml metafile, sort of like a playlist file. It's common to get the wrong extension on these. I can't say for sure offhand why it doesn't work in ffmpeg, especially the "This decoder is not supposed to produce picture" warning. I do notice that you have a rather limited version of ffmpeg though. On Debian, their free software guidelines force them to leave out support for non-free codecs in the version they distribute. Maybe it's the same with yours. You either have to install a more enabled version from another source or recompile it yourself with all the extra codecs. On Debian you can use the debian-multimedia.org sources, but I don't know about *buntu. If you run 'ffmpeg -formats' you'll get a list of all the formats and codecs your current version supports.

Tell me, does the thing play properly in mplayer? If so, then you can probably use mencoder to convert it, if nothing else. I'm also partial to transcode, which can use mplayer as an input module, among others, and mpeg2enc as an output encoder (and I don't believe mpeg2enc can take raw wm files as input anyway). If it will play in mplayer, then transcode will surely work. But then again, mplayer mostly relies on the same libavcodec that ffmpeg does, so it might not work either.

BTW, a great frontend for video conversion is avidemux. It uses transcode, mplayer, ffmeg and others as backends, and has a nice easy-to-use interface. I highly recommend it.

But when it comes to windows media (may the b*ds who inflicted it on the world suffer eternal torment), I think the vlc player actually has the best support. mplayer and xine both tend to glitch occasionally on playback, but vlc usually has a pretty good picture. And you can convert it to a different format using the stream save option. The options are a bit limited, but I've used it to convert .wmv stuff that I wasn't able to get working any other way. Try it out.

lazlow 11-21-2007 03:18 PM

I will second Avidemux.

IncredibleKarma 11-22-2007 02:23 AM

Actually my version of ffmpeg is fairly reliable, considering all the proprietary formats I've installed. However, I had used the -format to command to check the problem, and though .asx is not listed, .asf is. Seeing as it does not seem to want to do it, it seems like a moot point. Ubuntu is a debian based distro so it would make sense that it's having a disagreement with the proprietary format. And as far as I can tell, ffmpeg prints the "will not produce picture" message on all files it is fed, as if to tell me it will not play as it encodes. It seems harmless. I wasn't aware it was unusual, and I imagine is probably due to how hard I've been trying to break this installation of linux. [Were this windows, I'd have killed it so many times over by now. Linux has definitely impressed me.]

It does indeed play just swell in mplayer, and one or two others I believe. I'm almost certain xine and gxine could play it as well, though I've not tried. I had never yet encountered transcode, so thanks for the heads-up, that sounds pretty promising. I think I had gotten avidemux either the day of this post, or the day before but I haven't had much chance to play with it, it's good to know I may already have a solution. I confess I'm still a little used to windows-speak in which I was a video ninja, linux will take some adjusting to and it feels a bit like learning to walk again.

I agree vlc is a great program, it's the only thing I've found so far where the seek bar can be moved to any position without the video sticking or becoming so blocky as to render it unwatchable for a few moments, even on files as large as a GB.

All in all you've brought a good deal of functionality of programs I already have to light that I wasn't aware of, and I'm appreciative. And since I can see you've dealt with ridding yourself of the windows format before [I agree, *stards] I'm curious if you can tell me if I batch encode a bunch of .wma files, which of the above methods might you suggest to avoid that horrible screech I had gotten in the output the last time I tried? The files played great and were converted with no discernible loss, but I couldn't seem to shake that one or two horrid extra seconds it had added at the beginning. Also, have you found a media player that functions similar to *shudder* Windows Media Player, i.e. one that can handle pretty much all I can throw at it including videos? So far I've tried Rhythmbox, Amarok, XMMS, Madman, and the Songbird Pre-release. Amarok has great funtionality, but can't quite handle the breadth of formats I'd like. I know, I'm sort of a fool for trying to turn a linux box into a multi-media ninja out of the gate, but I like a challenge, and it's certainly not for lack of software. I think I may even still be able to eventually get back up to the quality of editing I could do on my former OS using Cinelerra.

Thanks Dave, you've been really helpful. And avidemux does look promising, I figure if I could teach myself photoshop, it couldn't be much more complicated.

Cheers

David the H. 11-23-2007 01:05 PM

The reason I know your ffmpeg is reduced in function is that it shows only a few "--enable-xxx" flags. The debian-multimedia version has several more, including libmp3lame, libfaac/d, libx264, and libxvid. Most of them are probably more for encoding support than decoding, as libavcodec can decode the majority of the common formats. Strangely though, mine doesn't have some of the ones yours does, like libdts. I guess you probably have to compile it yourself if you want support for everything. And yes, *buntu generally follows Debian, but there are also important differences, especially in the realm of proprietary stuff, so you have to be careful about making generalizations there.

And no, I've never seen the "won't produce picture" warning before, so I assumed it had something to do with the file or the codec, but if you say it shows up all the time then it's obviously not a problem. I think your file is probably just corrupt or poorly encoded in some way and ffmpeg is simply choking on it. I've come across files before that will play fine, but fail on any attempt at conversion due to low-level encoding errors or codec bugs.

transcode is a great tool. It works by running the file through an input plugin (including mplayer and ffmpeg) into a lossless intermediate format, then sends it to a separate output encoder, like mpeg2enc. You can also apply various filters and conversion settings along the way. It's very flexible, but it does take some time to learn how to use it properly. I also like using some of transcode's included cli tools on their own, especially tcextract, which you can use to quickly demultiplex audio and video into elementary streams. I've found that it's often better to demultiplex and work on the audio and video streams separately, then combine them again at the end to get the finished product.

Which reminds me. The whole *nix philosophy revolves around the idea of using one tool to do one job, as opposed to combining everything into one bloatware program. So you'll probably find yourself using a variety of tools as you work anyway. I personally use ffmpeg for most quick-'n-dirty work, and transcode with plugins like mpeg2enc for stuff I want in higher quality. I also find myself using avidemux more and more, mostly because it makes it really easy to set up various filters and it lets you see what the output will be like before you run it. But which tools I use also depends a whole lot on what will handle what, and I sometimes have to work with other tools, like vlc, as I mentioned.

Oh yeah, by the way, didn't you know? Cinelerra is available on Linux. You can get it here, if it isn't already in your apt repository somewhere. It's yet another package served up by debian-multimedia here, and I tried it out once, but I couldn't quite understand how to get it to work correctly and there was an instability bug or two at the time. Besides, I don't really need that kind of power. The standard Linux tools do just about everything I want.

When it comes to video playback, I personally prefer xine. I just like the interface. But I sometimes have to switch to mplayer if xine can't handle a particular format. This is especially true on my x86_64 machine, since the win32codecs package won't run on it. And as I said, I've found the quality of .wmv on xine and mplayer to be less than satisfactory, so I often use vlc to play them or convert them to something more suitable. I generally don't use it unless I have to though.

For audio, I mostly use audacious. It's an updated version of xmms, and it has plugins for almost all of the major formats. It even has an mplayer plugin for video if you want it. It's not a full media center like WMP, but again, I like the one tool, one job way of doing things anyway and could never get used to big suites like amarok.

Now finally, about that .wma conversion problem. How are you converting them? Are you just running them through ffmeg? I don't remember getting any "screeching" myself when I've worked with them (assuming the files will convert at all). Your best bet would be to strip them to an intermediate .wav file first, to see if it's a decoding problem, and to give the audio encoder the cleanest input you can. For working with audio files, the two best tools are probably audacity (gui) and sox (cli). I find sox especially useful for certain audio effects. I recently had to use it to stretch the soundtrack from a poorly-constructed video that was too short and so drifted over time.

Another good program for simple audio file conversion is soundconverter. It uses gstreamer as a backend and will only handle a few common formats and quality settings (be sure to install the gstreamer-lame and gstreamer-ffmpeg packages for full support), but it's very convenient when you want to batch-convert a bunch of files at once. The most useful thing about it, however, is that it will pass whatever metadata tags exist on to the new format, so you don't have to manually re-add them afterwards.

David the H. 11-23-2007 01:32 PM

Whoa, I think I may have found the problem. Your file says "Framerate: 1000.000 frames per second". I hadn't noticed that before. 1000fps? Impossible. No wonder ffmpeg chokes. The real framerate is obviously 29.97, according to the number of frames and playback time. There must be some error in the file metadata or something.

This isn't the first time I've seen wrong numbers for windows media files. Yet another reason to hate the format.

IncredibleKarma 11-25-2007 08:19 AM

Cutting right to the end of your reply: Yeah, 1000fps? I definitely didn't read that closely. No worries though, I got it to work more or less earlier using mencoder. I successfully encoded it once albeit at a very low quality, and it's failed to work since, but I figure I've made an admirable attempt and since I can play it anyway, I may as well just leave it on the computer. An extra 60MB or so isn't too much of an storage issue.

Regarding ffmpeg, it doesn't seem to be the only thing with a broad variance among installations. Should I so require, whoever generated my installation disk made sure I could save in Atari format out of the box. With .asf and .wma tackled, I'll wait until I run into the next hurdle. I did check out transcode earlier, I can't say I completely understand it yet, but it looks like it's got the most versatility of what I've seen and you seem to back that up so I've got pretty high hopes for it. Cinelerra, yeah, my grammar kind of sucks anymore... I was using Premier on Windows among other things. I could still use it via wine, but I wanted to give the open-source competition a try. I haven't been able to test it much, but I can tell you there's still a bug or two. Xine does have a sweet interface doesn't it? Very slick. Makes me want to get around to that Enlightenment desktop that I'll most probably never build.

Audacious you say? I haven't heard of that one yet, and that Mplayer plugin sounds like exactly what I was looking for. My PC ends up being a background source of noise while people are visiting or I'm not otherwise sitting right in front of the PC, and being able to have something that can shuffle through a playlist of mixed media is the best I could want. Suite features like artist info, music stores, and the like is less important to me. If it's got scrobbling support or if there's a plugin available than it's all I'd need. I like the suites, I seem to be more proficient in them for some reason, but they haven't given me what I need. So I guess it's fortunate I also like to use a lot of programs in a kind of redundant chain of options.

SoundConverter has been handling .wma just fine, after I realized the track I tested it on was supposed to have the funny clicking sound on it it's been chugging through everything a "locate .wma | more" can throw at it. Which is fortunate because my version of Audacity won't support .wma. And anything more threatening I can run into... say, that freaky iTunes store format I loathe, can be defeated via a thumbdrive and some walking if all else fails.

Ah well, thanks a lot Dave. But now I've got a lot of converting to get to.

Cheers.


All times are GMT -5. The time now is 03:03 PM.