VideoHelp Forum
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    Ok where canI read about mencoder command line options.
    or what is the help for mencoder Like -h for ffmpeg but that does not work with mencoder.

    other the one I look for is if newest mencoder does have any like -autocrop
    also scale option Like

    -scale 720: x and that will scale it to 720 width and set the height to keep aspect Ratio.
    Last edited by PsyDonias; 7th Aug 2011 at 05:03.
    Quote Quote  
  2. Member
    Join Date: Feb 2004
    Location: Australia
    Search Comp PM
    Read this ... but don't go blind ... it's a lengthy doc ... and at the end is some examples of usage.
    Quote Quote  
  3. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    ok thanks
    Quote Quote  
  4. Member
    Join Date: Jan 2011
    Location: Adelaide, Australia
    Search PM
    Google 'mencoder syntax' & you'll find lots of pages with command line information. Mencoder commands are basically the same on Windows & Linux so don't ignore any pages dedicated to Mencoder on Linux.
    Quote Quote  
  5. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    Originally Posted by PsyDonias View Post
    other the one I look for is if newest mencoder does have any like -autocrop
    also scale option Like

    -scale 720 and that will scale it to 720 width and set the height to keep aspect Ratio.
    It would be helpful to know what you're trying to do in more detail - Source and destination formats, resolutions, aspect ratios, etc?

    mencoder can work out the height based on the aspect ratio (and the width you provide) by using the scale filter with the '-3' option. If you have a video clip that's 720x576, the following command would reduce the height in proportion to a new width that you specify - 360px for example:
    -vf scale=360:-3
    This would give a video resolution of 360x288

    You mention that you want to scale the width to 720px, which sounds like you're encoding to a standard DVD/DV/D1 resolution. This should either be 720x480 for 'NTSC' content, or 720x576 for 'PAL' european content.

    **Depending on the source video, using the '-3' option might give a height other than 480 or 576, which wouldn't work if you're trying to create a compliant DVD-Video.

    I don't think there's an easy way to autocrop with mencoder. There's a 'cropdetect' filter, but it can't be used in isolation and requires an external script to work.

    When I want to crop a video, I work out how many pixels need to be removed and manually use the 'crop' filter.

    If you can provide a still image of the video you want to crop and scale, or at least give info on it's resolution and amount to be cropped from each side + information about what format and resolution you want to convert the video to (youtube/DVD-Video/iPhone/media centre/etc) I could provide a command line example.
    Quote Quote  
  6. Member
    Join Date: Jan 2011
    Location: poland
    Search Comp PM
    JUst to tell a little bit more on CROP option:
    it is possible with mplayer to display a nice rectangle on the screen (while watching video) and adjust it on the fly with key shortcuts but to make a final crop you have to change to mencoder.

    These are responsible for rectangle (make sure it is inside input.conf file and write your own shortcuts in places of *. Numbers 16, -16, 2, -2 tell mplayer how many pixels each line/rectangle should be moved):
    * change_rectangle 0 16 # move right line right
    * change_rectangle 0 -16 # move right line left
    * change_rectangle 1 16 # move bottom line down
    * change_rectangle 1 -16 # move bottom line up
    * change_rectangle 2 -2 # move whole rectangle left
    * change_rectangle 2 2 # move whole rectangle right
    * change_rectangle 3 -2 # move whole rectangle up
    * change_rectangle 3 2 # move whole rectangle down

    To actualy display that rectangle mplayer must be run with -vf rectangle=x:y (where x/y are initial dimension). Once you are happy with the result you swich to mencoder and run it with -vf crop=x:y
    Quote Quote  
  7. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    Originally Posted by intracube View Post
    Originally Posted by PsyDonias View Post
    other the one I look for is if newest mencoder does have any like -autocrop
    also scale option Like

    -scale 720 and that will scale it to 720 width and set the height to keep aspect Ratio.
    It would be helpful to know what you're trying to do in more detail - Source and destination formats, resolutions, aspect ratios, etc?

    mencoder can work out the height based on the aspect ratio (and the width you provide) by using the scale filter with the '-3' option. If you have a video clip that's 720x576, the following command would reduce the height in proportion to a new width that you specify - 360px for example:
    -vf scale=360:-3
    This would give a video resolution of 360x288

    You mention that you want to scale the width to 720px, which sounds like you're encoding to a standard DVD/DV/D1 resolution. This should either be 720x480 for 'NTSC' content, or 720x576 for 'PAL' european content.

    **Depending on the source video, using the '-3' option might give a height other than 480 or 576, which wouldn't work if you're trying to create a compliant DVD-Video.

    I don't think there's an easy way to autocrop with mencoder. There's a 'cropdetect' filter, but it can't be used in isolation and requires an external script to work.

    When I want to crop a video, I work out how many pixels need to be removed and manually use the 'crop' filter.

    If you can provide a still image of the video you want to crop and scale, or at least give info on it's resolution and amount to be cropped from each side + information about what format and resolution you want to convert the video to (youtube/DVD-Video/iPhone/media centre/etc) I could provide a command line example.
    ok sorry for the lack of information.


    exemple:
    I have an matroska that is 720p
    1280x720 and I want to scale it to 480p.
    So I want to only set the width 720 and the height should mencoder do automatic.
    then I maybe have an 720p matroska that is 1280x588 or twhat many of them are.
    Then I still want to only set the width 720p and mencoder should resize the height for me manually.
    only thing I need to do is change the input file and output file.

    then for crop like handbrake does automatic crop it if needed is there any function in mencoder that can automatic detect the crop
    and crop it if I want to rip an DVD to xvid that the DVD is 720x576. but when rip it to xvid without black border it should be 720x400.
    and next DVD maybe the xvid out put should be 720x300 or what the resolution could be in the wide format.
    and still I only want to change the input file and output file and mencoder should detect the crop automatic.
    Like handbrake do.
    Quote Quote  
  8. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    I'm still not understanding what you're trying to do. Do you want to convert your HD videos so they can be burned to a DVD and played on a standard DVD player? Or do you just want to create smaller versions of your videos to be played on your computer or mobile device - iPhone, etc?

    Converting to a DVD-Video compliant stream would be complicated with the examples you've given. 1280x720 matroska files could be scaled directly to 720x480, but 1280x588 files would need to be padded as well as scaled to 720x480 to maintain a proper aspect ratio.

    Also, you might also have to do a framerate conversion. The matroska files could be 59.94, 50, 24 or 23.976fps, but 'NTSC' DVD-Video only supports two framerates - 29.97 and 23.976, (PAL DVDs only allow 25fps).

    I don't think one set of command line options could cope with the different file formats you've mentioned. You'd have to create two sets of command line options; with one set of video filters for 1280x720 files, and another set for 1280x588 files.

    You haven't said what OS you're using, nor put the details in your profile. I'm familiar with mencoder for Linux, but the command line layout for Windows is slightly different.

    Also, you haven't said what video/audio codecs you want to encode to.

    if I want to rip an DVD to xvid that the DVD is 720x576. but when rip it to xvid without black border it should be 720x400.
    and next DVD maybe the xvid out put should be 720x300 or what the resolution could be in the wide format.
    Why can't you use Handbrake? I know it can't rip to xvid, but wouldn't .mkv or .mp4 files be ok?
    Quote Quote  
  9. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    I want to reencode some DVD and MKV to xvid to be used on a DVD that only can play xvid and not matroska.
    And if possible do it the easy way and only change the input file and output file.

    but for the matroska files to be reencoded the
    -vf scale=720:-3 option should be working right. croping I maybe look into that and see what the scale and croping is being. One way is to open the file in handbrake and take the crop settings from that but with easy way should be if mencoder also has an autodetect crop command line way.

    video codec xvid.
    audio codec AC3 but audio codec is the easy way with mencoder.
    its on Windows and I can do one .cmd file for DVD and one for MKV.
    Yes I could do one for different resolution for MKV but it would be much easier to only use one for DVD and one for MKV.
    Last edited by PsyDonias; 7th Aug 2011 at 05:01.
    Quote Quote  
  10. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    Originally Posted by PsyDonias View Post
    I want to reencode some DVD and MKV to xvid to be used on a DVD that only can play xvid and not matroska.
    And if possible do it the easy way and only change the input file and output file.
    You could try an older version of Handbrake which supports Xvid output. This link suggests that versions prior to 0.9.4 could encode to AVI/Xvid:
    http://forums.makezine.com/comments.php?DiscussionID=6042

    Version 0.9.3 can be downloaded here:
    http://www.videohelp.com/tools/HandBrake/old-versions#download

    but for the matroska files to be reencoded the
    -vf scale=720:-3 option should be working right.
    Actually, I've done some experiments and I think '-2' is the right option:
    -vf scale=720:-2

    But try the older version of Handbrake before mencoder.
    Quote Quote  
  11. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    yea I have handbrake 0.9.3 already and it is great but the GUI is not good at all compare to the new 0.9.5.
    it can auto detect crop but the size is doing manually and it canīt keep aspect ratio automatic.
    Quote Quote  
  12. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    I don't use Windows, and haven't encoded to Xvid before, but using this thread as a starting point I've adapted a set of Linux mencoder command line options to (hopefully) run on Windows. With the Windows command prompt, go to the directory where your .mkv files are, and run this:

    "C:\Program Files\mplayer\mencoder.exe" "input.mkv" -ovc xvid -oac mp3lame -xvidencopts fixed_quant=4:me_quality=6:qpel:vhq=3:max_bframes= 0:vbv_maxrate=4854000:threads=2 -lameopts vbr=0:br=192 -vf scale=720:-2 -o "output.avi"

    - you might need to change the path to mencoder.exe depending on your setup
    - to increase the quality/bitrate, lower the fixed_quant value to 2 or 1 - or increase fixed_quant to reduce bitrate/quality
    - if you've got a quad core system, you can change 'threads' value to 4, if you've only got a single core system remove the 'threads' option
    Quote Quote  
  13. Member
    Join Date: Jul 2010
    Location: Sweden
    Search PM
    ok thanks.
    The Crop detect how can I use it and can it output to a text file.
    Just to find out the crop options I should use and put it in manually.

    is it just mencoder.exe -vf cropdetect and should I specify an place like seconds in the movie where to find the crop.
    Quote Quote  
  14. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    Originally Posted by PsyDonias View Post
    The Crop detect how can I use it and can it output to a text file.
    Just to find out the crop options I should use and put it in manually.

    is it just mencoder.exe -vf cropdetect and should I specify an place like seconds in the movie where to find the crop.
    Use mplayer.exe instead of mencoder.exe to preview your video. Something like:
    "C:\Program Files\mplayer\mplayer.exe" "input.mkv" -vf cropdetect=:2
    * the ':2' option means give a crop factor that's a multiple of 2. The default is 16, which is unecessarily inprecise for this.

    You should get a window displaying the movie. With the mouse cursor over the playback window, use the left and right keyboard arrows to skip to a part of the video that clearly shows the black borders on all sides. Here's an example from a DVD:
    Click image for larger version

