You are not logged in.

#1 2008-10-02 18:11:59

cschep
Member
Registered: 2006-12-02
Posts: 124
Website

h.264 to xvid?

Hello everyone.

I'm a bit of a media noob. I recently downloaded some TV episodes of a show that are in the .mkv container, compressed with h.264 for the video and AAC for the audio.

That's cool, they play fine with VLC and look great. The problem is that I still use an original xbox with xbmc to watch things on my TV. Apparently the h.264 compression is a bit much for that machine. The videos will play, but really slow. I don't hear much for the audio either, but it might because of the slowdown.

My question: is there a simple way to convert these over to xvid? I don't care about filesize going up, and I don't really care about loss in quality. The .mkv container should be fine, as long it can contain xvid? I dunno.

I started to research it on my own, and I got a lot of people talking about windows programs, and a lot of stuff I don't know a ton about.

Is this process even worth doing? Or should I just find a better source?

Thanks!

Offline

#2 2008-10-02 18:31:12

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: h.264 to xvid?

It should be easy enough with mencoder. Search with google, read the man for specific flags.

Offline

#3 2008-10-02 19:33:19

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: h.264 to xvid?

You could give xvidenc a try, it's in the AUR. You start it with xvidenc -2p -p uhq (-2p = 2-pass mode, uhq = ultra high quality - you can change these options of course, but I would use them, still pretty fast when encoding). Pretty nice cli app! Can handle DVDs and movie files

Offline

#4 2008-10-02 20:00:30

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: h.264 to xvid?

Here's a simple two-parter... just run the 1st command and once it finishes run the second.  Of course, change the filenames, bitrates, width, etc. as needed:

mencoder originalfile.mkv -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts bitrate=1000:pass=1 -vf pp=de,scale=480:-2 -o "/dev/null"

mencoder originalfile.mkv -oac mp3lame -lameopts abr:br=128 -ovc xvid -xvidencopts bitrate=1000:pass=2 -vf pp=de,scale=480:-2 -o "newfile.avi"

thayer williams ~ cinderwick.ca

Offline

#5 2008-10-02 23:03:44

cschep
Member
Registered: 2006-12-02
Posts: 124
Website

Re: h.264 to xvid?

Hey cool, thanks for the response.

I'm giving mencoder a go right now, I'll let you know how it goes.

Thayer, if you don't mind a newb question, why does there have to be 2 runs with the first going to /dev/null?

Offline

#6 2008-10-02 23:34:50

rsambuca
Member
From: Calgary, Canada
Registered: 2008-07-21
Posts: 143

Re: h.264 to xvid?

You can transcode in one pass, but the 2 pass method yields exponentially better quality video.

Offline

#7 2008-10-03 00:37:57

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: h.264 to xvid?

cschep,

The first pass is to analyze the data of the input file. That data is stored in a file to use for the second pass. This is done to increase the compression ratio. Basically, with some codecs and/or encoders this can produce a better quality to file size ratio. And, it also makes the final file size fairly predictable.

The reason why people use /dev/null as the output of the first pass is because they're not interested in having the encoder produce a video/audio file yet; they just want the data analysis for the second pass. Some software will even allow you to make a third pass. I've heard that it's nothing more than a waste of time.

Offline

#8 2008-10-03 09:09:26

ChoK
Member
From: France
Registered: 2008-10-01
Posts: 346

Re: h.264 to xvid?

To encode/transcode my videos I use Avidemux
It's a GUI that use mplayer to decode the video and mencoder to reencode it.

If you know windows' virtualDub, it's the same type of video editor. The interface is well made, you can't be lost


Ah, good taste! What a dreadful thing! Taste is the enemy of creativeness.
Picasso
Perfection is reached, not when there is no longer anything to add, but when there is no longer anything to take away.
Saint Exupéry

Offline

#9 2008-10-03 17:34:04

cschep
Member
Registered: 2006-12-02
Posts: 124
Website

Re: h.264 to xvid?

Thanks guys. I guess I was curious because I didn't see how the 2nd pass could use any data from the 1st pass if there was no output file. It must store something somewhere right? Or am I just confused about how video encoding works?

Also, this totally works and plays cleanly on my xbmc now. Woo hoo!

Offline

#10 2008-10-03 18:02:26

azleifel
Member
Registered: 2007-10-28
Posts: 486

Re: h.264 to xvid?

cschep wrote:

Thanks guys. I guess I was curious because I didn't see how the 2nd pass could use any data from the 1st pass if there was no output file. It must store something somewhere right? Or am I just confused about how video encoding works?

Look for a file called divx2pass.log in the directory from which you invoked mencoder.

Offline

#11 2008-10-03 18:02:40

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: h.264 to xvid?

cschep wrote:

Thanks guys. I guess I was curious because I didn't see how the 2nd pass could use any data from the 1st pass if there was no output file. It must store something somewhere right? Or am I just confused about how video encoding works?

It outputs it's finding to a log file in the current directory which will be used for the second pass. This is the same data that would have been used to do the compression for single pass. The second pass works better because the encoder now knows more about where the most detail is so it can use less compression there, and where the least detail is so it can use more. This technique works best for encoders that don't do the highest quality encoding the first time through. This includes xvid and most mpeg2 encoders. Some encoders like x264 when set up properly won't really gain much if any help from multiple passes.

I should have mentioned this before. For higher quality output when lowering the bit rate, it's best to use the same codecs as before. Conversions from lossy formats to other lossy formats (m4a-->mp3) reduces quality by huge amounts. Reducing the bit rate in the same format is far less destructive.

I also forgot to mention that the greatest place in the Universe to get answers about all of this stuff is:

http://forum.doom9.org/

Last edited by skottish (2008-10-03 18:08:31)

Offline

Board footer

Powered by FluxBB