'Swap containers'

Locked
User avatar
lister007
Joined: Fri Jan 21, 2005 2:50 pm
Location: Great Britain, um the country with the best flag;)
Org Profile

'Swap containers'

Post by lister007 » Tue Sep 11, 2007 11:16 am

Is there a way to bypass recompression and just change the container, for example I have a .avi file that I want mp4 but its already compressed to h.264, so I just want to change the container with out recompressing it cos it would decrease the quality further. Even if I was to creat a lossless then recompress it I am still going to get that quality loss you know.
Spatchcock..........A dressed and split chicken for roasting or grilling on a spit.
Bring it
Image
Berserk or crazy...??? (image shack sucks will have a banner for this too when it doesn't!)

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Post by Bauzi » Tue Sep 11, 2007 3:55 pm

First of all: h.264 in avi like you might compressed it in VDM is not nearly as good as something you compress with zarxGUI, MeGUI or x264-script.

I was curious and tried it. Yes it works pretty good.
Of course the best thing would be to get the raw h.264 stream out of the avi. It might work with... graphEdit or whatever. I can´t really say how it works. Someone else should tell you.

What I did was:
Writing a small script for MP4-Box. You can mux (add clips to a container) and demux (? I heard it can demux) it too.

Just:

Code: Select all

MP4Box.exe -add "Your video.avi#video" -fps 25 -add "stream.m4a" "Output.mp4"
PAUSE
EXIT
stream.m4a was some audio to test it. Alright a put an XviD encode of my current amv for test. Uhm... yeah the only thing that bugs me is that the original soundstream of the avi seams to be lost. Even VLC Player doesn´t list it on the streamslist.
Damn it. Even graphEdit doesn´t find it anymore. So you have some data garbage in your amv.

To sum it up:
-Yes it works all you need is MP4Box.exe and my script above in a .bat with fixed input parameter and correct fps.
-However it doesn´t really make sense for me, because you might waste filesize and an stream encoded with x264.exe is MUCH more efficente than one in an avi.
-You nearly only change the extension to .mp4 and that´s it.

My new video was testet in: WMP, Zoom Player and VLC Player.
It worked fine there.
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Post by Bauzi » Tue Sep 11, 2007 4:05 pm

If you have an mp4 where there already is an audio stream you haven´t to force MP4Box to use it only as video stream with #video.

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [x264].mp4" -fps 25 "Different.mp4"
PAUSE
EXIT
Gave me the amv in another mp4 without changes.

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [x264].mp4#video" -fps 25 "Different.mp4"
PAUSE
EXIT
--> You have no audio

I tested it with the XviD encode too. If I´m right there is no way to save your audio stream.
In fact:

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [XviD_MQ].mp4#video" -fps 25 "Different.mp4"
PAUSE
EXIT
(Audio stream isn´t there)
Will give you the same result as:

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [XviD_MQ].mp4" -fps 25 "Different.mp4"
PAUSE
EXIT
(Just with bigger filesize because there is still the audiostream in it. There is just no way to play it)

MY FINAL THOUGHT:

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [XviD_MQ].mp4#video" -fps 25 "Different.mp4"
PAUSE
EXIT
Will put only your h.264 stream into the mp4. You must reencode the audiostream and add it by your hand with -add "stream.m4a". I recommend to encode your audio with NeroDigitalAudio into a neat AAC+ stream.

Everything alright or was it too confusing?
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

User avatar
Bauzi
Joined: Fri May 21, 2004 12:48 pm
Status: Under High Voltage
Location: Austria (uhm the other country without kangaroos^^)
Contact:
Org Profile

Post by Bauzi » Tue Sep 11, 2007 4:08 pm

No wait!

Code: Select all

MP4Box.exe -add "[LGS] Different Realities [XviD_LQ].avi" -fps 25 "Different.mp4"
PAUSE
EXIT
It works, but I got a HUGE failure. The audio is wrong timed and more other shit. I don´t recommend it at all. Only problems.
You can find me on YT under "Bauzi514". Subscribe to never miss my AMV releases. :amv:

User avatar
Zero1
Joined: Fri Jan 02, 2004 12:51 pm
Location: Sheffield, United Kingdom
Contact:
Org Profile

Post by Zero1 » Tue Sep 11, 2007 5:34 pm

NEVER USE VIDEO FOR WINDOWS, THEN ATTEMPT TO STORE IT IN MP4

This isn't aimed at anyone in particular, so don't take it as a personal yelling at. As I hope you all know by now, H.264 in AVI, or encoding it using Virtualdub/VfW is BAD and WRONG. Basically to go into it would be beyond the scope of this reply, but basically H.264 in AVI is hacky and non compliant. There are limitations within AVI (such as it has no concept of what B-frames are) and the fact that you have a one in, one out limit which means that it cannot decode B-frames without hacks such as lagging the video by a set amount of frames (and as such losing sync of your AMV) or by "packing" frames together so that two or more get forced to the decoder at once. Frame orders may possibly come into it too.

Same goes for XviD. While it's becoming common knowledge that H.264 in AVI = NO, people don't tend to think twice about MPEG-4 ASP (or as you know it as DivX/XviD), yet it has the same problems as H.264, just not as severe because it's less complex.

If you want to create spec compliant MP4 with either x264 or XviD, there are command line encoders for them both, alternatively software such as MeGUI can feed commands to these programs for you. I never convert AVI to MP4, but if you must, search on doom9 for a tool. There should be a seperate tool to extract the H.264 (and unscrew it if needs be) and leave you with a raw stream you can then mux using MP4Box.

If I come across it I will post it here.[/b]

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Wed Sep 12, 2007 1:58 pm

Zero1 wrote:If you want to create spec compliant MP4 with either x264 or XviD, there are command line encoders for them both, alternatively software such as MeGUI can feed commands to these programs for you. I never convert AVI to MP4, but if you must, search on doom9 for a tool. There should be a seperate tool to extract the H.264 (and unscrew it if needs be) and leave you with a raw stream you can then mux using MP4Box.

If I come across it I will post it here.[/b]
MP4Box itself will do that, unless that's a functionality of YAMB not derived from it. Whether it requires dumping to raw or can fix the streams while transferring directly from AVI I don't know/can't remember, although it does allow that with AVIs encoded with XviD or DivX (the Remove N-VOPs option is in YAMB's Import Settings dialog). As far as I know, it fixes the stream during the extraction process if you choose to dump the raw .264 or .cmp. I wouldn't assume that MP4 would allow non-compliant streams to be stored in it (save for the private area, anyway).

