Fansite and Forum for Meizu Products
 
       



Go Back   Meizu Me > General > Video and Imaging

Linux script for mencoder.

Video and Imaging

Reply
 
Thread Tools Display Modes
Old 03-19-2007   #1 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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.
shookie is offline   Reply With Quote
Old 03-19-2007   #2 (permalink)
Valued Member Blackstar will become famous soon enough
 
Blackstar's Avatar
 
Join Date: Nov 2006
Location: Australia
Posts: 457
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
Blackstar is offline   Reply With Quote
Old 03-19-2007   #3 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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.
shookie is offline   Reply With Quote
Old 03-20-2007   #4 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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 09:43 AM.
shookie is offline   Reply With Quote
Old 03-20-2007   #5 (permalink)
Valued Member Blackstar will become famous soon enough
 
Blackstar's Avatar
 
Join Date: Nov 2006
Location: Australia
Posts: 457
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
Blackstar is offline   Reply With Quote
Old 03-20-2007   #6 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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.
shookie is offline   Reply With Quote
Old 03-22-2007   #7 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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.
shookie is offline   Reply With Quote
Old 04-03-2007   #8 (permalink)
Passing By subbass is on a distinguished road
 
Join Date: Apr 2007
Posts: 9
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
subbass is offline   Reply With Quote
Old 04-04-2007   #9 (permalink)
Member shookie is on a distinguished road
 
Join Date: Mar 2007
Posts: 108
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
shookie is offline   Reply With Quote
Old 04-04-2007   #10 (permalink)
Freshman Francesco is on a distinguished road
 
Join Date: Apr 2007
Posts: 35
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.
Francesco is offline   Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script for conversion under Linux parena Video and Imaging 7 03-23-2008 11:16 PM
Mencoder Video Converter Info FirePower Video and Imaging 44 03-21-2008 02:22 PM
My Theme Linux Redhat leoriohunter Modifications and Skins 2 02-04-2007 12:26 PM
Avidemux / Linux scaglifr Video and Imaging 1 02-01-2007 01:30 PM
Ubuntu Linux Theme Austin Modifications and Skins 2 12-31-2006 05:01 AM

All times are GMT. The time now is 10:32 AM.


Powered by vBulletin. Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0 ©2007, Crawlability, Inc.
 
Meizu Me is an independent resource for all things Meizu. Meizu, Mini Player, Music Card, Mini One and all other related names are properties of MEIZU Electronic Technology, Inc. Designed by ForumTemplates. All content © 2007 MeizuMe. All Rights Reserved.