View Full Version : Transcode/convert from MP4 to AVI
mustardman
8th March 2007, 02:12
I have not been able to find any information on either transcoding (or converting/re-encoding) streams within a MP4 container back into an AVI container, only from MKV to AVI.
The sticky contains lots of info on MP4, converting to MP4 and playing MP4, but nothing on going back the other way.
Because my particular MP4 container holds MP4V and MP4A, I suspect I'll have to re-encode?
I have only found a directshow MP4 splitter, but not a VFW splitter. So, at the moment, my procedure is looking like...
1) Use the splitter (Haali or Gabest) to allow directshow decoding. I don't know yet if I need any more codecs (MP4V & MP4A).
2) Use AVIsynth to read the directshow streams.
3) Use VirtualDub to re-encode the video to my chosen format (in this case, XviD).
Unfortunately VirtualDub will only support CBR audio (MP3 in particular), so I will probably have to add more steps...
3b) Save the audio that AVIsynth has provided to VirtualDub as a WAV.
4) Compress the WAV to a VBR MP3 stream (LAME, etc)
5) Use VirtualDubMod to re-combine the streams together.
This is a long and somewhat cumbersome process.
Is there a simpler way?
Even if I could use the audio & video streams directly in an AVI, I haven't come across any utilities to separate (& save separately) the streams from within a MP4. Are there any?
Cheers,
MM
ilovejedd
8th March 2007, 02:40
XviD is just the codec. Do you mean you want to convert to AVI? If so, yes, there's a simple way, one that does not require re-encoding the video stream.
I use Yamb (Yet Another MP4Box gui) for MP4 manipulation (splitting, joining, extracting raw streams, etc), but since you'll be working with muxing to AVI, I suggest you search for Avidemux. You can still extract audio and video streams with Yamb and mux to AVI using VirtualDubMod.
MP4V is MPEG-4 ASP (I think h.264 is usually denoted by AVC1) so just extracting the video stream to AVI and changing the FourCC of the extracted AVI to XVID should be fine.
As for the audio, just extract the audio stream and convert directly to MP3 with BeSweet.
Mux AVI and MP3 with Avidemux or VirtualDubMod.
mustardman
8th March 2007, 05:17
@ilovejedd
Thankyou for your tips about YAMB. I found it really good for stripping out the video direct to AVI - and it automatically changes the video stream codec descriptor to XviD!
I had to extract the audio separately, direct to an AAC file, so this will indeed need extra processing (in my case).
Strangely, YAMB reported an error when extracting both the video and audio streams : "Exporting failed". Interestingly, when I started it again, and tried exactly the same input MP4 file, it extracted both without errors! Anyway, it works, and saves lots of messing around.
As the AVI container is not able to hold AAC, I'll have to re-encode that - but at least re-coding audio is a lot faster than having to re-code video!
Thanks again.
MM
The AVI container is able to contain AAC. No need to transcode it. Use a tool like avimuxgui (http://www.alexander-noe.com/video/amg/) to mux it.
I imagine you want to play those files on a standalone player which doesn't support aac audio, right ? Because if you would use a PC or HTPC you wouldn't need to do this transcoding for playback.
mustardman
8th March 2007, 21:18
@KoD
Thanks for the tip on AAC. I had not previously heard if AAC was supported inside an AVI, so I did a search for what audio formats were allowed. I couldn't find any sites/articles that said AAC could (only looked for about 20 mins though).
My primary goal is to make the files playable using fairly standard computer software (without having to load splitters and such - still need the video decoder though :) ). My secondary goal is hardware playback. Like you said, computer playback with AAC inside an AVI should(?) be easy, but there is (as yet, perhaps never) no hardware support.
The weird thing is that these files only have one video stream and one audio stream in them - there is no other data (subtitles/chapters/alternate audio tracks/etc). Begs the question why they were put into MP4 in the first place - I thought the primay goal of MP4 was to support the things AVI didn't!
Thanks for your reply.
MM
ilovejedd
8th March 2007, 21:33
AAC support in AVI is flaky. There's no ACM version for AAC so it's only supported via DirectShow meaning no VirtualDub, etc. Better to convert to MP3 and just keep the original MP4 file.
mustardman
9th March 2007, 01:32
I found an article over at HA discussing AAC in AVI (the thread got rather off topic and started talking containers - and bagging AVI in general). As you mentioned, AAC support seems marginal at best. A better option would be to re-encode the audio to something more sensible, or... as my initial goal was for compatibility with existing software...
Since video (and possibly audio) codecs are going to be needed anyway, I might as well employ the use of a splitter - all I have to do is make sure my particular 'end use' software will work with a split MP4 ! (no guarantees there)
There remains hardware player compatibility... Perhaps it would simply be better to upgrade - better support for newer formats, and it's about due anyway!
Cheers all,
MM
ilovejedd
9th March 2007, 03:51
Now all we need is a standalone player that supports MP4, ne? ;) Hmm, the PS3 can do it but it's entirely too expensive. Right now, it's the only (non-standalone) player that I know of which has native AVC and AAC support (must be in MP4 container). There's a thread in the hardware section regarding a very capable standalone player in development. I believe SeeMoreDigital is a beta tester for it.
mustardman
9th March 2007, 09:13
Hardware...
The sticky at the top about MP4 lists quite a few hardware players that can handle MP4, but without trying any myself, I'll just have to take it on faith!
Is there a "MP4 verified" logo as there is for "XviD verified"?
MM
I can guarantee playback of AAC in AVI files works perfectly on a PC from personal experience. There's no need for another splitter, on Windows the avi splitter that comes with the operating system is all that's required. For decoding AAC, just enable it in ffdshow audio decoder configuration. (ffdshow has the best free aac decoder implementation). I'm not an AVI format supporter, but that doesn't change the fact that AAC in AVI works and doesn't break any standards either.
As for other platforms, I pretty sure mplayer has no issues with playback of such files either.
Standalone hardware players are another matter.
ilovejedd
9th March 2007, 16:26
The sticky at the top about MP4 lists quite a few hardware players that can handle MP4, but without trying any myself, I'll just have to take it on faith!
Is there a "MP4 verified" logo as there is for "XviD verified"?
The listed players in the hardware section refers to MPEG4 codec support. XviD is an implementation of the MPEG4 (Part 2?) standard as is DivX. The MP4 container is another thing entirely.
My oldish Philips DVP642 can handle playback of MP4 container. Discovered this accidentally as I was playing a disc with XviD AVIs with a couple of old PSP encodes in it (XviD video, AAC audio). The PSP encodes played albeit without audio. Adding container support is easy. The manufacturers can just add it via a firmware update. Codecs, however, are another story.
I'm waiting a bit before buying another standalone as MPEG4 AVC is gaining ground and we should see some standalones that support it released soon. Now if even those are expensive, I'm getting a PS3 for myself. :D
I can guarantee playback of AAC in AVI files works perfectly on a PC from personal experience. There's no need for another splitter, on Windows the avi splitter that comes with the operating system is all that's required.
The splitter will be used to play the original MP4. Since he will have to install ffdshow to play AAC, he figured he might as well install an MP4 splitter.
mustardman
10th March 2007, 23:24
And yet some more...
At home I run 2K, and I want to use Video2DV to output my video clips direct to a TV. I tried different combinations of TV output video cards (Matrox, etc), and they always gave me trouble. Stumbled across Video2DV, and haven't looked back since!
My congradulations to the author! (Mike Laba)
Anyway, I digress. I can not play the MP4 container with Video2DV, even with the splitter (Haali) installed. Neither can I use Media Player Classic (both programs crash).
Interestingly, my XP system at work will play MP4s using MPC. However, I have yet to try Video2DV...
I am aware that each OS has different codecs installed, but I would not have expected a crash!
I really don't want to fork out for an upgrade from 2K to XP, so I may have to convert back after all!
MM
KoD
11th March 2007, 09:24
mustardman, have you installed a recent version of ffdshow on your home PC ? Because you don't need another splitter (it seems like you don't understand this), but you need a AAC decoder, and that's what ffdshow is, a decoder.
PS: Don't trust applications like Video2DV too much. Some applications install bad filters for decoding breaking playback. I have seen encoding/transcoding apps that wreak havoc as well as players that do the same.
mustardman
12th March 2007, 09:24
@KoD
I used to have ffdshow installed, but the decoding of XviD was absolutely woeful, so I installed the 'real' XviD decoder, but actually had to un-install ffdshow before it would work(!). Weird.
I fooled around a bit after your words of wisdom, and here is what happened...
Removed Haali splitter.
Removed ffdshow
- MPC would play AVI, but crash on MP4
- Video2DV v1.6 would play AVI, but stop on MP4 (no error)
- Video2DV v2.1 would play AVI, but stop with an error on MP4
Installed ffdshow : 2006-12-03 (rev621).
- MPC would play both AVI & MP4 (as you said)
- Video2DV v1.6 would play AVI but simply stop on MP4
- Video2DV v2.1 would crash on AVI, but stop with an error on MP4
Removed ffdshow
Installed Haali splitter
- MPC would play AVI, but crash on MP4
- Video2DV v1.6 would play AVI, but crash on MP4 (access violation)
- Video2DV v2.1 would play AVI, but crash on MP4 (access violation)
The embedded codecs in the MP4s are XviD & AAC.
[edit : removed off-topic rant about m$]
MM
bond
12th March 2007, 20:37
remove all crap filters. install haali and ffdshow. enjoy mp4
its easy
if you cant get it to work, render the mp4 in graphedit and tell what filters are used
jolson
10th April 2007, 20:16
remove all crap filters. install haali and ffdshow. enjoy mp4
Even with h.264 in .mkv?
I tried an .mkv file with h.264 and GraphEdit said that one of the streams was incompatible. There was no problem with sound out from Hali's Media Splitter, but it couldn't find anything to connect to for the video. Neither could I, I tried to "Add Filter" ffdshow but it couldn't "negotiate" with HMS.
VLC can play the file, but it uses it's own routines. MPC can only play the audio, while WMP (9 I believe) can only play the video...
bond
10th April 2007, 20:50
you didnt install ffdshow or you didnt enable h264 in ffdshow
jolson
11th April 2007, 09:02
Installing Celtic Druid's unofficial build, instead of the latest official, did the trick. But neither of your assumptions above were right.
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.