User avatar
lister007
Joined: Fri Jan 21, 2005 2:50 pm
Location: Great Britain, um the country with the best flag;)
Org Profile

Post by lister007 » Thu Sep 13, 2007 4:26 am

This is some great feedback cheers! I will have a go with all of your comments, but so you know the reason for this is to get away from the odd vids that I have in .avi H.264 which I am pretty sure I got from this site somewhere...I had been trying to do this my self in mkvmergeGUI for a little while so these comments point me in the right direction I think.
Spatchcock..........A dressed and split chicken for roasting or grilling on a spit.
Bring it
Image
Berserk or crazy...??? (image shack sucks will have a banner for this too when it doesn't!)

User avatar
Qyot27
Surreptitious fluffy bunny
Joined: Fri Aug 30, 2002 12:08 pm
Status: Creepin' between the bullfrogs
Location: St. Pete, FL
Contact:
Org Profile

Post by Qyot27 » Thu Sep 13, 2007 11:26 am

lister007 wrote:This is some great feedback cheers! I will have a go with all of your comments, but so you know the reason for this is to get away from the odd vids that I have in .avi H.264 which I am pretty sure I got from this site somewhere...I had been trying to do this my self in mkvmergeGUI for a little while so these comments point me in the right direction I think.
Yeah, I don't know if MKVMerge will automatically fix the streams now or if they lifted the restriction that it won't accept VFW H.264, but back when it didn't allow VFW H.264 to be muxed in (without overriding it in the Add command line options area), it came out and told you to dump the raw stream and process it with MP4Box, and even gave you the command line operation for it:

Code: Select all

mp4box -add "video.h264" -add "audio.aac" -fps 23.976 "location.mp4"
(where the fps value is whatever the actual fps is, and the audio would probably be an MP3 stream since AVI doesn't like AAC either)

Locked

Return to “Video & Audio Help”