PDA

View Full Version : mencodr/x264/DVD speed (noob q)


other
1st August 2008, 05:45
Ok, first post

I'm not sure if this is a mencoder or x.264 'problem'. I'm trying to use mencoder to transcode a DVD to x.264 and I'm having a speed issue.

I know there's a bunch of GUI tools out there that I could use to accomplish this, but I'm trying to do it myself as a learning experience.

My problem is that I can't seem to accomplish this any faster than 1x speeds (i.e. it takes at least as long to transcode as it does to play the video).

Is this a limitation of mencoder? That doesn't seem right as there are other 'programs' (GUI's for mencoder/ffmpeg) that can accomplish the same thing much quicker.

Here's an example of the command I'm using:

"C:mencoder.exe" dvd://1 -dvd-device D: -sws 9 -of lavf -lavfopts format=ipod -vf scale=480:-2,dsize=480:320:0,harddup -ovc x264 -x264encopts bitrate=896:vbv_bufsize=2000:nocabac:me=umh:subq=6:frameref=6:trellis=1:level_idc=30:global_header:threads=auto -oac faac -aid 128 -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o "C:\DVD Title #1.m4v"

The problem is that this command is obviously I/O limited (the CPU(s) are waiting on input) and takes as long to encode as the length of the selected title + 10-15%.

Is there anyway to speed this up? It seems like either the decryption algorithm or the drive speed is the limiting factor here.

It's not the drive itself, the granny gear has been removed from its BIOS and any number of programs can rip from it licity-split (to use an anachronism).

For example, the process in total is much faster if I rip with DVD Decrypter and then transcode with mencoder, but I'd like to get it done in one step.

I apologize if the x.264 forum isn't the best place for this question, and don't mind some ridicule, but please point me in the right direction.

Thanks, brett

Sagekilla
1st August 2008, 10:29
24 fps for 480x320 material does sound a bit slow. It could be entirely possible your system is bottlenecked from the fact that (it sounds like it..) you're decrypting the DVD in real time. Granted, DVD decryption is trivial these days and most DVD drives can read very fast, it's still in the realm of possibilities. I'll have to pull up a settings map for mencoder, I personally don't know what the mencoder settings map to in x264. With that said, it is also possible you're being held back by settings, but at such a low resolution I find that hard to believe since even I get near real time with slow settings.

One other thing, what CPU do you have?

other
1st August 2008, 17:14
I've got a core 2 Duo @ 2.13 GHz.

It doesn't seem (to me) to be a processing problem. During transcoding both cores are running at only ~30%. If I rip to a vob and then transcode it tachs both cores out at nearly 100%. This is part of what makes me think it's I/O limited.

Also, I've done direct from DVD transcoding using other programs and the same quality settings (same res, bitrate etc) and they appear to be CPU limited.

I've attached a conversion log that might be useful.

Thanks for the help.

Brett

other
1st August 2008, 23:21
Didn't realize file would have to be approved (I know, shoulda read the rules) So hear is the log:

