VideoHelp Forum

Our website is made possible by displaying online advertisements to our visitors. Consider supporting us by disable your adblocker or Try ConvertXtoDVD and convert all your movies to DVD. Free trial ! :)
+ Reply to Thread
Results 1 to 6 of 6
Thread
  1. Member
    Join Date
    Nov 2009
    Location
    Belgium
    Search Comp PM
    Hello,

    I'm trying to rip my DVDs into mkv file using only free codec. To confirm the stereotype of the linux user, I want to do it in command line. I've found mencoder which seems to be exactly what I need.

    So I extract the video file :
    mplayer -dvd-device /dev/hda -dumpstream dvd://1 -dumpfile myfile.vob
    I've already extracted the two audio channel and subtitles I wanted and now I want to do the audio.

    As I read on the net x264 seems to be a nice codec. I've read the Mplayer's manuel and made this command line

    mencoder myfile.vob -o myfile.avi -ovc x264 -x264encopts subq=1:frameref=1:vpass=1 -nosound

    here is the output
    Code:
    $ mencoder myfile.vob -o myfile.avi -ovc x264 -x264encopts subq=1:frameref=1:vpass=1 -nosound MPlayer SVN-r29809 (C) 2000-2009 MPlayer Team
    Option x264encopts: Unknown suboption vpass
    success: format: 0  data: 0x0 - 0x6f113000
    MPEG-PS file format detected.
    VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  7000.0 kbps (875.0 kbyte/s)
    [V] filefmt:2  fourcc:0x10000002  size:720x576  fps:25.000  ftime:=0.0400
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
    ==========================================================================
    Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    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
    Unsupported PixelFormat -1
    Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
    ==========================================================================
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    FATAL: Cannot initialize video driver.
    
    Exiting...
    thank you
    Quote Quote  
  2. Member Soopafresh's Avatar
    Join Date
    Jan 2004
    Location
    United States
    Search Comp PM
    try mp4 instead of avi for the output
    "Quality is cool, but don't forget... Content is King!"
    Quote Quote  
  3. Member
    Join Date
    Nov 2009
    Location
    Belgium
    Search Comp PM
    thank you for your answer but it doesn't change anything

    I think I've found
    mencoder video.vob -o video.avi -ovc x264 -x264encopts subq=1:frameref=1:pass=1:threads=auto -nosound
    instead of
    mencoder video.vob -o video.avi -ovc x264 -x264encopts subq=1:frameref=1:vpass=1:threads=auto -nosound

    What's the difference ? With some commands I see that "pass" is used, "vpass" with others...

    About the extension : does it really matter what I write ?
    Because "-o video.avi" or "-o video.mp4" or even "-o video.abcd" seems to produce the same file


    edit : ok now let's do the second pass

    mencoder video.vob -o video.avi -ovc x264 -x264encopts subq=6:frameref=15ass=2:threads=auto -nosound

    doesn't work either

    Code:
    $ mencoder video.vob -o video.avi -ovc x264 -x264encopts subq=6:frameref=15:pass=2:threads=auto -nosound
    MPlayer SVN-r29809 (C) 2000-2009 MPlayer Team
    success: format: 0  data: 0x0 - 0x71426800
    MPEG-PS file format detected.
    VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  7000.0 kbps (875.0 kbyte/s)
    [V] filefmt:2  fourcc:0x10000002  size:720x576  fps:25.000  ftime:=0.0400
    Opening video filter: [expand osd=1]
    Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 0
    ==========================================================================
    Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
    Could not find matching colorspace - retrying with -vf scale...
    Opening video filter: [scale]
    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
    Unsupported PixelFormat -1
    Selected video codec: [ffmpeg2] vfm: ffmpeg (FFmpeg MPEG-2)
    ==========================================================================
    Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
    x264 [info]: using SAR=64/45
    x264 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
    x264 [error]: constant rate-factor is incompatible with 2pass.
    x264_encoder_open failed.
    FATAL: Cannot initialize video driver.
    
    Exiting...
    So there is this error "constant rate-factor is incompatible with 2pass" but I read that for a constant rate factor, I've to use the parameter "--crf"
    Quote Quote  
  4. Originally Posted by n2turtles
    So there is this error "constant rate-factor is incompatible with 2pass" but I read that for a constant rate factor, I've to use the parameter "--crf"
    But you probably didn't read too far on 2 pass encoding. My first question is what is your goal here? Are you trying to produce a file of a specified size, or are you wanting to produce a file of some predictable level of visual quality? I'm going to go ahead and guess that a predictable quality level is more important than size and if so, then 2-pass encoding is not what you're looking for, but I could be wrong about your goals, so...

    2-pass encoding is one of several methods of controlling the average bitrate of the output file to be a specific value, or fairly close to it. You would want to do this if you're trying to produce a file of a specific size. ie. I know that my video file is 2700 seconds (45 minutes) long. If I want to produce a file that's about 350MiB in size, I'll have about 1062 kiB per second to spend on encoding both the audio and video. If I'm encoding the audio using 128kiB/s MP3, then that would leave me with 934kiB/s for encoding the video. In practice, you'd probably fudge that value slightly down to allow for the overheads of the container format and the index if present. The advantages of this is that you get files of a somewhat predictable size. On the downside, it can be difficult to predict the visual quality level of the encoded video. Depending on the bitrate specified, you may end up with poor quality for high motion video, or wasted bandwidth for low motion video. Note also that 2-pass encoding is just one of several methods for trying to achieve a predictable average bitrate. Other methods are constant bitrate encoding and 1-pass average bitrate encoding. 2-pass ABR usually does a better job in terms of quality as it has statistics from the first pass which allow it to make better choices on where to spend it's bit budget.

    Constant rate factor encoding is a method of encoding the file with the goal of producing files with a predictable level of visual quality. It does this by managing the quantizer parameters for different frames in such a way as to produce a consistent quality level. The rate factor is a parameter that gives the encoder some idea of what level of quality is desired. A crf of 20 generally gives very high quality encodes. Higher numbers give reduced quality with 50 being the lowest quality possible. I'm currently working with a crf of 22 for near-DVD-quality video which seems to be working fairly well. A lower CRF will generally produce a larger file and a higher CRF will produce a smaller file, but it's impractical to the point of being virtually impossible to predict the final average bitrate or filesize with any degree of accuracy until the encode is completed. That said, I'm usually pleasantly surprised to find that it's much smaller than I probably would have selected myself and the video quality of H264 video at such low bitrates is still superb.

    As for what's going on with your command line, you've not specified a bit rate but you're trying to use a mode of operation where the whole point is to control the average bitrate to be close to some specified value. My guess is that in the absence of any bitrate being specified, the encoder defaults to CRF mode with some sane value for the constant rate factor. CRF is a single pass encoding mode, so specifying pass=2 makes no sense, hence the error message. You're going to have to either specify a bitrate to use 2 pass encoding or else stick with CRF and then you only need 1 pass.
    Quote Quote  
  5. Originally Posted by n2turtles
    About the extension : does it really matter what I write ?
    Because "-o video.avi" or "-o video.mp4" or even "-o video.abcd" seems to produce the same file
    The previous poster was talking about the container format, not a 4 character suffix on the end of the filename, which is all the extension is. To control the output format you use the -of switch. To produce an MP4 format file from mencoder, you'd use something like
    Code:
    -of lavf -lavfopts format=mp4
    along with possibly other libavformat options. If mkv is what you're after, then
    Code:
    -of lavf -lavfopts format=matroska
    should do it. You can stick whatever extension you want on the filename but that won't change the container format. By default, mencoder will output AVI format.

    That said, I wouldn't recommend it producing MKV or MP4 from mencoder. libavformat support in mencoder has been flakey at times and does not always produce files that will work in a wide variety of players. If you really want MP4 format files, I'd use ffmpeg, but that doesn't have some of the other features of mencoder, so it all depends. AVI may not be the most modern container format, but for a great many things it is more than sufficient.

    Is there any specific reason why you want MKV files? From your initial post, it sounds like you're just trying to rip your DVD collection onto some kind of media server/video jukebox in which case, almost any container format is probably sufficient. If mencoder is going to be your transcoder of choice and you have no other requirements for the files, I'd stick with AVI format.
    Quote Quote  
  6. Originally Posted by n2turtles
    What's the difference ? With some commands I see that "pass" is used, "vpass" with others...
    Different codecs are written by different people/groups and don't necessarily always use the same parameter names as other projects. Basically, they mean the same thing. Read the manual.
    Quote Quote  



Similar Threads