Subtitle DVD Multiplex

Publicado por Carlos Alberto 08/02/2008

[ Hits: 4.597 ]

Download sdvdmux




Esta é a atualização do SDVDMux, que serve para adicionar legendas em arquivos MPEG, além de testar se seu sistema tem o necessário para fazer isso. Basta ter em uma mesma pasta o vídeo e todas as legendas.

Os nomes dos arquivos não devem ter espaços, vírgulas ou acentos, todas as legendas serão acrescentadas uma a uma, gerando um arquivo mpeg final.

Sua execução ficaria assim:

sdvdmux [-f fps] [-a posição_legenda] [ -t dvd, cvd, or svcd ] -l arquivo_legenda -v arquivo_mpeg [-u font_para_legenda]
     sdvdmux -u list ---> Lista as fontes disponíveis

  



Esconder código-fonte

#!/bin/sh
#
# sdvdmux - attempt to multiplex an unknown type of text suttitle in to a dvd video file.
#
# Copyright (C) 2008 by Carlos Alberto (carlosxlinux@Gmail.com).
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted, provided
# that the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation.  This software is provided "as is" without express or
# implied warranty.

SPUMUX=`ls /usr/bin/spumux 2> /dev/null`;
MPGINFO=`ls /usr/bin/mpginfo 2> /dev/null`;

NUM="0"

vid_licence(){
echo "sdvdmux - attempt to multiplex an unknown type of text suttitle in to a dvd video file.";
echo "Copyright (C) 2008 by Carlos Alberto (carlosxlinux@Gmail.com)."
echo "This software is released under the GPL. There is NO WARRANTY."
echo "(see http://www.gnu.org/licenses/gpl.html)"
echo ""
}

vid_licence;

vid_help(){
echo "Use: sdvdmux [-f fps] [-a posição_legenda] [ -t dvd, cvd, or svcd ] -l arquivo_legenda -v arquivo_mpeg [-u font_para_legenda]";
echo "     sdvdmux -u list ---> Lista as fontes disponíveis";
}

if [ -z $SPUMUX ];
then
echo "Não encontrado o pacote dvdauthor, instale-o e tente novamente."
exit 2;
fi

while getopts a:A:l:L:v:V:f:F:u:U OPT
do
   case ${OPT} in
      a | A)    SUBT_POSIT="${OPTARG}";;
      t | T)    TIPO_TRACK="${OPTARG}";;
      l | L)    SUBT_TRACK="${OPTARG}";;
      v | V)    VIDE_TRACK="${OPTARG}";;
      f | F)    VID_FPS_SRC="${OPTARG}";;
      u | U)    CORETTF="${OPTARG}";;
      h | H)    vid_help; exit 2;;
   esac
done

TTFTEST=`ls $HOME/.spumux/*.ttf 2> /dev/null`

if [ -z "$TTFTEST" ];
then
ln -fs /usr/share/fonts/truetype/freefont/ $HOME/.spumux
fi

if [ -z "$CORETTF" ];
then
CORETTF="FreeSans.ttf";
else
if [ "$CORETTF" == "list" ]; then for q in $TTFTEST; do basename $q; done; exit 0; fi
fi

TTFTEST=`ls $HOME/.spumux/$CORETTF 2> /dev/null`;

if [ -z "$TTFTEST" ];
then
echo "Fonte $CORETTF não encontrada, instale ou tente outra.";
exit 2;
fi

if [ -z "$SUBT_TRACK" -o  -z "$VIDE_TRACK" ];
then
vid_help;
exit 2; 
fi

ARQUIVOTIPO=`file "$VIDE_TRACK" | cut -d: -f2 | cut -d, -f1 | cut -d" " -f2-`

if [ "$ARQUIVOTIPO" != "MPEG sequence" ];
then
echo "$VIDE_TRACK: não é um arquivo do tipo MPEG ou arquivo não informado."
exit 2;
fi

if [ -z "$TIPO_TRACK" ];
then
TIPO_TRACK="dvd";
fi

if [ -z "$VID_FPS_SRC" ];
then 
if [ -z "$MPGINFO" ];
then
echo "Não encontrado o programa mpginfo no seu patch, é necessário para a detecção dos frames do video.";
echo "Assumindo 25 fps.";
VID_FPS_SRC="25";
else
VID_FPS_SRC=`$MPGINFO -N "$VIDE_TRACK" 2> /dev/null | awk '/fps/{print $5}'`;
VID_WIDTH=`$MPGINFO -N "$VIDE_TRACK" 2> /dev/null | awk '/Size/{print $2}' | cut -f2 -d[ `;
VID_HEIGHT=`$MPGINFO -N "$VIDE_TRACK" 2> /dev/null | awk '/Size/{print $4}' | cut -f1 -d] `;
if test "${VID_FPS_SRC}" == ""; then echo "Não foi possível detectar a taxa de frames."; echo "Assumindo 25 fps."; VID_FPS_SRC="25"; fi
if test "${VID_WIDTH}" == ""; then echo "Não foi possível detectar a largura dos frames."; echo "Assumindo 720 fps."; VID_WIDTH="720"; fi
if test "${VID_HEIGHT}" == ""; then echo "Não foi possível detectar a autura dos frames."; echo "Assumindo 480 fps."; VID_HEIGHT="480"; fi
echo "Assumindo video com $VID_FPS_SRC fps e $VID_WIDTH x $VID_HEIGHT.";
fi
fi

if [ -z "$SUBT_POSIT" ];
then

for LISTA in $SUBT_TRACK;
do

SPUXML="<subpictures><stream><textsub filename='$LISTA' characterset='ISO8859-1' fontsize='28.0' font='$CORETTF' horizontal-alignment='center' vertical-alignment='bottom' bottom-margin='30' subtitle-fps='$VID_FPS_SRC' movie-width='$VID_WIDTH' movie-height='$VID_HEIGHT' /></stream></subpictures>"

echo "$SPUXML" > spuxml.xml;

fim=`spumux -s "$NUM" -P -m "$TIPO_TRACK" "spuxml.xml" < "$VIDE_TRACK" > videofinal-$NUM.mpg`;
echo $fim;

echo "Acrescentada a legenda $NUM"

VIDE_TRACK="videofinal-$NUM.mpg"

if [ "$NUM" -gt "0" ];
then
rm -f videofinal-$NUM1.mpg;
fi

NUM1=$NUM;
NUM=`expr $NUM + 1`;

done

else

SPUXML="<subpictures><stream><textsub filename='$SUBT_TRACK' characterset='ISO8859-1' fontsize='28.0' font='$CORETTF' horizontal-alignment='center' vertical-alignment='bottom' bottom-margin='30' subtitle-fps='$VID_FPS_SRC' movie-width='720' movie-height='480' /></stream></subpictures>"

echo "$SPUXML" > spuxml.xml;

fim=`spumux -s "$SUBT_POSIT" -P -m "$TIPO_TRACK" "spuxml.xml" < "$VIDE_TRACK" > videofinal-$SUBT_POSIT.mpg`;
echo $fim;

echo "Acrescentada a legenda $SUBT_POSIT"
fi

rm -f spuxml.xml

Scripts recomendados

script para tirar ss

Script para ripar CDs de audio e codificar as faixas para MP3

Backup

"Wnslookup" - Monitorando os DNS da Rede

Backup completo em fita


  

Comentários

Nenhum comentário foi encontrado.


Contribuir com comentário




Patrocínio

Site hospedado pelo provedor RedeHost.
Linux banner

Destaques

Artigos

Dicas

Tópicos

Top 10 do mês

Scripts