Commandline: "C:\Program Files\VideoWizard\mencoder.exe" dvd://1 -dvd-device D: -sws 9 -of lavf -lavfopts format=ipod -vf scale=480:-2,dsize=480:320:0,harddup -ovc x264 -x264encopts bitrate=896:vbv_maxrate=896:vbv_bufsize=2000:nocabac:me=umh:subq=6:frameref=6:trellis=1:level_idc=30:global_header:threads=auto -oac faac -aid 128 -faacopts mpeg=4:object=2:br=160:raw -channels 2 -srate 48000 -o "C:\Documents and Settings\me\My Documents\My Videos\224\tool\schism\DVD Title #1.m4v"
MEncoder dev-SVN-r27211-3.4.5 (C) 2000-2008 MPlayer Team
CPU: Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz (Family: 6, Model: 15, Stepping: 6)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
There are 1 titles on this DVD.
There are 1 angles in this DVD title.
audio stream: 0 format: ac3 (stereo) language: unknown aid: 128.
number of audio channels on disk: 1.
subtitle ( sid ): 0 language: unknown
number of subtitles on disk: 1
success: format: 2 data: 0x0 - 0x1aecb800
MPEG-PS file format detected.
VIDEO: MPEG2 720x480 (aspect 2) 29.970 fps 9800.0 kbps (1225.0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x480 fps:29.970 ftime:=0.0334
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
AUDIO: 48000 Hz, 2 ch, s16le, 192.0 kbit/12.50% (ratio: 24000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Using SSE optimized IMDCT transform
Using MMX optimized resampler
** MUXER_LAVF *****************************************************************
REMEMBER: MEncoder's libavformat muxing is presently broken and can generate
INCORRECT files in the presence of B-frames. Moreover, due to bugs MPlayer
will play these INCORRECT files as if nothing were wrong!
*******************************************************************************
OK, exit.
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
Opening video filter: [harddup]
Opening video filter: [dsize=480:320:0]
Opening video filter: [scale w=480 h=-2]
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 480 (preferred colorspace: Mpeg PES)
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
==========================================================================
VDec: vo config request - 720 x 480 (preferred colorspace: Planar YV12)
VDec: using Planar I420 as output csp (no 1)
Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
SwScaler: reducing / aligning filtersize 10 -> 12
SwScaler: reducing / aligning filtersize 10 -> 12
SwScaler: reducing / aligning filtersize 9 -> 8
SwScaler: reducing / aligning filtersize 9 -> 8
[swscaler @ 0pbaebe4]Lanczos scaler, from yuv420p to yuv420p using MMX2
[swscaler @ 0pbaebe4]using n-tap MMX scaler for horizontal luminance scaling
[swscaler @ 0pbaebe4]using n-tap MMX scaler for horizontal chrominance scaling
[swscaler @ 0pbaebe4]using n-tap MMX scaler for vertical scaling (YV12 like)
[swscaler @ 0pbaebe4]720x480 -> 480x360
x264 [warning]: width or height not divisible by 16 (480x360), compression will suffer.
x264 [info]: using SAR=639/640
x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[mpeg2video @ 0pbc6520]ac-tex damaged at 0 8
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
New_Face failed. Maybe the font path is wrong.
Please supply the text font file (~/.mplayer/subfont.ttf).
subtitle font: load_sub_face failed.
VIDEO CODEC ID: 28
AUDIO CODEC ID: 15002, TAG: 0
Writing header...
[ipod @ 0pbb1c70]Warning, extension is not .m4a nor .m4v Quicktime/Ipod might not play the file
[ipod @ 0pbb1c70]Warning, extension is not .m4a nor .m4v Quicktime/Ipod might not play the file
Skipping frame!
[mpeg2video @ 0pbc6520]Warning MVs not available
[mpeg2video @ 0pbc6520]concealing 675 DC, 675 AC, 675 MV errors

Skipping frame!
[mpeg2video @ 0pbc6520]Warning MVs not available
[mpeg2video @ 0pbc6520]concealing 675 DC, 675 AC, 675 MV errors

Skipping frame!
Flushing video frames.
Writing index...

Video stream: 885.544 kbit/s (110692 B/s) size: 49795166 bytes 449.849 secs 26863 frames

Audio stream: 160.169 kbit/s (20021 B/s) size: 8941263 bytes 446.592 secs
x264 [info]: slice I:67 Avg QP:15.94 size: 15035
x264 [info]: slice P:13415 Avg QP:18.31 size: 3637
x264 [info]: mb I I16..4: 48.4% 0.0% 51.6%
x264 [info]: mb P I16..4: 4.3% 0.0% 4.2% P16..4: 50.7% 10.6% 2.8% 0.0% 0.0% skip:27.4%
x264 [info]: ref P 83.5% 6.6% 4.2% 2.1% 1.8% 1.9%
x264 [info]: kb/s:885.5
Finished conversion.
Conversion Time: 00:14:46

blizard
2nd August 2008, 03:29
Why do you an old version of MENcoder? (dev-SVN-r27211-3.4.5 is listed in your log)

http://oss.netfarm.it/mplayer-win32.php

(Last compiled MPlayer/MENcoder version from 07/18/2008 by Sherpya)

The last three digits in bold for identified build above will give you a hint that it was compiled with an older minGW32 compiler for windows (win32) as more recent build of minGW32 will be 4.2.X. Last version on 08/02/2008 are Sherpya-SVN-r27323-4.2.4 which can be found as RTM (should detect your CPUs feature without problem) or P4 optimized version among other.

In general I thought trellis was not needed when you down size as it can slow down transcoding for some material. Set trellis to notrellis or trellis=0. There might be possible better search pattern to use for Uneven MultiHexagon (UHM) and to adjust Partition Macroblocks for Motion Estamation according to what is optimal for low resolution display. It is also possible that you would gain some speed from cutting down FPS from 29.970 to a lower FPS that still will keep image flow without flickering. You might find better understanding on how to adjust those setting by reading MPlayer docs (go to -x264encopts) (http://www.mplayerhq.hu/DOCS/man/en/mplayer.1.html) I have used Hexagon search for ME and does work very well.



Software scaler resize (-sws 9) with Lanczos might also be a slower resizing, then other option available in MENcoder like bicubic (-sws 2 ;default setting for MENCoder according to Manual docs).

Dark Shikari
2nd August 2008, 04:12
In general I thought trellis was not needed when you down size as it can slow down transcoding for some material. Set trellis to notrellis or trellis=0.Slow down encoding, yes, but what does its effectiveness have to do with resolution?

other
2nd August 2008, 23:42
Thanks for the suggestions blizard. I haven't updated my version of mencoder yet mainly because a suggestion from someone on the mencoders user mailing list fixed my I/O limitation:

old:

"C:\Program Files\VideoWizard\mencoder.exe" dvd://1 -dvd-device D: -sws 9...

new:

"C:\Program Files\VideoWizard\mencoder.exe" dvd://1 -dvd-device D:\VIDEO_TS -sws 9...

I'm not sure how pointing to the exact location of the vob made such a huge difference but it definitely did.

I am now officially CPU limited. Unfortunately I'm limited to one core because mencoder doesn't seem to want to honor the x.264 threading option (threads=auto or threads=2).

Do you think that my aging compilation might have something to do with that or am I just implementing it incorrectly?

I chose lanczos based on a suggestion from someone else who had experience transcoding for ipod. Is mencoder's bicubic option going to make much of a difference in output quality?

Dark Shikari: Is the trellis option not worth the trade off between quality and speed? Ok, that's a pretty subjective question, I'll rephrase, would you use it in this situation?

Thanks for all the help, brett