PDA

View Full Version : Slow/jerky playback of mencoder ripped dvd's


pounce
03-05-2009, 03:59 PM
I have several .avi files generated from my dvd's which I ripped using mencoder, I'm having trouble w/ slow & jerky playback on the sagetv unit (this use being the reason I bought the SageTV set). I successfully performed a firmware update upon receiving the unit.

Files are stored on my Sun based NAS, served via SMB. No trouble getting the folder mounted & files indexed. No sign of bandwidth issues over the network.

Info on one of the avi files is typical;

MPEG4-Video 3:2 480p@24fps AC3/448 kbps@48khz 5.1

When I encoded the dvd image to .avi, I chose parameters that yielded usefully sized .avi files, without obviously diminishing the quality of the playback as viewed by mplayer. Mplayer only uses a few megabits, and works comfortably on a 1ghz cpu.

But when the avi files are played via SageTV, I get occasional video frames (something like one every 10 secs or so) with a repeating sample of the audio which accompanied the frame. Quality of the rendered frames seems fine. Behavior is independent of the SageTV video resolution, and I have the media resolution option enabled.

The following are the mencoder parms I've been using;

-ovc lavc -fps 29.97 -ofps 23.976 -lavcopts vcodec=mpeg4:vhq:vbitrate=15000

The actual bitrate predicted by mencoder usually hovers around a few megabits. I generally suspect my mencoder options are creating .avi's that cause a lot of extra work for the SageTV box, causing the jerky playback. If so, or if I've made some other mistake, I'd really appreciate a hint or two.

I don't mind re-encoding them some other way, or transcoding the avi's, but I'd like to get some direction first.

Thanks,

Greg

S_M_E
03-05-2009, 06:16 PM
You could run a problematic AVI through mkvmerge and see if it plays better...

pounce
03-05-2009, 06:45 PM
I did some experimenting, looks like the HD Theater box just doesn't have enough cpu for the mpeg4 encoding I used. I transcoded a couple of the avi's down to mpeg1 and they're playing OK. Have to experiment a bit to get the audio sync straightened out, then do a batch job of transcoding everything.

The theater box doesn't have much in the way of cpu and ram but it looks like it will handle dvd class A/V without much trouble. Very handy that you can telnet in to see what its doing.

Greg

evilpenguin
03-05-2009, 07:04 PM
That vbitrate is *way* to high and could be the source of your issues. Try knocking it down to 5000 and see if the problem goes away.

Edit: In fact, you've got a lot of issues going on with that encode, I highly recommend trying out Handbrake (http://handbrake.fr/) rather than mencoder.

pounce
03-05-2009, 07:21 PM
The 15000 acted as an upper limit for the datarate as estimated by mencoder- most of the content never reached that high.

Could you be more specific about the issues?

There are definitely oddities w/ the in/out framerates. Mostly I experimented until mencoder stopped complaining about dup frames and I was happy with the playback quality. Transcoded down to mpeg1/2, video is passable- the biggest problem is preserving audio sync. Will have a look at handbrake though, thanks.

fwiw; using mpeg1/2, bitrates up to 4000kbit the SageTv is doing OK- issue seems to be related to mpeg4. Maybe the unit has hardware acceleration for mpeg1/2...

Greg

Taddeusz
03-06-2009, 08:45 AM
I would suggest not using an AVI container. An AVI container is no longer sufficient for MPEG4 video, particularly H.264, because it doesn't support the advanced features of the video codec.

I personally have never used mencoder but it looks like you're using xvid/divx MPEG4 video. That bitrate you're using seems a bit insanely high. I use Handbrake and end up with H.264 DVD rips that are about 500-1000kbit. It depends on the quality you want but, IMHO, anything above 2000kbit seems a bit insane. What are the resulting file sizes you're getting for movies?

pounce
03-06-2009, 05:03 PM
As above, the 15000 doesn't mean the avi's actually use that much- it acts as a limit for the mencoder xvid codec- so the max bitrate that could be generated is 15000kbits. I have one file that uses 9000 kbits. Most of the content ends up between 2000 to 5000 kbits/sec, files are generally below 4gigs, sometimes below 2.

avi has been fine for me so far- don't really care about H.264. avi doesn't seem to constrain the mencoder xvid codec, though there are clearly some efficiency issues. Depending on how my experiments with transcoding down to what the SageTV box can handle, I may change file formats.

The selection of mpeg1/2 parms for the transcoding has a big effect on how well the SageTV unit plays the file, there is a considerable parameter space to explore. I play the media via PC on occasion, I really want to avoid a "Sage" version and a "PC" version.

Greg

Taddeusz
03-06-2009, 05:45 PM
As above, the 15000 doesn't mean the avi's actually use that much- it acts as a limit for the mencoder xvid codec- so the max bitrate that could be generated is 15000kbits. I have one file that uses 9000 kbits. Most of the content ends up between 2000 to 5000 kbits/sec, files are generally below 4gigs, sometimes below 2.

