+ Reply to Thread
Page 1 of 3 1 2 3 LastLast
Results 1 to 20 of 51

Linux script for mencoder.

This is a discussion on Linux script for mencoder. within the Video and Imaging forums, part of the miniPlayer M6 / SL category; Ok i got something going. I'm using Ubuntu Egdy. Install mencoder if you haven't already. Debian/Ubuntu: Code: sudo apt-get install ...

  1. #1
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Linux script for mencoder.

    Ok i got something going.

    I'm using Ubuntu Egdy.

    Install mencoder if you haven't already.

    Debian/Ubuntu:

    Code:
    sudo apt-get install mencoder
    In the command line type: I use nano as a text editor. Change it to your favorite editor:
    Code:
    sudo nano /usr/bin/meizu-convert
    This will open a text editor and create the file meizu-convert in /usr/bin.

    Put the following code in the text editor. Make sure you change mencoder path so that it points to it. And also set the output path.:
    Code:
    #!/bin/bash
    #This script uses mencoder to convert movies to a playable AVI format for the MEIZU M6
     
    mencoder=/usr/bin/mencoder
    outputpath=/media/DataStorage/meizuvid/
     
    if [ $3 -a $1 == cropbar ]
    then
        #Crop black bars on widescreen video.
        $mencoder $2 -idx -noodml -ofps 18 -vf scale=427:240,expand=:240:::1,crop=320:240,rotate=1 -ovc lavc -ffourcc XVID -lavcopts vcodec=mpeg4:vbitrate=256:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$3
     
    else 
        echo Unknown variable $1
        #Default conversion settings
        $mencoder $1 -idx -noodml -ofps 18 -vf scale=320:-2,expand=:240:::1,crop=320:240,rotate=1 -ovc lavc -ffourcc XVID -lavcopts vcodec=mpeg4:vbitrate=256:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$2
     
    fi
     
    exit 0
    Save your document and exit. Now we must allow the script to execute.
    In the command line type:
    Code:
    sudo chmod +x /usr/bin/meizu-convert
    Now to convert a movie type in the command line:
    Code:
    meizu-convert [SOURCE FILE] [DESTINATION FILE]
    If the video is widescreen you can crop the black bars by typing:
    Code:
    meizu-convert cropbar [SOURCE FILE] [DESTINATION FILE]
    I'm adding more options as i see fit for my needs.
    Last edited by shookie; 04-04-2007 at 02:36 AM. Reason: Stable.

  2. #2
    Valued Member
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    503
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For RM video -> AVI i find that 15fps works best, as it has minimal glitches.

    $mencoder -noodml $1 -o $outputpath[M6-MID]$2 -mc 0 -ofps 15.000 -vf-add crop=480:320:-1:-1 -vf-add scale=320:213 -vf-add expand=320:240:-1:-1:1 -srate 44100 -ovc lavc -lavcopts vcodec=mpeg4 -lavcopts vbitrate=256 -ffourcc DIVX -oac mp3lame -lameopts vbr=0 -lameopts br=128 -lameopts vol=0 -lameopts mode=0 -lameopts aq=7 -lameopts padding=3 -af volnorm
    Current Rigs:
    8GB iAudio 7 > Not in use
    4GB + 32GB iAudio D2 > Alessandro MS-Pro
    Sony MZ-NH1 > Headroom Total Bithead > Grado Labs PS-1
    2GB Meizu M6 T1 > Not in use
    8GB iPod Touch 2G > Shure SE530

  3. #3
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Blackstar View Post
    For RM video -> AVI i find that 15fps works best, as it has minimal glitches.

    $mencoder -noodml $1 -o $outputpath[M6-MID]$2 -mc 0 -ofps 15.000 -vf-add crop=480:320:-1:-1 -vf-add scale=320:213 -vf-add expand=320:240:-1:-1:1 -srate 44100 -ovc lavc -lavcopts vcodec=mpeg4 -lavcopts vbitrate=256 -ffourcc DIVX -oac mp3lame -lameopts vbr=0 -lameopts br=128 -lameopts vol=0 -lameopts mode=0 -lameopts aq=7 -lameopts padding=3 -af volnorm


    What do you mean by RM.. Real Media? I normally push at 18... I notice frame loss using 20.. I'll have to look at 15... although i would assume you lose more frames.

    I'll have to test that out myself and see if ill add it to the script.. ill post an update.

  4. #4
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I have changed the video bitrate and have gotten better quality images. Can anyone confirm this?

    Was at 384 now im at 256.
    Last edited by shookie; 03-20-2007 at 10:43 AM.

  5. #5
    Valued Member
    Join Date
    Nov 2006
    Location
    Australia
    Posts
    503
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, a higher video bitrate will increase the quality of your video. However.. either Meizu's processor or OS seems incapable of playing video smoothly at higher bitrates (or anything above 18fps).

    It will play 20fps encoded movies, but i'm sure many of you will agree with me that they are too glitchy.

    Ubuntu is a great OS... I unfortunately use Gentoo... so much maintenance required. =( =(
    Current Rigs:
    8GB iAudio 7 > Not in use
    4GB + 32GB iAudio D2 > Alessandro MS-Pro
    Sony MZ-NH1 > Headroom Total Bithead > Grado Labs PS-1
    2GB Meizu M6 T1 > Not in use
    8GB iPod Touch 2G > Shure SE530

  6. #6
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I still get sync issues.... I'm going to have to try and use wine and see if a windows app could help with the sync issues

    To all you linux users doing successful conversions for SP Meizu M6 4GB... hook me up with some parameters.

  7. #7
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The following is some new code i put together that should be for more advance users. It will allow you to specify simple settings like FPS and Audio/Video bitrates.

    Code:
    #!/bin/bash
    #This script uses mencoder to convert movies to a playable AVI format for the MEIZU M6
     
    # Path to the mencoder executable
    mencoder=/usr/bin/mencoder
     
    # Path for the output file
    outputpath=/media/DataStorage/meizuvid/
     
     
    echo "->        The following are prompts user-specific input."
    echo "->        Meizu M6 supports up to 20 FPS so this should be the max"
    echo "->        Video Bitrate and Audio Bitrate shouldn't be to high since"
    echo "  it will cause problems rendering video/audio."
    echo "->        My current working videos are set to 20 FPS/256 Video Bitrate/96 Audio Bitrate"
    echo
    echo
     
    echo -n "Specify frames per second [20 max]: "
    read fps
     
    echo -n "Specify video bitrate: "
    read vbr
     
    echo -n "Specify audio bitrate: "
    read abr
     
            $mencoder $1 -idx -noodml -ofps $fps \
            -vf scale=320:-2,expand=:240:::1,crop=320:240,rotate=1 \
            -ovc lavc -ffourcc XVID -lavcopts vcodec=mpeg4:vbitrate=$vbr:vmax_b_frames=0:vhq \
            -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=$abr -af resample=44100 -srate 44100 -o $outputpath[M6]$2
     
    exit 0
    This particular script will encode with black bars to maintain aspect ratio of wide screen. To make it crop the black bars find and replace the following:

    Code:
    Find:
    -vf scale=320:-2,expand=:240:::1,crop=320:240,rotate=1
     
    Replace with:
    -vf scale=427:240,expand=:240:::1,crop=320:240,rotate=1
    This file I had renamed to m6-conv and made it executable using chmod +x. This is the output:

    Code:
    shookie@shookie-core:~$ m6-conv 
    ->      The following are prompts user-specific input.
    ->      Meizu M6 supports up to 20 FPS so this should be the max
    ->      Video Bitrate and Audio Bitrate shouldn't be to high since
            it will cause problems rendering video/audio.
    ->      My current working videos are set to 20 FPS/256 Video Bitrate/96 Audio Bitrate
     
     
    Specify frames per second [20 max]:
    My working recommendations are not 100%. Still get some sync issues there fore im still trying to find the perfect setup for mencoder parameters.
    Last edited by shookie; 04-04-2007 at 02:40 AM.

  8. #8
    Passing By
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for taking the time to post this, I was about to start messing with avidemux when I spotted this script. Much easier and good success so far.

    regards

  9. #9
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm happy you found it useful. Let me know how this works for you with lengthy video's...

    There is another script in the forum that chops your video at 20 minutes to avoid a/v sync issues. I haven't had much problem with the results of my script, but i'd keep a copy of some of the other scripts on the forum just in case. When i find it I will post a link.


    Quote Originally Posted by subbass View Post
    Thanks for taking the time to post this, I was about to start messing with avidemux when I spotted this script. Much easier and good success so far.

    regards

  10. #10
    Freshman
    Join Date
    Apr 2007
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by shookie View Post
    I still get sync issues.... I'm going to have to try and use wine and see if a windows app could help with the sync issues

    To all you linux users doing successful conversions for SP Meizu M6 4GB... hook me up with some parameters.
    Forget the wine idea. I'm using the original converter from the meizu homepage with wine and the vids are anything but synchronous. I'll try the script above, maybe that helps.

  11. #11
    Passing By
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by shookie View Post
    I'm happy you found it useful. Let me know how this works for you with lengthy video's...

    There is another script in the forum that chops your video at 20 minutes to avoid a/v sync issues. I haven't had much problem with the results of my script, but i'd keep a copy of some of the other scripts on the forum just in case. When i find it I will post a link.

    Sure I will try a couple longer ones, so far I have only done a few porn clips, they were pretty short and handy to do a few tests with. Did half a dozen or so and each worked just fine, but I haven't paid real attention to the sync on them.

    Thanlks for the tip on the script to chop at 20mins, no doubt I'll be using that on a couple movies, aybe even the TV eps if neccessary.

    For the script I have used used 15fps, 300kbps and 128/64 to convert with, does that seem like good figures or have you had better results with others which I should play with.

  12. #12
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by subbass View Post
    Sure I will try a couple longer ones, so far I have only done a few porn clips, they were pretty short and handy to do a few tests with. Did half a dozen or so and each worked just fine, but I haven't paid real attention to the sync on them.

    Thanlks for the tip on the script to chop at 20mins, no doubt I'll be using that on a couple movies, aybe even the TV eps if neccessary.

    For the script I have used used 15fps, 300kbps and 128/64 to convert with, does that seem like good figures or have you had better results with others which I should play with.
    This is... is that it totally depends on what you are converting. i normally use 20FPS and play around with vbitrate.. audio i keep at 96.... Do you notice missing frames at 15 FPS ?

  13. #13
    Passing By
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by shookie View Post
    This is... is that it totally depends on what you are converting. i normally use 20FPS and play around with vbitrate.. audio i keep at 96.... Do you notice missing frames at 15 FPS ?
    I haven't noticed it yet, I only received the M6 yesterday so haven't really played a lot. I opted to go for 15fps as from what I had read was that the 20fps was the maximum and had potential from comments that it would skip and cause sync probs, all I am aiming for is a general "good enough" conversion that is going to work for the majority of files just fine.

    Just converted a full 90min (or so movie) and watched a few minutes, seems fine so far, it only weighed in at 29mb though (should have cropped large black bands) Its amazing though the resolution of the screen still allows me to read the actor credits and such on the start with ease, this may even replace my PocketPC for a mobile movie viewer at this rate

    Ok, recoded to have no border and just watched the movie and it must be dropping frames still, at 1h15mins video was about 1second in advance of the audio
    Last edited by subbass; 04-04-2007 at 07:02 PM. Reason: Updated comment.

  14. #14
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I need to check the precision of the windows convertors if there is better quality involved. in linux im converting at 70 FPS in windows its much slower.. so id prefer to do my conversions in linux.... we'll see.

  15. #15
    Passing By
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Had a problem converting the Lemony Snickit movie a couple days ago, various FPS and Bitrates but it wouldn't play, not until I used the script to chop it into 20min chunks. Still playing with it, seems nothing wants to get rid of the sync issues with longer files.

    Kinda bites as I had a 1Gb Genus Vizo player which would play any divx/xvid I threw at it, in fact I didn't even used to convert, just dumped 700mb movies to it and watched them, the screen on the Meizu is larger with a higher res which is much nicer to watch on.

  16. #16
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    agreed. I bought this because of the video capabilities.

    I hope that this can be fixed with future firmware releases. Until then i will continue learning more about mencoder and perhaps open horizons on other video encoding software that runs on linux..

    If you know of any, preferrably command line, please let me know.

  17. #17
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Found new settings
    FPS: 18-20
    A: 96
    V: 480

    Let me know how it works.

  18. #18
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Well 20 FPS give me slight issue with av sync, however the quality of the image is amazing. Played a 1hr 20min video after every 10 minutes i noticed incremental sync/lag issues... perhaps.

    Next video will be at 15/300/96

  19. #19
    Member
    Join Date
    Mar 2007
    Posts
    108
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Near perfect using the following:

    A: 128
    V: 394
    FPS: 20

    But the video must be short ... like 30 minutes. good for TV shows... otherwise you need to chop it up. (I learned this using parena's script)

  20. #20
    Passing By
    Join Date
    Apr 2007
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Back again, upgraded to Feisty and the kids were ill, anyways I will give those last settings a whirl over the weekend


 

Similar Threads

  1. Mencoder Video Converter Info
    By FirePower in forum Video and Imaging
    Replies: 46
    Last Post: 01-06-2009, 02:06 PM
  2. Bash script for conversion under Linux
    By parena in forum Video and Imaging
    Replies: 9
    Last Post: 11-06-2008, 08:42 PM
  3. My Theme Linux Redhat
    By leoriohunter in forum Modifications and Skins
    Replies: 2
    Last Post: 02-04-2007, 01:26 PM
  4. Avidemux / Linux
    By scaglifr in forum Video and Imaging
    Replies: 1
    Last Post: 02-01-2007, 02:30 PM
  5. Ubuntu Linux Theme
    By Austin in forum Modifications and Skins
    Replies: 2
    Last Post: 12-31-2006, 06:01 AM