View Single Post
Posts: 103 | Thanked: 157 times | Joined on Feb 2007 @ Jyväskylä, Finland
#32
Is it possible to add few more parameters for the tablet-encode? I tried to use "--mencoder=ARGn" but couldn't get it working.

I have some kung-fu DVDs which have English audio set as a default and when I make conversion, tablet-encode selects it. However I would like to have original Chinese audio with English subtitles.

I have also used few other parameters with my own script (based to ones found on maemo.org wiki) which I would like to see also in tablet-encode. One of those is possibility to keep original aspect ratio and still crop black borders away. Videos will be 400 pixels (or whatever is set as resolution) wide and height will be automatically calculated based on aspect ratio. At least mplayer plays these videos correctly and black borders aren't encoded at all.

These are the mencoder parameters I would like to see in tablet-encode:

#Audio language e.g "zh"
-alang <lang code>

#Subtitle language e.g "en"
-slang <lang code>

#Subtitle font and its size
-subfont-text-scale 7 -spuaa 3 -subcp latin1

#Crop value and scaling to correct aspect ratio.
-vf crop <x:x:x:x>,scale=400:-10

I have used "mplayer dvd://$TITLE -vf cropdetect" to get correct crop value. Crop value can be different in the start of the movie so I have selected manually a position which I would like to use as a crop value and then I have then put it as a parameter for "-vf crop".

Here is the script I have used to convert my DVDs. It's bit rough edged but it has been working just fine for me
Code:
#!/bin/bash
#
# N800dvd.sh
#
# Usage: N800dvd.sh
#

TITLE=$1

clear
echo
echo '       ##################################################'
echo '       #                                                #'
echo '       #           Encode DVD for Nokia N800            #'
echo '       #                                                #'
echo '       ##################################################'
echo
echo -n "DVD title number to be encoded? [$1]: "
read title_in
if [ "$title_in" != "" ]; then
  TITLE=$title_in
fi

# Default values
ABR='128'
VBR='600'
ALANG='en'
AID='128'
SLANG='fi'
SID='1'
RES='400'
OUT=`echo -n "$TITLE" |sed 's/$/-N800.avi/g'`
VOP='0:0:0:0'

echo -n "Output file? [$OUT]: "
read out_in
if [ "$out_in" != "" ]; then
  OUT=$out_in
fi

echo -n "Resolution (width)? [$RES]: "
read res_in
if [ "$res_in" != "" ]; then
  RES=$res_in
fi

echo -n "Video bitrate? [$VBR]: "
read vbr_in
if [ "$vbr_in" != "" ]; then
  VBR=$vbr_in
fi

echo -n "Audio bitrate? [$ABR]: "
read abr_in
if [ "$abr_in" != "" ]; then
  ABR=$abr_in
fi

echo -n "Audio language code? [$ALANG]: "
read alang_in
if [ "$alang_in" != "" ]; then
  ALANG=$alang_in
fi

echo -n "Subtitle language code? [$SLANG]: "
read slang_in
if [ "$slang_in" != "" ]; then
  SLANG=$slang_in
fi

echo
echo "Crop black bars?"
echo "(y) Yes"
echo "(n) No"
echo -n "Select [n]: "
read crop
if [ "$crop" = "y" ]; then
echo
echo Press q to use that point as a croping value.
mplayer dvd://$TITLE -vf cropdetect -nosound -vo xv &>crop.tmp
sed -e :a -e '$q;N;4,$D;ba' crop.tmp > crop1.tmp
crop_line=$(sed q crop1.tmp)
crop_front=$(echo "$crop_line" | sed -re 's/^.+\=//')
VOP=$(echo "$crop_front" | sed s/..$//)
rm crop*.tmp 2>/dev/null

else
VOP='0:0:0:0'
fi

echo
echo Video crop area: $VOP

echo
echo '       ##################################################'
echo '       #                                                #'
echo '       #            Encoding (pass 1 of 2)              #'
echo '       #                                                #'
echo '       ##################################################'
echo
echo "Start time: $(date)"

rm -f divx2pass_$OUT.log 2>/dev/null

#nice -n 19 \
mencoder "dvd://$TITLE" \
    -o "$OUT" \
    -oac mp3lame -lameopts cbr:preset=$ABR -af volnorm=1 \
    -passlogfile divx2pass_$OUT.log \
    -vf field=0 \
    -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$VBR:vpass=1:turbo \
    -vf crop=$VOP,scale=$RES:-10 \
    -ffourcc DIVX &>/dev/null \
    -alang $ALANG -slang $SLANG \
    -idx \
    -subfont-text-scale 7 -spuaa 3 -subcp latin1 &>/dev/null


echo "End time: $(date)"

echo
echo '       ##################################################'
echo '       #                                                #'
echo '       #            Encoding (pass 2 of 2)              #'
echo '       #                                                #'
echo '       ##################################################'
echo
echo "Start time: $(date)"

#nice -n 19 \
mencoder "dvd://$TITLE" \
    -o "$OUT" \
    -oac mp3lame -lameopts cbr:preset=$ABR -af volnorm=1 \
    -passlogfile divx2pass_$OUT.log \
    -vf field=0 \
    -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$VBR:mbd=2:vpass=2 \
    -vf crop=$VOP,scale=$RES:-10 \
    -ffourcc DIVX \
    -alang $ALANG -slang $SLANG \
    -idx \
    -subfont-text-scale 7 -spuaa 3 -subcp latin1 &>/dev/null

rm -f divx2pass_$OUT.log 2>/dev/null

echo "End time: $(date)"
echo
echo '       ##################################################'
echo '       #                                                #'
echo '       #               Encoding completed               #'
echo '       #                                                #'
echo '       ##################################################'
echo