05-30-2007
|
#21
|
|
Passing By
Join Date: May 2007
Posts: 5
|
Linux script for mencoder
I have modified your script to sequentially process all the VOB files from a ripped DVD.
I use dvdshrink to rip DVDs generating 1GB VOB files (20 to 30 mins each).
Since these files are on an external drive (slow) and I don't want to mess them up, I copy them to a video folder in my home directory.
the script is run by entering meizu-convert or meizu-convert cropbar at the command line.
I am using your original parameters with the addition of vol=10 to boost the volume. No problems with audio sync or FF/RW.
The script will prompt for a suffix name to use in the output files.(e.g. dejavu)
Code:
#!/bin/bash
#This script uses mencoder to convert movies to a playable AVI format for the MEIZU M6
mencoder=/usr/bin/mencoder
#Change this output path to your preference
outputpath=/home/art/meizuvid/
#Copy ripped VOB files to video folder
#and make sure there are none in trash folder (use ls -a to check)
#Files should be in the format VTS_01_x.VOB (note uppercase)
#Change the following to correspond to your video folder
cd /home/art/video
echo "Name used for file suffix "
read name
if [ $1 == cropbar ]
then
for i in $(ls *.VOB)
do
newname=$name"-"${i:7:1}".avi"
#Crop black bars on widescreen video.
$mencoder $i -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 vol=10 -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$newname;
done
exit 0
else
echo Unknown variable $1
for i in $(ls *.VOB)
do
newname=$name"-"${i:7:1}".avi"
#Default conversion settings
$mencoder $i -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 vol=10 -lameopts cbr:mode=2:br=96 -af resample=44100 -srate 44100 -o $outputpath[M6]$newname;
done
fi
exit 0
Last edited by zfoot; 05-30-2007 at 04:07 AM.
|
|
|
05-31-2007
|
#22
|
|
Member
Join Date: Mar 2007
Posts: 108
|
Thanks for the contribution!!!
|
|
|
06-01-2007
|
#23
|
|
Passing By
Join Date: May 2007
Posts: 5
|
I forgot to mention that I create sub-folders under the video folder and put the converted files in it. I have the video settings, consecutive turned on.
to play the movie, navigate to the first file in the sub-folder and press enter.
Meizu will play all the files in the sub-folder and then return to the sub-folder menu. There is only about 1/2 second blip between files and hardly noticeable.
EXAMPLE:
VIDEO
|
Casino Royale
|
+-casino-1.avi
|
+-casino-2.avi
|
+---etc.
Last edited by zfoot; 06-01-2007 at 04:42 AM.
|
|
|
06-26-2007
|
#24
|
|
Passing By
Join Date: Apr 2007
Location: Germany
Posts: 14
|
Hi folks. I'm trying to use your script, but for some reason, the sound gets fu$%ed up every time. It creates this unbearable hissing sound... Can anyone please help me out? Using Ubuntu Feisty here. All updates applied.
|
|
|
09-03-2007
|
#25
|
|
Passing By
Join Date: Sep 2007
Posts: 2
|
Quote:
Originally Posted by oCfuu
Hi folks. I'm trying to use your script, but for some reason, the sound gets fu$%ed up every time. It creates this unbearable hissing sound... Can anyone please help me out? Using Ubuntu Feisty here. All updates applied.
|
I had the same problem. Try to install an older version of mencoder (i took the version for ubuntu edgy).
Now sound is normal.
|
|
|
09-03-2007
|
#26
|
|
Passing By
Join Date: May 2007
Posts: 5
|
I'm using Ubuntu Feisty with all updates.
My mencoder:
MEncoder 2:1.0~rc1-0ubuntu9.1
|
|
|
09-26-2007
|
#27
|
|
Passing By
Join Date: Sep 2007
Posts: 5
|
W000t!! Just got my meizu miniplayer.
I'm running Ubuntu Feisty. Would this script be the best way to go about converting? Any suggestions? I've converted a couple videos using the included CD and wine, and they came out ok I guess, but had some sync and frame issues. I also tried iriverter with a meizu profile, but that wasnt much better. Any suggestions? I'll usually be converting from Divx or xvid source.
|
|
|
09-30-2007
|
#28
|
|
Passing By
Join Date: May 2007
Posts: 5
|
Give Shookie's script (first post in this thread) a try. My script is to convert VOB files from a ripped DVD.
If there still sync issues, you might try a multi-pass encoding.
I certainly would certainly encode directly in Ubuntu without using WINE.
I have not tried to convert any divx files, but since they are already compressed that might contribute to your sync issues.
|
|
|
10-07-2007
|
#29
|
|
Passing By
Join Date: Aug 2007
Posts: 10
|
Im having a little trouble
I tried this:
martin@ranm-ubuntu:~/media/video/ser...2E02.HDTV.XviD-XOR$ meizu-convert cropbar heroes.s02e02.hdtv.xvid-xor.avi h2.avi
And got this:
Code:
MEncoder 2:1.0~rc1-0ubuntu9.1 (C) 2000-2006 MPlayer Team
CPU: AMD Athlon(tm) 64 Processor 3700+ (Family: 15, Model: 39, Stepping: 1)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
success: format: 0 data: 0x0 - 0x15dfe0cc
AVI file format detected.
VIDEO: [XVID] 624x352 24bpp 23.976 fps 1010.0 kbps (123.3 kbyte/s)
[V] filefmt:3 fourcc:0x44495658 size:624x352 fps:23.98 ftime:=0.0417
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
Cannot open output file '/media/DataStorage/meizuvid/[M6]h2.avi'.
Exiting...
martin@ranm-ubuntu:~/media/video/series/tv/Heroes/S2/Heroes.S02E02.HDTV.XviD-XOR/Heroes.S02E02.HDTV.XviD-XOR$
Cannot open output file '/media/DataStorage/meizuvid/[M6]h2.avi'. <- why do I get that?
There certainly is no DataStorage folder mounted.. so what could be the problem? I tried running this with sudo aswell, and it didn't work.
|
|
|
10-08-2007
|
#30
|
|
Passing By
Join Date: May 2007
Posts: 5
|
You didn't create the folder for the output as defined in line 6 of the script.
outputpath=/media/DataStorage/meizuvid/
You can change this to anything you want, but be sure to change the script to point to the correct destination.
|
|
|
10-20-2007
|
#31
|
|
Passing By
Join Date: Jun 2007
Posts: 6
|
Thanks a lot for this script Shookie, its very useful :D
I use Yakuake for my terminal which is brilliant because I can check on the progress at any point.
Also, I noticed the Meizu player and Linux don't automatically sync, so I am using a script called realsaferemove, I cant find the website for it, but I could rehost if someone wanted it. It basically forces the M6 and any USB device to update all the files so it can be removed.
I also found that some of mencoders files say that they only are 35kb big or so in konqueror, I don't know if this is a problem elsewhere, but to find the realsize, just CD to the directory in a terminal window then type ls -ash.
Forgot to mention, I have been using 18, 300, 128 as that had no A/V jumps for me. Not that I have noticed yet, even on very long videos
Last edited by deviance; 10-20-2007 at 04:13 PM.
|
|
|
10-21-2007
|
#32
|
|
Passing By
Join Date: Oct 2007
Posts: 18
|
Yet another mencoder script
I've written another script, if anyone's interested please point your browsers to Yet Another Mencoder Script
Last edited by wishmechaos; 08-29-2008 at 03:18 AM.
|
|
|
10-21-2007
|
#33
|
|
Member
Join Date: Mar 2007
Posts: 108
|
Quote:
Originally Posted by wishmechaos
Hi. I wanted to write a script to handle multiple files, and ended up with something quite complete. You can specify most of the useful parameters, or just fill in the defaults as you like and use over and over. It will pick up any subtitles with the same filename as the movie (only srt and sub, since it's all I could think of) but more can easily be added (please tell me!).
Output has the same filename and is in the same directory as input but ends up with .meizu.avi.
Currently, command-line options are:
-h (Help)
-p (Two-pass encoding)
-v number (video bitrate)
-a number (audio bitrate)
-c (crop, taken from the original script)
-f number (frames per second)
Any suggestions or bugs, please let me know. Hope it's useful, cheers.
Code:
#!/bin/bash
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of the nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Copyleft 2007 wishmechaos
# Version 0.1, 21-oct-07
### Defaults
# Frames per second (15-20)
fps=20
# Two pass encoding, takes longer, better quality
twopass=no
# Video bitrate
vbitrate=394
# Audio bitrate
abitrate=96
### End defaults
show_help() {
echo "Usage: `basename "$0"` [-h(elp)] [-c(rop)] [-p (two-pass)] [-f(ps) number]
[-v(ideo bitrate) number] [-a(udio bitrate) number] file1.avi [file2.avi...]
Subtitles are automatically loaded if their filename is the same as the movie file"
exit 1
}
# find subtitles with same filename
findsubs() {
for possiblefile in $filename*; do
echo " $possiblefile is a subtitle candidate"
case $possiblefile in
*.sub) echo " Found $possiblefile"; sub="$possiblefile";;
*.srt) echo " Found $possiblefile"; sub="$possiblefile";;
esac
done
if [[ $sub != "" ]]; then
echo " Using $sub"
sub="-sub $sub -subfont-text-scale 4 -subfont-outline 3 " # 5 is too large
fi
}
convert() {
tput setaf 0
mencoder "$moviefile" -idx -noodml -ofps $fps -vf $vf -ovc lavc -ffourcc XVID -lavcopts "$vpass"vcodec=mpeg4:vbitrate=$vbitrate:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=$abitrate -af resample=44100 -srate 44100 $sub-o "$filename.meizu.avi"
if [[ "$twopass" == "yes" ]]; then
echo frapitas
mencoder "$moviefile" -idx -noodml -ofps $fps -vf $vf -ovc lavc -ffourcc XVID -lavcopts vpass=2:vcodec=mpeg4:vbitrate=$vbitrate:vmax_b_frames=0:vhq -sws 9 -oac mp3lame -lameopts cbr:mode=2:br=$abitrate -af resample=44100 -srate 44100 $sub -o "$filename.meizu.avi"
rm divx2pass.log
fi
tput setaf 2
echo " Finished converting $moviefile"
}
cleanUp() {
tput setaf 0
rm "$filename.meizu.avi"
rm divx2pass.log
exit 1
}
trap cleanUp INT
# If there're no arguments
if [ $# = 0 ]; then show_help; fi
# Parse arguments
x=1 # Avoids an error if we get no options at all.
while getopts "hcpf:" opt; do
case "$opt" in
h|\?) show_help;;
c) crop="yes";;
p) twopass="yes";;
f) fps="$OPTARG";;
a) abitrate="$OPTARG";;
esac
x=$OPTIND
done
shift $((x-1))
if [[ "$crop" == "yes" ]]; then
vf="scale=427:240,expand=:240:::1,crop=320:240,rotate=1"
else
vf="scale=320:-2,expand=:240:::1,crop=320:240,rotate=1"
fi
if [[ "$twopass" == "yes" ]]; then
vpass="vpass=1:"
fi
for moviefile in $@; do
if [[ -f "$moviefile" ]]; then
tput setaf 2 # color!
echo " Moviefile is $moviefile"
extension=".${moviefile##*.}"
echo " Extension is $extension"
filename="`basename $moviefile $extension`"
echo " Filename is therefore $filename"
# ugly way to do it, works though.
if [[ $moviefile != "${moviefile%/*}" ]]; then cd "${moviefile%/*}"; fi
findsubs
echo " Converting $moviefile"
convert
else
echo " $moviefile doesn't exist"
fi
done
tput setaf 0
|
Looks useful.. will have to give it a try...
|
|
|
10-21-2007
|
#34
|
|
Moderator
Join Date: May 2007
Posts: 2,598
|
Hi wishmechaos. I see that you are putting some work into this bash script. I would like to note that this is the way I started with BatMan months ago, and later I was kinda resentful of myself that I didn't think bigger right from the start - and made it modular, platform-independent, open source and most important : with a graphical user interface.
Also some people here seem to be able to offer their help on such a project (oCfuu, mfb, mhchaudhry .. among others). I would find that very cool :-)
Btw, our friends from France have started something similiar but it's closed source, ponly for Windows, and only in French (yet). They seem to want no other help than from French people :-/
__________________
BatMan, the free video converter for Meizu players. Problems ? English First Aid here. Deutsche Erste Hilfe hier.
Join the Meizume Chatroom at irc://dalnet/meizume ! Firefox Users : get the Chatzilla Plugin. Other Browsers : open a java chat at www.dal.net and enter "/join #meizume"
|
|
|
10-21-2007
|
#35
|
|
Member
Join Date: May 2007
Location: The Netherlands
Posts: 220
|
Interesting indeed, I don't know if it'll be all that succesfull however. I think a cross-platform solution, maybe with a simple GUI, would attract a lot more users.
|
|
|
10-21-2007
|
#36
|
|
Passing By
Join Date: Oct 2007
Posts: 18
|
@BobbyQ, mfb
I'm sorry, but I kinda don't see the need for a GUI. I haven't used Batman since I don't use Windows anymore, but for a repetitive task like this, I tend to think command line programs and scripts are better suited.
I'd appreciate if you tell me why do you think a GUI is important (besides the most obvious reason, newbie-friendliness).
Cheers,
Diego.
|
|
|
10-21-2007
|
#37
|
|
Member
Join Date: May 2007
Location: The Netherlands
Posts: 220
|
Quote:
Originally Posted by wishmechaos
@BobbyQ, mfb
I'm sorry, but I kinda don't see the need for a GUI. I haven't used Batman since I don't use Windows anymore, but for a repetitive task like this, I tend to think command line programs and scripts are better suited.
|
BatMan currently is a commandline program. I agree with you that for the task you use it for, a commandline is perfect. (Especially if you're a yakuake user like me :P ) So there is nothing wrong with it, for your own use.
Quote:
|
I'd appreciate if you tell me why do you think a GUI is important (besides the most obvious reason, newbie-friendliness).
|
Indeed, newbie friendliness is one of the reasons. Also, for different profiles, a GUI makes it more simple to quickly change between it. Also drag & drop is nice. I'm thinking more of a simple GUI, like OggDropXPd with some radiobuttons for changing between profiles.
That way you can easily: Drag & drop files to encode, quickly see the progress of the encode for both single files and the entire batch through a progressbar, switch profiles and attract n00bs.
Last edited by mfb; 10-21-2007 at 09:48 PM.
|
|
|
10-21-2007
|
#38
|
|
Moderator
Join Date: May 2007
Posts: 2,598
|
I think the number of people not being able to use a command line with lots of parameters is large. And doing so is in fact pretty much uncomfortable, especially if you need to convert more than one video.
Some people even have difficulties using BatMan which is really very easy. Most of them are just used to GUIs, that is all. Using the keyboard for inputs just does not get into their minds easily.
There are already GUI converters like Loli's, SUPER, Winmenc, and and and. But they all lack either in reliability or functionality or quality. That's why I dedicated a lot of time to that 3 topics - but not to a nice GUI.
__________________
BatMan, the free video converter for Meizu players. Problems ? English First Aid here. Deutsche Erste Hilfe hier.
Join the Meizume Chatroom at irc://dalnet/meizume ! Firefox Users : get the Chatzilla Plugin. Other Browsers : open a java chat at www.dal.net and enter "/join #meizume"
|
|
|
10-22-2007
|
#39
|
|
Passing By
Join Date: Jun 2007
Posts: 6
|
I think its fine on the CL, especialy as I am another Yakuake user.
|
|
|
10-22-2007
|
#40
|
|
Passing By
Join Date: Oct 2007
Posts: 2
|
How do you guys go about encoding h264 to Xvid? I get lots of mpeg arftifacts on M6 if the original movie is encoded in h264. Changing the bitrate doesn't have any effect as the same video errors still show up.
This is my current mencoder profile:
Code:
[meizu]
profile-desc="Encode for Meizu M6"
quiet=yes
fontconfig=yes
oac=mp3lame=yes
lameopts=cbr=yes:mode=0:br=128
af=resample=44100
ovc=lavc=yes
lavcopts=vcodec=mpeg4:mbd=2:vbitrate=340:vmax_b_frames=0:vhq=yes
ofps=18
vf=scale=320:-2,expand=:240:::1,crop=320:240,rotate=1
idx=yes
noodml=yes
ffourcc=XVID
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Powered by vBulletin. Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.
|