mencoder h264
#1
Hello,

I tried ripping a DVD track using x264, and it plays fine with normal mplayer and VLC on my Windows machine, and fine in mplayer on my linux box. But, when I play it in XBMC, it's all "squished". If I code it with xvid with the same parameters, the resolution is fine in XBMC. Here's the command line I'm using (with mencoder 1.0rc1-3.4.2). Any ideas? I know that other people must be using h.264, so hopefully it's just something with my settings.

mencoder dvd://1 -o "filename.avi" -ovc x264 -oac lavc -lavcopts acodec=mp3:abitrate=160 -x264encopts bitrate=1200 -vf scale=624:352 -endpos 15

The -endpos 15 was just to grab the first 15 seconds for testing.

Thanks!
Dave
Reply
#2
I frequently rip DVD to .mkv for backup purposes. Heres how I do it (I have no problems with viewing the end result in XBMC):

1) Download Handbrake (CLI Version). The command line version works well in linux. Handbrake Download

2) Use this shell script.

3) Download and save this file. Then edit the shell script from the previous step to point to this file. This file contains encoder settings which will produce nice results. The line you want to edit is:

Code:
MATRIX=${MATRIX:=./eqm_avc_hr.cfg}

4) Consult original author's page for more information. http://avi.alkalay.net/2008/03/mpeg4-dvd-rip.html
NOW: AppleTV+CrystalHD PREVIOUS: HTPC and XBOX (both loudly running XBMC)
Reply
#3
The following is my script for encoding H.264

http://pastebin.com/f643f99c8

It seems to work fine for me in XBMC. There are a number of reasons why it may not be working for you. First, the aspect information in the avi may be set differently when encoding between xvid and avi. XBMC may not be taking this into account. This is just a guess though.

You want to avoid the AVI container when encoding H.264. It was never meant for this codec, and can cause all kinds of problems. My script uses mencoder to encode the audio and video, but then is muxed using MP4box or mkvmerge (depending on the container you want to use). It is a few more steps, but it works.

Also, why are you scaling? Your scaling parameters are pretty close to DVD resolution, so scaling would only save you a small amount of space, and just make the quality worse. For best results, don't scale, just crop out the letterboxing. I don't know if this is causing problems with your encodes, but it won't hurt to get rid of the scaling.

There are a number of other options in my script that you may want to research in the MPlayer documentation.


Let me know how it works for you if you use it. I am always making changes and tweaks.

-Brandon
Reply
#4
Thanks! - I'll try out that script later today.

You're right that H.264 is not commonly used in an AVI container, but it is supported. And given that VLC and the regular mplayer can play it, it sounds like it just might be an xbmc bug. It might have to do with the scaling though 'cause all the data looks like it's there, but it might have just not scaled the X axis, and only scaled the Y, which is why it looks squished on my TV.

To answer your question as to why I scaled it at all. Well, I originally ripped it as is (480p), but things looked squished when I played it in xbmc, so I ripped it again at the resolution of a bunch of other videos I have, which are encoded with xvid at 624x352. Still squished though Smile Of course, when I rip it using xvid, everything looks fine.

Cheers!
Dave
Reply
#5
@drewjacks0n

I tried that script, but XBMC freezes when I try to play it using mplayer (over my network).

Are you storing these files on your xbox drive, or do you stream them?

I can't seem to get it to work... suggestions? common stumbling blocks?

Thanks,
Tim
Reply

Logout Mark Read Team Forum Stats Members Help
mencoder h2640