SDVDMux

Publicado por Carlos Alberto 24/10/2006

[ Hits: 4.143 ]

Download sdvdmux




O SDVDMux 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 -v video.mpg -l '*.srt'

  



Esconder código-fonte

#!/bin/sh
#
# sdvdmux - attempt to multiplex an unknown type of text suttitle in to a dvd video file.
#
# Copyright (C) 1991 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"

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

while getopts l:L:v:V:f:F OPT
do
   case ${OPT} in
      t | T)    TIPO_TRACK="${OPTARG}";;
      l | L)    SUBT_TRACK="${OPTARG}";;
      v | V)    VIDE_TRACK="${OPTARG}";;
      f | F)    VID_FPS_SRC="${OPTARG}";;
      h | H)    echo "Desconhecido ou incompleto.";
         echo "Use: sdvdmux [-f fps] [ -t dvd, cvd, or svcd ] -l arquivo_legenda -v arquivo_mpeg";
         exit 2;;
   esac
done

if [ -z "$SUBT_TRACK" -o  -z "$VIDE_TRACK" ];
then
echo "Desconhecido ou incompleto.";
echo "Use: sdvdmux [-f fps] [ -m dvd, cvd, or svcd ] -l arquivo_legenda -v arquivo_mpeg";
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

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

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

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

if [ -z "$TTFTEST" ];
then
echo "Fonte ARIAL não encontrada, instale o pacote msttcorefonts, e tente novamente.";
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 | grep "fps" | awk '{print $5}'`;
VID_WIDTH=`mpginfo -N "$VIDE_TRACK" 2> /dev/null | grep "Size" | cut -d"[" -f 2 | awk '{print $1}'`;
VID_HEIGHT=`mpginfo -N "$VIDE_TRACK" 2> /dev/null | grep "Size" | cut -d"]" -f 1 | awk '{print $4}'`;
echo "Video com $VID_FPS_SRC fps e $VID_WIDTH x $VID_HEIGHT detectados.";
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
fi
fi

for LISTA in `ls $SUBT_TRACK`;
do

SPUXML="<subpictures><stream><textsub filename='$LISTA' characterset='ISO8859-1' fontsize='28.0' font='arial.ttf' 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 "$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

rm -f spuxml.xml

Scripts recomendados

Login-Unico

Script para fazer download do youtube

xadsl-setup

Ubuntu - Removendo kernels antigos

LIXEIRA COMPLETA!


  

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