What is the point of transcoding the files if you're going to end up making them that large? That's almost the size of a regular DVD. Is there a reason you've chosen to have them that large rather than just keeping the original video?

pounce
03-06-2009, 07:17 PM
Shrug- its handy to have a simple avi file containing the media. mpeg4 & vhq was conveniently simple way to do it straight from the disc, removing all ads/previews/menus. I don't presume to say its the best way, but it is the way I did it. The few vob files and streams I messed with tended to be 5+ gigs, so I generally felt that a more or less 50% reduction in size with little or no loss in quality was pretty reasonable. From experiments thus far, the mpeg1/2 transcoding for SageTV entails a material reduction in quality, yet costs about the same in disk space- lots more trials yet to do however.

Please note I'm not trying to preserve the mpeg4 vhq in avi method, just find a way to transcode the content down to a form that can be played by something other than mplayer- SageTV in this case. I take it the issues with the encoding method I used are the codec, bitrate and file format?

Greg

evilpenguin
03-06-2009, 07:55 PM
Just download handbrake, pick xvid for video encoder, copy audio for audio, and avi for the container, and 2000 for the bitrate. Problem solved.

pounce
03-06-2009, 08:23 PM
Not really- it'll make the movies playable, sure, but its not going to provide much control over the transcoding parms. I can transcode easily now- the question is one of minimizing degradation.

Greg

Taddeusz
03-06-2009, 08:38 PM
Not really- it'll make the movies playable, sure, but its not going to provide much control over the transcoding parms. I can transcode easily now- the question is one of minimizing degradation.

Greg

Using x264 in Handbrake allows far better control over quality.

evilpenguin
03-06-2009, 08:54 PM
Whatever, I tried to help :rolleyes:

pounce
03-06-2009, 09:03 PM
Actually you did help ep- you just gave me the idea to transcode just for a lower bitrate, keeping the mpeg4 format. It might end up being helpful to make the degradation a straightforward function of decreased bitrate.

I did spend a bit of time of the handbrake website, but didn't run into exhaustive docs- Taddeusz, could you suggest where the transcoding parms are located so I can compare it to what mencoder offers?. I'm not trying to avoid handbrake, but I'm not going to drop everything and start up with it until I understand how features compare- meaning codec & processing options, I don't care about gui features.



Thanks,

Greg

Taddeusz
03-07-2009, 07:00 AM
I did spend a bit of time of the handbrake website, but didn't run into exhaustive docs- Taddeusz, could you suggest where the transcoding parms are located so I can compare it to what mencoder offers?. I'm not trying to avoid handbrake, but I'm not going to drop everything and start up with it until I understand how features compare- meaning codec & processing options, I don't care about gui features.

Here are the advanced settings I use in Handbrake for x264. They work fine for EVR acceleration:

ref=4:mixed-refs=1:bframes=16:direct=auto:b-pyramid=1:me=umh:merange=16:analyse=all:8x8dct=1:no-fast-pskip=1:no-dct-decimate=1:weightb=1

Here is a link that explains x264 options in detail. X264 Settings - MeWiki (http://mewiki.project357.com/wiki/X264_Settings)

I personally run Handbrake in one pass mode using a constant quality of 52%. It represents a CRF value of 24.5. Constant Quality mode is more powerful than entering in a specific bitrate as it can adjust the bitrate to match the quality level you have chosen. What I would suggest is to pick a couple chapters from a DVD and play with the settings till you get something that is acceptable to you.

pounce
03-07-2009, 09:06 AM
Thanks- I'm working with x264 now, using profiles to select the advanced parms. Given the warnings that handbrake prints regarding my extant avi's, it looks as if mencoder was causing a good deal of the trouble. I guess I never noticed it much since I was only ever playing the content via mplayer.

Thanks,

Greg

pounce
03-11-2009, 05:04 PM
Handbrake x264 is working pretty well transcoding the movies, quality and file size is under reasonable control. The issue now is color balance. When I play the original files w/ mplayer, color is fine but there are color issues in the transcoded files when played by the SageTV unit.

Generally, in higher light conditions of the content the colors seem reasonably balanced but in lower light or contrast conditions, the red/green/blues are accentuated- even washed out.

I've tried both of the color-matrix settings in Handbrake, doesn't seem to make any difference. Presumably this is due to some kind of artifact of how I encoded the content. I don't mind "pre-transcoding" the content w/ mencoder to do something with the colorspace before running thru Handbrake- but I'm searching around for hints.

I did a bunch of googling on the topic and found quite a few mentions of using the mencoder scale filter which suggests it can translate color info- I tried a few examples which didn't materially affect the issue.

Many thanks for any hints,

Greg