How to switch containers without transcoding?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
outpostomega5
Posts: 77
Joined: Sat Oct 30, 2010 8:48 pm

How to switch containers without transcoding?

Post by outpostomega5 » Tue Nov 02, 2010 3:22 am

Hi.

Question: Does anybody know of a decent piece of software, or other newbie friendly means, that can be used to take the h.264 video stream and AAC audio stream out of a .avi container and dump them into a .mp4 container with out having to re-transcode so as to avoid additional "analog" degradation, so to speak? My portable device detests .avi apparently, and even if it doesn't and I'm just missing a checkbox or the like, I would still like to know how to switch containers.

Thanks.

thompson
Bright Spark User
Posts: 356
Joined: Sat Dec 12, 2009 8:04 pm

Re: How to switch containers without transcoding?

Post by thompson » Tue Nov 02, 2010 3:23 am

What OS?

match
Regular User
Posts: 111
Joined: Sun Mar 14, 2010 5:08 pm

Re: How to switch containers without transcoding?

Post by match » Tue Nov 02, 2010 4:31 pm

I'm pretty sure mkvmerge (part of mkvtoolnix), which is pretty easy to use, can do that. Despite it's title "MKV", I'm pretty sure it also works with avi and mp4 files. Just open the file with the mkvmerge gui, select which video/audio streams you want to keep, then rename output extension to .mp4, taking out the .mkv default extension. Or if you want to merge/dump it into a separate file which contains one of the streams you want to keep, you can open both files in mkvmerge...open up one of them, then click on "add" and add the other file. Choose (checkboxes) which streams you want to keep, and rename output extension to .mp4 instead of .mkv.

If that doesn't work, take a look here for some other muxers/demuxers: http://www.videohelp.com/tools/sections ... ltiplexers
I would try the programs: AVImux GUI and/or YAMB first.

User avatar
Rodeo
HandBrake Team
Posts: 12199
Joined: Tue Mar 03, 2009 8:55 pm

Re: How to switch containers without transcoding?

Post by Rodeo » Tue Nov 02, 2010 5:04 pm

Mkvtoolnix can import streams from AVI and MP4 files, but cannot output anything other than MKV. Changing the extension will have no effect.

creamyhorror
Regular User
Posts: 134
Joined: Mon Jan 04, 2010 2:00 pm

Re: How to switch containers without transcoding?

Post by creamyhorror » Tue Nov 02, 2010 5:33 pm

match wrote:then rename output extension to .mp4, taking out the .mkv default extension.
Don't do this, you're mislabelling an MKV file. If the player isn't capable of reading MKV files, it simply won't play the file no matter what you do.
I would try the programs: AVImux GUI and/or YAMB first.
YAMB is the right choice. It's an MP4 muxer.

match
Regular User
Posts: 111
Joined: Sun Mar 14, 2010 5:08 pm

Re: How to switch containers without transcoding?

Post by match » Wed Nov 03, 2010 1:13 am

Rodeo wrote:Mkvtoolnix can import streams from AVI and MP4 files, but cannot output anything other than MKV. Changing the extension will have no effect.
Thanks for clearing that up. I wasn't sure if it would work, but thought it was worth a shot. I initially thought the same thing (this is an mkv tool after all) . When I previously googled doing this with mkvMerge before (for different purpose), some said it works, others said no. It seems, the naysayers were right. I trust Rodeo's knowledge. When I tried it myself, mkvmerge gave me this log:

Code: Select all

'C:\moviename.avi': Using the AVI demultiplexer. Opening file. This may take some time depending on the file's size.
C:\moviename.avi' track 0: Using the MPEG-4 part 2 video output module.
'C:\moviename.avi' track 1: Using the AC3 output module.
The file 'C:\moviename.mp4' has been opened for writing.
Media gave this info on the output file:
General
Format: Matroska
Video
Format: MPEG-4 Visual
Codec ID: XVID

It seemed to work according to the log...But I think I was wrong to assume that when it said "using the mpeg-4 part 2 video output module", mpeg-4 meant .mp4.

Because when I tried just a regular ol' mkv file it (basically) said the same thing:

Code: Select all

'C:\moviename.mkv': Using the Matroska demultiplexer.
'C:\moviename.mkv' track 1: Using the MPEG-4 part 10 (AVC) video output module.
'C:\moviename.mkv' track 2: Using the AC3 output module.
The file 'C:\NewlyMuxedMoviename.mkv' has been opened for writing.
And mediainfo gave this info:
General
Format: Matroska
Video
Format: AVC
Codec ID: V_MPEG4/ISO/AVC

As you see, mediainfo says Format (Under General info) = Matroska.

I know one is xvid and one is x264 which makes some of this different. So what does this MPEG-4 part 2 and part 10 mean?...and what does MPEG-4 Visual mean?...and do any of them have anything to do with .mp4 files. If not, just seems confusing.

Just trying to decipher and straighten all of this out. Thanks guys.

outpostomega5
Posts: 77
Joined: Sat Oct 30, 2010 8:48 pm

Re: How to switch containers without transcoding?

Post by outpostomega5 » Wed Nov 03, 2010 3:12 am

