mencoder : I need some help.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • chronos14
    Junior Member
    Junior Member
    • Jan 2006
    • 5

    mencoder : I need some help.

    I've got a mpeg2 video extracted from a DVD, and I would like to encode it in mpeg4 (x264).
    I use those two commands and it works.

    mencoder test.m2v -ovc x264 -x264encopts bitrate=750ass=1:subq=5:4x4mv:frameref=5:bframes=3:b_pyramid: weight_b -o test.avi

    mencoder test.m2v -ovc x264 -x264encopts bitrate=750ass=2:subq=5:qblur=50:4x4mv:frameref=5:bframes=3:b _pyramid:weight_b -o test.avi


    And you will ask: So where is the problem ?

    This video is from a TV serie and there are very ugly black bands all around the video:




    So I tried to crop the video, and I succeeded in viewing the video correctly (without the black bands) by using yhis command:
    mplayer test.m2v -vf crop=694:560:15:10,cropdetect=24:2

    Then I tried to encode it with the following command:
    mencoder test.m2v -ovc x264 -x264encopts bitrate=750ass=1:subq=5:4x4mv:frameref=5:bframes=3:b_pyramid: weight_b -vf crop=694:560:15:10,cropdetect=24:2 -o test.avi

    And yhis one doesn't work. Could somebody help me?

    Thanks in advance for your answers.
    <o></o>
  • drfsupercenter
    NOT an online superstore
    • Oct 2005
    • 4424

    #2
    Hmmm, celtic_druid is the expert on mencoder. I know the basics, but not all those commands.
    CYA Later:

    d̃ŗf̉śŭp̣ễr̀çëǹt̉ếř
    Visit my website!!

    Cool Characters Make your text cool
    My DVD Collection

    Comment

    • anonymez
      Super Moderator
      • Mar 2004
      • 5525

      #3
      i don't use mencoder (IMO megui is best for x264), but you could use an avisynth script to do the cropping(and/or resizing) for you
      Last edited by anonymez; 23 Jan 2006, 11:36 AM.
      "What were the things in Gremlins called?" - Karl Pilkington

      Comment

      • celtic_druid
        Digital Video Expert
        Digital Video Expert
        • Dec 2005
        • 514

        #4
        For best results, keep it (final resolution) mod16. Your res isn't even mod2 is it? x264 requires YV12 so mod4 for horizontal and mod2 for vertical at least.

        For mencoder you might want to set raw output to or use x264 cli (as part of MeGUI or standalone) and output directly to mp4/mkv.

        Comment

        • chronos14
          Junior Member
          Junior Member
          • Jan 2006
          • 5

          #5
          Thank you for your answer celtic_druid, I will try to resolve my problem with your indications.

          But I must confess that I don't fully understand your answer (Sorry but I'm some kind of newbie in video encoding).
          For example how can you fix a different mod for the width and the height (the cropdetect option accepts only one mod parameter)? Or maybe I should fix a mod4 for the width and the height ?
          Next I don't want to output in a mp4 or mkv container because I work separately on the video, the sound and the subtitles. I will use a muxing tool later to assemble those ones in a mp4 container.

          Finally I would like to ask you if you could post the corrected mencoder command line plz ?
          Last edited by chronos14; 23 Jan 2006, 11:55 PM.

          Comment

          • celtic_druid
            Digital Video Expert
            Digital Video Expert
            • Dec 2005
            • 514

            #6
            How are you going to mux the avi output to mp4? No tools as far as I know accept avi input, so that means demuxing to raw. Having mencoder output to raw would save you that step.

            What values did cropdetect give you? Although with 2 specified it would give you a mod2 resolution, which as I said is only good for the vertical.

            Comment

            • chronos14
              Junior Member
              Junior Member
              • Jan 2006
              • 5

              #7
              Having mencoder output to raw would save you that step.
              True, thanks for the tip, I will follow your advice. I will add the -of rawvideo option

              What values did cropdetect give you?
              I didn't know that cropdetect returns something. (to find the correct crop informations I used MeWIG but then the encoding didn't work and that's why I decided to learn how the mencoder command line works. I also forgot to read " prints the recommended parameters to stdout." in the documentation)
              I now understand why there is a "limit" parameter

              Although with 2 specified it would give you a mod2 resolution, which as I said is only good for the vertical.
              So do I need to specify 4 ? And if I do such a thing, will I have a mod4 resolution that will be ok for both the vertical and the horizontal ?
              Last edited by chronos14; 24 Jan 2006, 05:10 AM.

              Comment

              • celtic_druid
                Digital Video Expert
                Digital Video Expert
                • Dec 2005
                • 514

                #8
                Mod4 is ok for horizontal and fine for vertical. Like I said for optimal results you should stick with mod16 (default for crop detect) if possible though.

                Comment

                • chronos14
                  Junior Member
                  Junior Member
                  • Jan 2006
                  • 5

                  #9
                  What values did cropdetect give you?
                  the result (with a mod4 parameter) is many rows like this one:

                  crop area: X: 9..712 Y: 2..575 (-vf crop=700:572:12:4)

                  So I tried:

                  mencoder test.m2v -ovc x264 -x264encopts bitrate=750 -vf crop=700:572:12:4



                  And here the result

                  MEncoder 1.0pre7-3.4.2 (C) 2000-2005 MPlayer Team
                  CPU: Intel Pentium 4/Xeon/Celeron Foster (Family: 8, Stepping: 7)
                  Detected cache-line size is 64 bytes
                  CPUflags: Type: 8 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 0
                  Compiled with runtime CPU detection - WARNING - this is not optimal!
                  To get best performance, recompile MPlayer with --disable-runtime-cpudetection.
                  File not found: 'frameno.avi'
                  Failed to open frameno.avi
                  success: format: 0 data: 0x0 - 0x11e3800
                  MPEG-PS file format detected.

                  Too many video packets in the buffer: (4096 in 8277028 bytes).
                  Maybe you are playing a non-interleaved stream/file or the codec failed?
                  For AVI files, try to force non-interleaved mode with the -ni option.
                  MPEG: No audio stream found -> no sound.
                  VIDEO: MPEG2 720x576 (aspect 2) 25.000 fps 7500.0 kbps (937.5 kbyte/s)
                  [V] filefmt:2 fourcc:0x10000002 size:720x576 fps:25.00 ftime:=0.0400
                  Opening video filter: [expand osd=1]
                  Expand: -1 x -1, -1 ; -1 (-1=autodetect) osd: 1
                  Opening video filter: [crop w=700 h=572 x=12 y=4]
                  Crop: 700 x 572, 12 ; 4
                  ================================================== ========================
                  Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
                  VDec: vo config request - 720 x 576 (preferred csp: Mpeg PES)
                  Could not find matching colorspace - retrying with -vf scale...
                  Opening video filter: [scale]
                  The selected video_out device is incompatible with this codec.
                  VDecoder init failed
                  Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
                  Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG-1 or 2 (libmpeg2))
                  ================================================== ========================
                  Writing AVI header...
                  ODML: Aspect information not (yet?) available or unspecified, not writing vprp h
                  eader.
                  VDec: vo config request - 720 x 576 (preferred csp: Planar YV12)
                  Could not find matching colorspace - retrying with -vf scale...
                  Opening video filter: [scale]
                  VDec: using Planar YV12 as output csp (no 0)
                  Movie-Aspect is 1.33:1 - prescaling to correct movie aspect.
                  SwScaler: using unscaled Planar YV12 -> Planar YV12 special converter
                  x264 [error]: width % 16 != 0 or height % 16 != 0 (700x572)
                  x264_encoder_open failed.
                  FATAL: Cannot initialize video driver.



                  And one last question:
                  Is the -of rawvideo the correct parameter to have a correct rawvideo output ?

                  Comment

                  • celtic_druid
                    Digital Video Expert
                    Digital Video Expert
                    • Dec 2005
                    • 514

                    #10
                    Looks like x264 wants mod16. mod16 used to be required, it was changed ages ago though.

                    I'd suggest a newer mencoder compile. I'd also go with a P4 one rather than cpu runtime detection.

                    Comment

                    • chronos14
                      Junior Member
                      Junior Member
                      • Jan 2006
                      • 5

                      #11
                      Ok thanks I will try to use a newer version.

                      Comment

                      Working...