Name:	mplayer_cropdetect_02.jpg
Views:	138
Size:	184.1 KB
ID:	8077

    The crop amount should be shown in the terminal window. Something like:
    [CROP] Crop area: X: 8..713 Y: 70..503 (-vf crop=704:432:10:72).

    Stop the playback of the video, then copy the last bit into your mencoder parameters (before the scale filter):

    "C:\Program Files\mplayer\mencoder.exe" "input.mkv" -ovc xvid -oac mp3lame -xvidencopts fixed_quant=4:me_quality=6:qpel:vhq=3:max_bframes= 0:vbv_maxrate=4854000:threads=2 -lameopts vbr=0:br=192 -vf crop=704:432:10:72,scale=720:-2 -o "output.avi"

    Personally, I wouldn't bother cropping the video. You're not going to reduce the filesize much, and it's an extra step to go through - but the choice is yours.

    Also, if you're converting standard definition video (like DVDs) that have a resolution of 720px wide, but the visible picture is slightly narrower - 704px wide (see the example image), cropping the width from 720 to 704, then scaling 704 back to 720px wide will soften the image. It'd be better to avoid that step.
    Last edited by intracube; 8th Aug 2011 at 15:26.
    Quote Quote  
  15. Member
    Join Date: Oct 2010
    Location: England
    Search Comp PM
    You might also want to search through the list of conversion tools to see if there's a GUI program that can automate the process better than mencoder:
    http://www.videohelp.com/tools

    Or start a new thread asking for suggestions on suitable mkv to xvid/avi converters with an autocrop/scaling feature built in.
    Quote Quote  
  16. Member
    Join Date: Apr 2013
    Location: London, UK
    Search Comp PM
    Hello All,

    I'm seeking some help please to find the correct command line syntax to complete a task with Mencoder.

    I have a number of WMV files which I would like to send to Mencoder for cropping and, if possible, removal of the audio track. I can accomplish both of these manually with the Format Factory front end but there are a lot of files to deal with so a command line option that I can automate would be a big help.

    I've written a little utility that will find the files and send them to encoder in turn but, despite reading this forum, and some pages linked here, I've not been able to figure out the actual syntax I need. What I have in mind is something like: -

    Emencoder path InputFile Path -crop(top,Left,Right,Bottom) OutputFile Path

    Is this doable and, if so, is anyone able to help with this please?

    Thanks for reading.
    Quote Quote  
  17. if you crop you need to reencode, so you also need reencoding settings,...
    other than reading one of the many howTo for mencoder out there and reading the manual, this:
    Code:
    mencoder -ovc x264 -noskip -vf scale,format=i420,crop=640:480:20:20,scale,format=i420 -forcedsubsonly -nosub -nosound -mc 0 -lavdopts threads=8 -of mp4 -o "test.mp4" "Path to input file"
    might help a bit.
    Quote Quote  
  18. Member
    Join Date: Apr 2013
    Location: London, UK
    Search Comp PM
    Thank you very much Selur, I really appreciate your help.

    The sample command line in your post has moved me a step forward but not yet got me to an answer.

    On my set up, Mencoder reports a parsing error on -of mp4 but, if I remove this switch, a transcoding of sorts is produced. I say "of sorts" because the output is jerky, skips many frames and is completely unusable. The obvious suspicion is that my ancient system can't cope but in fact it produces excellent results when using Mencoder via Format Factory.

    If only Format Factory included command line options maybe I could get a handle on those but I confess I'm finding the Mencoder how to guides a struggle.
    Quote Quote  
  19. reports a parsing error on -of mp4 but
    Sorry, my bad, use '-of lavf -lavfopts format=mp4' instead of '-of mp4'

    The obvious suspicion is that my ancient system can't cope but in fact it produces excellent results when using Mencoder via Format Factory.
    Doesn't Format Factory show which command lines it uses in some sort of log file?
    Quote Quote  
  20. Member
    Join Date: Apr 2013
    Location: London, UK
    Search Comp PM
    Thank you again Selur.

    I'm finding that replacing -of mp4, with -of lavf -lavfopts format=mp4, makes things worse on my system. It still produces an output but now it seems the file duration is zero seconds and although the player (WMP) fires up, the timeline shows 100% and nothing is displayed. I did play around with the command line and was able to produce a working version that included the format=mp4 switch parameter but this produced the same jerky, unusable output as before.

    Interesting news about Format Factory potentially allowing command line options. I had previously searched online for these and have now also looked in the application's directory on my hard drive but found nothing. Nor is there anything in the application (V2.90) that gives any clues about this.
    Quote Quote  
  21. does mencoder output any warnings/errors, etc. ?
    Quote Quote  
  22. Member
    Join Date: Apr 2013
    Location: London, UK
    Search Comp PM
    Originally Posted by Selur View Post
    does mencoder output any warnings/errors, etc. ?
    Not really although there is the following message which I hadn't mentioned because it felt like a general heads up rather than anything related specifically to this operation: -

    **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!
    ************************************************** *****************************
    Quote Quote  
  23. remuxing the file with mp4box normally should help if it's a muxing problem.
    Quote Quote  



Similar Threads