Thanks for the help so far. Have not got around to taking a look at YAMB yet, to many things to do. Any other recommendations, keeping in mind I don't want to touch the actual A/V streams, just switch the container?

@ match: I'm very new to the whole video manipulation scene (pun intended) so I strongly recommend verifying everything I say. Also, if I am getting way to simple into things you already know, I apologize, but I would have strongly appreciated a water down version like this myself when I first started.

"MPEG-4 Part 10" is the name for the technical documents that define the standards for h.264 CoDec.

"h.264" is the actual video CoDec that the video stream, not the audio, is compressed through, and decompressed through at time of play back (CoDec = "Co"mpression/"De"compression).

"x264" is the name of the specific piece of software that does the encoding/decoding via the h.264 CoDec.

".mp4, .mkv, and .avi" are some of the more common container files. I think the .mp4 container is the one that is "officially" supported by MPEG-4 Part 10 (note the use of the technical documents, not the actual CoDec).

Picture a container file as a box you put both a video stream and one or more audio streams into. When your computer or other device goes to the file, it asks the container file for the video stream and a specific audio stream. The container file then looks at it's contents, and slowly distributes the two streams in timed sequence, providing a pleasant half hour or more of eye and ear bliss. Okay, so I'm getting a little carried away.

"MPEG-4 Part 2" is the technical documents referring to an earlier video CoDec, the CoDec that is used by a generic "mp4" video. Open up Handbrake, switch to the video tab, open the "Video CoDec" drop down menu. You should see too options: "H.264 (x264)" and "MPEG-4 (FFmpeg)". I believe the "MPEG-4 (FFmpeg)" option uses the CoDec associated with MPEG-4 Part 2. Please be advised that "verifying everything I say" part I wrote above should be applied by an order of magnitude stronger for this particular section on MPEG-4 Part 2.

"Xvid" is an older codec, again verify an order of magnitude more, that is more or less obsolete. I also believe there was a video service spelled "XVID" (notice the capitalization) provided by the now out of business store Circuit City. I may have the two spellings reversed. I do not know what the recommended container file

"vidX" is a freeware or OGL licensed CoDec made in direct response to Xvid.

Just some knowledge offered for general benefit on the chance you did not already know, h.264 is a "lossy" CoDec, meaning each time you run a compression on the video stream, you louse a few more bits of quality, creating analog degradation for lack of a better term. Think "A photograph of a photograph of a photograph of a photograph of a photograph of a photograph of a photograph of what ever the picture was taken of in the first place." In the most recent photograph, the picture has probably become so distorted, your not sure what it is anymore. The same concept of "lossy" and "lossless" can be applied to audio CoDecs as well.

@ General Community: I would appriciate it if anybody could verify my explanations for my own benefit as well as match'es benefit. Especially the part about containers to CoDecs. What IS the "official" container to the h.264 CoDec?

I re-posting this from the top of this post because by the time you finally get through all my explanations of terminology, you probably forgot the top of this post :P
Thanks for the help so far. Have not got around to taking a look at YAMB yet, to many things to do. Any other recommendations, keeping in mind I don't want to touch the actual A/V streams, just switch the container?

User avatar
Rodeo
HandBrake Team
Posts: 12199
Joined: Tue Mar 03, 2009 8:55 pm

Re: How to switch containers without transcoding?

Post by Rodeo » Wed Nov 03, 2010 9:25 am

match wrote:

Code: Select all

'C:\moviename.avi': Using the AVI demultiplexer. Opening file. This may take some time depending on the file's size.
C:\moviename.avi' track 0: Using the MPEG-4 part 2 video output module.
'C:\moviename.avi' track 1: Using the AC3 output module.
The file 'C:\moviename.mp4' has been opened for writing.
Media gave this info on the output file:
General
Format: Matroska
Video
Format: MPEG-4 Visual
Codec ID: XVID

It seemed to work according to the log...But I think I was wrong to assume that when it said "using the mpeg-4 part 2 video output module", mpeg-4 meant .mp4.
Format: Matroska is the container. MPEG-4 Part 2 is the video stream (the MPEG-4 container is defined in MPEG-4 Part 14).
match wrote:Because when I tried just a regular ol' mkv file it (basically) said the same thing:

Code: Select all

'C:\moviename.mkv': Using the Matroska demultiplexer.
'C:\moviename.mkv' track 1: Using the MPEG-4 part 10 (AVC) video output module.
'C:\moviename.mkv' track 2: Using the AC3 output module.
The file 'C:\NewlyMuxedMoviename.mkv' has been opened for writing.
And mediainfo gave this info:
General
Format: Matroska
Video
Format: AVC
Codec ID: V_MPEG4/ISO/AVC

As you see, mediainfo says Format (Under General info) = Matroska.

I know one is xvid and one is x264 which makes some of this different. So what does this MPEG-4 part 2 and part 10 mean?...and what does MPEG-4 Visual mean?...and do any of them have anything to do with .mp4 files. If not, just seems confusing.
MPEG-4 Part 2 = MPEG-4 Visual. XviD is an MPEG-4 Part 2 encoder, like x264 is and MPEG-4 Part 10 (H.264/AVC) encoder.

Post Reply