Voici un script fileencode que je me suis fait pour rapidement encoder en mpeg4 n'importe quel fichier lisible par mplayer, avec un minimum d'options, et en double passe.
#!/bin/bash
if let "$#<1" || ( let "$#==1" && [ "1ドル" = "-h" ] );then
echo usage:
echo 0ドル [options] input.avi output.avi
echo '-b br video bitrate (800kb/s)'
echo '-a br audio bitrate (64kb/s)'
echo '-s [[hh:]mm]ss seek to given time first (begin of input)'
echo '-e [[hh:]mm:]ss record time (end of input)'
echo '-t width:height image size (original size)'
echo '-c w:h:x:y crop image (no crop)'
echo ' -t and -c and not compatible, -t has precedence over -c'
echo '-o other other options for mencoder'
echo 'input.avi the input file (no default)'
echo 'output.avi the output file (no default)'
exit
fi
br=800
abr=64
seek=0
end=no
taille=no
crop=no
other=""
while getopts b:a:s:e:t:c:o: nom;do
if [ $nom == "?" ];then
exit
fi
case $nom in
(b)
br=$OPTARG
;;
(a)
abr=$OPTARG
;;
(s)
seek=$OPTARG
;;
(e)
end=$OPTARG
;;
(t)
taille=$OPTARG
;;
(c)
crop=$OPTARG
;;
(o)
other=$OPTARG
;;
esac
done
if let "$OPTIND<=$#-1" ;then
input=${!OPTIND}
OPTIND=$((OPTIND+1))
output=${!OPTIND}
else
echo require input and output files
exit
fi
echo "br $br"
echo "abr $abr"
echo "seek $seek"
echo "end $end"
echo "size $taille"
echo "crop $crop"
echo "input $input"
echo "output $output"
endrec=""
if [ $end != "no" ];then
endrec=" -endpos $end"
fi
vop=""
if [ $taille != "no" ];then
vop=" -vop scale=$taille"
elif [ $crop != "no" ];then
vop=" -vop crop=$crop"
fi
# Re: transcode / mencoder
Posté par wismerhill . En réponse au journal transcode / mencoder. Évalué à 2.
#!/bin/bash
if let "$#<1" || ( let "$#==1" && [ "1ドル" = "-h" ] );then
echo usage:
echo 0ドル [options] input.avi output.avi
echo '-b br video bitrate (800kb/s)'
echo '-a br audio bitrate (64kb/s)'
echo '-s [[hh:]mm]ss seek to given time first (begin of input)'
echo '-e [[hh:]mm:]ss record time (end of input)'
echo '-t width:height image size (original size)'
echo '-c w:h:x:y crop image (no crop)'
echo ' -t and -c and not compatible, -t has precedence over -c'
echo '-o other other options for mencoder'
echo 'input.avi the input file (no default)'
echo 'output.avi the output file (no default)'
exit
fi
br=800
abr=64
seek=0
end=no
taille=no
crop=no
other=""
while getopts b:a:s:e:t:c:o: nom;do
if [ $nom == "?" ];then
exit
fi
case $nom in
(b)
br=$OPTARG
;;
(a)
abr=$OPTARG
;;
(s)
seek=$OPTARG
;;
(e)
end=$OPTARG
;;
(t)
taille=$OPTARG
;;
(c)
crop=$OPTARG
;;
(o)
other=$OPTARG
;;
esac
done
if let "$OPTIND<=$#-1" ;then
input=${!OPTIND}
OPTIND=$((OPTIND+1))
output=${!OPTIND}
else
echo require input and output files
exit
fi
echo "br $br"
echo "abr $abr"
echo "seek $seek"
echo "end $end"
echo "size $taille"
echo "crop $crop"
echo "input $input"
echo "output $output"
endrec=""
if [ $end != "no" ];then
endrec=" -endpos $end"
fi
vop=""
if [ $taille != "no" ];then
vop=" -vop scale=$taille"
elif [ $crop != "no" ];then
vop=" -vop crop=$crop"
fi
mencoder "$input" -ss $seek $endrec $vop -oac mp3lame -lameopts abr:br=$abr -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$br:vpass=1 $other -o "$output"
mencoder "$input" -ss $seek $endrec $vop -oac mp3lame -lameopts abr:br=$abr -ovc lavc -lavcopts vcodec=mpeg4:vbitrate=$br:vpass=2 $other -o "$output"