Mpeg 2 Converter
Publicado por Carlos Alberto (última atualização em 08/12/2010)
[ Hits: 5.219 ]
Ferramenta em kmdr (kommander) para conversão de formatos de vídeo para mpeg-dvd ou dvd para avi/mkv.
#!/usr/bin/kmdr-executor
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
<class>Mp2_ConverterVIDEO</class>
<author>CarlosXLinux@gmail.com</author>
<license>GPL2</license>
<version>0.03</version>
<widget class="Dialog">
<property name="name">
<cstring>Mp2_ConverterVIDEO</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<height>592</height>
</rect>
</property>
<property name="caption">
<string>MPEG Converter</string>
</property>
<property name="icon">
<pixmap>image0</pixmap>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
<string>@record.setVisible(false)
@sizecalc.execute
@forEach(T, "NTSC 720x480\nNTSC 704x480\nNTSC 352x480\nNTSC 352x240\nPAL 720x576\nPAL 704x576\nPAL 352x576\nPAL 352x288")
@tela.addUniqueItem(@T)
@end
</string>
<string></string>
</stringlist>
</property>
<property name="useShebang">
<bool>true</bool>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>11</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="QLayoutWidget" row="9" column="0" rowspan="1" colspan="15">
<property name="name">
<cstring>Layout1</cstring>
</property>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<widget class="ProgressBar" row="0" column="1">
<property name="name">
<cstring>PP_2</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>25</height>
</size>
</property>
<property name="totalSteps">
<number>100</number>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Progresso total</string>
</property>
</widget>
<widget class="ProgressBar" row="0" column="0">
<property name="name">
<cstring>PP_1</cstring>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>25</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>25</height>
</size>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Progresso do arquivo.</string>
</property>
</widget>
</grid>
</widget>
<spacer row="8" column="9" rowspan="1" colspan="2">
<property name="name">
<cstring>Spacer2</cstring>
</property>
<property name="orientation">
<enum>Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>52</width>
<height>0</height>
</size>
</property>
</spacer>
<widget class="Table" row="1" column="0" rowspan="5" colspan="14">
<column>
<property name="text">
<string>Arquivo</string>
</property>
</column>
<column>
<property name="text">
<string>Volume (M)</string>
</property>
</column>
<column>
<property name="text">
<string>Tempo (s)</string>
</property>
</column>
<column>
<property name="text">
<string>Tela</string>
</property>
</column>
<column>
<property name="text">
<string>Frame Rate (fps)</string>
</property>
</column>
<column>
<property name="text">
<string>Aspect</string>
</property>
</column>
<column>
<property name="text">
<string>V. Codec</string>
</property>
</column>
<column>
<property name="text">
<string>V. Bit Rate (Kb)</string>
</property>
</column>
<column>
<property name="text">
<string>A. Codec</string>
</property>
</column>
<column>
<property name="text">
<string>A. Bit Rate (Kb)</string>
</property>
</column>
<column>
<property name="text">
<string>A. Rate (Hz)</string>
</property>
</column>
<column>
<property name="text">
<string>A. Ling.</string>
</property>
</column>
<column>
<property name="text">
<string>S. Ling.</string>
</property>
</column>
<column>
<property name="text">
<string>Titulo</string>
</property>
</column>
<column>
<property name="text">
<string>Pasta</string>
</property>
</column>
<property name="name">
<cstring>Playlist</cstring>
</property>
<property name="numRows">
<number>0</number>
</property>
<property name="numCols">
<number>15</number>
</property>
<property name="selectionMode">
<enum>Single</enum>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Lista de arquivos a serem convertidos.</string>
</property>
</widget>
<widget class="ExecButton" row="3" column="14">
<property name="name">
<cstring>adiciona3</cstring>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property>
<property name="text">
<string></string>
</property>
<property name="accel">
<number>4152</number>
</property>
<property name="iconSet">
<iconset>image1</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
DDK="dcop @dcopid KommanderIf";
SCT="setCellText";
PL="Playlist"; c=0;
enall(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enall false;
DLST="$(awk '/name|hd[a-z]|sr[0-9]|scd[0-9]/{for (i=NF;i>=3;i--) { print $i }}' /proc/sys/dev/cdrom/info 2>/dev/null)";
for i in $DLST; do
TITLE="$(lsdvd -q "/dev/$i" 2>/dev/null | awk '/Longest track:/{ print $3 }')";
FILES="/dev/$i";
if [ -n "$TITLE" ]; then
DISC_TITLE="$(lsdvd -q "$FILES" | awk '/Disc.*Title:/{for (i=3;i<=NF;i++) { print $i }}')";
FLST="$i $DISC_TITLE";
c="$[c+1]";
fi
done
if [ "$[c]" != "1" ]; then
FILES="/dev/$(kdialog --menu "Escolha a unidade:" $FLST)";
TITLE="$(lsdvd -q "$FILES" 2>/dev/null | awk '/Longest track:/{ print $3 }')";
DISC_TITLE="$(lsdvd -q "$FILES" | awk '/Disc.*Title:/{for (i=3;i<=NF;i++) { print $i }}')";
fi
if [ -n "$FILES" -a -n "$TITLE" ]; then
n="$($DDK rowCount $PL)"; [ ! -n "$n" ] && n="0";
$DDK insertRow $PL $n 1;
$DDK $SCT $PL $n 0 "$DISC_TITLE";
V="$(lshal -u "volume_label_$DISC_TITLE" | awk '/volume.size/{ print $3 "/1024" }' | bc)";
$DDK $SCT $PL $n 1 "$V";
$DDK $SCT $PL $n 14 "$FILES";
ID_FILE="$(mplayer dvd://$TITLE -dvd-device "$FILES" -vo null -ao null -endpos 0 -identify 2>/dev/null 2>&1 | awk '/ID_AUDIO|ID_VIDEO|ID_DEMUXER|ID_LENGTH|ID_AID_.*_LANG/')";
ID_DVD_AUDIO="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Audio.*Language/{ print $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 " " $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 }')";
ID_DVD_SUBS="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Subtitle.*Language/{ print $1 $2 "_" $4 "_" $5 " " $1 $2 "_" $4 "_" $5 }')";
declare -t $ID_FILE;
c=0; for n in $ID_DVD_AUDIO; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_AUDIO="$(kdialog --menu "Linguagens encontradas:" $ID_DVD_AUDIO | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 11 "$(echo $ID_DVD_AUDIO | awk '{ print $2 }')";
ID_AUDIO_CODEC="$(echo $ID_DVD_AUDIO | awk '{ print $4 }')";
ID_AUDIO_RATE="$(echo $ID_DVD_AUDIO | awk '{ print $5 }')";
c=0; for n in $ID_DVD_SUBS; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_SUBS="$(kdialog --menu "Legendas encontradas:" nenhum nenhum $ID_DVD_SUBS | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 12 "$(echo $ID_DVD_SUBS | awk '{ print $2 }')";
$DDK $SCT $PL $n 2 "$ID_LENGTH";
$DDK $SCT $PL $n 3 "$ID_VIDEO_WIDTH:$ID_VIDEO_HEIGHT";
$DDK $SCT $PL $n 4 "$ID_VIDEO_FPS";
$DDK $SCT $PL $n 5 "$ID_VIDEO_ASPECT";
$DDK $SCT $PL $n 6 "$ID_VIDEO_CODEC";
$DDK $SCT $PL $n 7 "$[ID_VIDEO_BITRATE/1000]";
$DDK $SCT $PL $n 8 "$ID_AUDIO_CODEC";
$DDK $SCT $PL $n 9 "$[ID_AUDIO_BITRATE/1000]";
$DDK $SCT $PL $n 10 "$ID_AUDIO_RATE";
$DDK $SCT $PL $n 13 "$DISC_TITLE";
TOTAL="$[$($DDK text total | awk '{ print $2 }')+$(echo $ID_LENGTH | cut -f1 -d.)]";
HH="$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]";
MM="$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/60]-$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]*60]]";
SS="$[TOTAL-$[$[TOTAL/60]*60]]";
[ "$HH" -lt "10" ] && HH="0$HH"; [ "$MM" -lt "10" ] && MM="0$MM"; [ "$SS" -lt "10" ] && SS="0$SS";
$DDK setText total "Total: $TOTAL s - $HH:$MM:$SS";
VBITS="$($DDK text vbit | tr -d ':[alpha]:')";
ABITS="$($DDK text abit | tr -d ':[alpha]:')";
SIZE="$(echo "scale=2; ${TOTAL}*$[VBITS]/8+${TOTAL}*2*$[ABITS]/13" | bc -l)";
$DDK setText size "Estimado: $(echo "scale=2; ${SIZE}/1024" | bc -l )MB";
enall true;
fi;
enall true;
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Inserir um dvd inserido numa unidade a lista.(F9)</string>
</property>
</widget>
<widget class="Label" row="8" column="2">
<property name="name">
<cstring>Label7</cstring>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>V Bits:</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
</widget>
<widget class="ExecButton" row="5" column="14">
<property name="name">
<cstring>remove</cstring>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property>
<property name="text">
<string></string>
</property>
<property name="pixmap">
<pixmap>image2</pixmap>
</property>
<property name="accel">
<number>4154</number>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
DDK="dcop @dcopid KommanderIf";
enall(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enall false;
declare -t $($DDK selection Playlist | awk -F',' '{ print "IN=" $1 " ON=" $3 }');
timerrecal(){
TOTAL="$[$($DDK text total | tr -d 's' | awk '{ print $2 }')-$($DDK cellText Playlist $[a] 2 | cut -f1 -d.)]";
HH="$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]";
MM="$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/60]-$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]*60]]";
SS="$[TOTAL-$[$[TOTAL/60]*60]]";
[ "$HH" -lt "10" ] && HH="0$HH"; [ "$MM" -lt "10" ] && MM="0$MM"; [ "$SS" -lt "10" ] && SS="0$SS";
$DDK setText total "Total: ${TOTAL}s - $HH:$MM:$SS";
}
if [ "$[IN]" != "-1" -a "$[ON]" != "-1" ]; then
for ((a=$[IN];a<=$[ON];a++)); do timerrecal; done
$DDK removeRow Playlist $[IN] $[1+ON-IN];
else
for ((a=0;a<10;a++)); do timerrecal; done
$DDK removeRow Playlist 0 10;
fi
VBITS="$($DDK text vbit | tr -d ':[alpha]:')";
ABITS="$($DDK text abit | tr -d ':[alpha]:')";
SIZE="$(echo "scale=2; ${TOTAL}*$[VBITS]/8+${TOTAL}*2*$[ABITS]/13" | bc -l)";
$DDK setText size "Estimado: $(echo "scale=2; ${SIZE}/1024" | bc -l )MB";
enall true;
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Remove o arquivo selecionado da lista.(F11)</string>
</property>
</widget>
<widget class="Label" row="8" column="0">
<property name="name">
<cstring>Label9</cstring>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Tela:</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
</widget>
<widget class="StatusBar" row="10" column="0" rowspan="1" colspan="15">
<property name="name">
<cstring>DISPLAY</cstring>
</property>
</widget>
<widget class="ExecButton" row="1" column="14">
<property name="name">
<cstring>adiciona</cstring>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property>
<property name="text">
<string></string>
</property>
<property name="accel">
<number>4150</number>
</property>
<property name="iconSet">
<iconset>image3</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
DDK="dcop @dcopid KommanderIf";
SCT="setCellText";
PL="Playlist";
enall(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enall false;
$DDK clear mpinfo;
$DDK clear mplayernfo;
ARCHIVES="$(kdialog --multiple --separate-output --getopenfilename "$HOME" '*.[fm][lpk][veg4] *.[awoi][vmgs][ivmo] *.rpm *.rmv *.rmvb' | sed -e 's/ /##SPACE##/g' | sort -f -r)";
insertName(){
$DDK insertRow $PL $n 1;
V="$(basename "$1")";
$DDK $SCT $PL $n 0 "$V";
DISC_TITLE="$(echo "$V" | sed -e 's/.[mM][pP][eE][gG4]//g; s/.[fF][lL][vV]//g; s/.[oO][gG][mM]//g; s/.[mM][kK][vV]//g; s/.[mM][pP][gG4]//g; s/.[aA][vV][iI]//g; s/.[wW][mM][vV]//g; s/.[rR][mM][vV][bB]//g; s/.[rR][mM][vV]//g; s/.[rR][pP][mM]//g; s/.[vV][oO][bB]//g; s/.[iI][sS][oO]//g')";
V="$(du -s -h -k "$1" | awk '{ print $1 }')";
$DDK $SCT $PL $n 1 "$V";
V="$(dirname "$1")";
$DDK $SCT $PL $n 14 "$V";
}
ncounter(){
VAR="$1";
m="";
n=0;
for i in $VAR; do
n=$[n+1];
m="$m $n";
done;
echo $m
}
addfiles(){
FILES="$1";
if [ -n "$FILES" ]; then
n="$($DDK rowCount $PL 2>/dev/null)"; [ ! -n "$n" ] && n="0";
insertName "$FILES";
case "$FILES" in
*.[aA][vV][iI] | *.[wW][mM][vV] | *.[mM][kK][vV] | *.[fF][lL][vV] | *.[oO][gG][mM] | *.[rR][mM][vV] | *.[rR][mM][vV][bB] | *.[rR][pP][mM] | *.[mM][pP][gG4] | *.[mM][pP][eE][gG])
eval "$(mplayer "$FILES" -vo null -ao null -endpos 0 -identify 2>/dev/null 2>&1 | awk '/ID_VIDEO|ID_AUDIO|ID_SEEKABLE|ID_LENGTH|ID_DEMUXER|ID_AID_.*_LANG/')";
ID_FILE_AUDIO="$(mplayer "$FILES" -vo null -ao null -endpos 0 -identify 2>/dev/null 2>&1 | awk '/Audio.*stream/{ print $6 }')";
case "$FILES" in
*.mkv)
eval "$(mkvmerge -i "$FILES" | awk '/video/{ print "ID_VIDEO_CODEC=" $5 }' | tr -d '()')";
eval "$(mkvmerge -i "$FILES" | awk '/audio/{ print "ID_AUDIO_CODEC=" $5 }' | tr -d '()')";
MER="$(mkvmerge -i "$FILES" | awk '/audio/{ print $3 }')";
ID_FILE_AUDIO="$(ncounter "$MER")";
;;
esac
if [ ! -n "$(echo "$ID_VIDEO_ASPECT" | tr -d '0.')" ]; then ID_VIDEO_ASPECT="$(echo "scale=5; $ID_VIDEO_WIDTH/$ID_VIDEO_HEIGHT" | bc -l)"; fi
if [ -n "$(echo $ID_FILE_AUDIO | grep 2)" ]; then
for i in $ID_FILE_AUDIO; do ID_FILE_AUDIO="$(echo $ID_FILE_AUDIO | sed "s/$i/\"$i\" \"$i\"/g")"; done
V="$(kdialog --menu "Linguagens encontradas:" $ID_FILE_AUDIO)";
$DDK $SCT $PL $n 11 "$V";
else $DDK $SCT $PL $n 11 $ID_AUDIO_ID; fi;
LFS="";
if [ -f "$($DDK cellText $PL $n 14)/${DISC_TITLE}.srt" ]; then
LFS="${DISC_TITLE}.srt";
elif [ -f "$($DDK cellText $PL $n 14)/${DISC_TITLE}.ass" ]; then
LFS="${DISC_TITLE}.ass";
fi
c=0; for n in $LFS; do c="$[c+1]"; done;
if [ -n "$LFS" ]; then
if [ "$[c]" != "1" ]; then
for i in $LFS; do
l="$(echo "$i" | sed -e 's/##SPACE##/ /g')";
LFS="$(echo "$LFS" | sed "s/$i/\"$l\" \"$l\"/g")";
done;
V="$(kdialog --menu "Legendas encontradas:" nenhum nenhum $LFS)";
else
V="$(echo $LFS | sed -e 's/##SPACE##/ /g')";
fi
$DDK $SCT $PL $n 12 "$V";
else
$DDK $SCT $PL $n 12 nenhum;
fi
;;
*.[iI][sS][oO]|*hd[a-z]|*sr[0-9]|*scd[0-9])
TITLE="$(lsdvd -q "$FILES" | awk '/Longest track:/{ print $3 }')";
DISC_TITLE="$(lsdvd -q "$FILES" | awk '/Disc.*Title:/{for (i=3;i<=NF;i++) { print $i }}')";
eval "$(mplayer dvd://$TITLE -dvd-device "$FILES" -vo null -ao null -endpos 0 -identify 2>/dev/null 2>&1 | awk '/ID_AUDIO|ID_VIDEO|ID_DEMUXER|ID_LENGTH|ID_AID_.*_LANG/')";
ID_DVD_AUDIO="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Audio.*Language/{ print $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 " " $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 }')";
ID_DVD_SUBS="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Subtitle.*Language/{ print $1 $2 "_" $4 "_" $5 " " $1 $2 "_" $4 "_" $5 }')";
c=0; for n in $ID_DVD_AUDIO; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_AUDIO="$(kdialog --menu "Linguagens encontradas:" $ID_DVD_AUDIO | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 11 "$(echo $ID_DVD_AUDIO | awk '{ print $2 }')";
ID_AUDIO_CODEC="$(echo $ID_DVD_AUDIO | awk '{ print $4 }')";
ID_AUDIO_RATE="$(echo $ID_DVD_AUDIO | awk '{ print $5 }')";
c=0; for n in $ID_DVD_SUBS; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_SUBS="$(kdialog --menu "Legendas encontradas:" nenhum nenhum $ID_DVD_SUBS | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 12 "$(echo $ID_DVD_SUBS | awk '{ print $2 }')";
;;
esac
$DDK $SCT $PL $n 2 "$ID_LENGTH";
$DDK $SCT $PL $n 3 "$ID_VIDEO_WIDTH:$ID_VIDEO_HEIGHT";
$DDK $SCT $PL $n 4 "$ID_VIDEO_FPS";
$DDK $SCT $PL $n 5 "$ID_VIDEO_ASPECT";
$DDK $SCT $PL $n 6 "$ID_VIDEO_CODEC";
$DDK $SCT $PL $n 7 "$[ID_VIDEO_BITRATE/1000]";
$DDK $SCT $PL $n 8 "$ID_AUDIO_CODEC";
$DDK $SCT $PL $n 9 "$[ID_AUDIO_BITRATE/1000]";
$DDK $SCT $PL $n 10 "$ID_AUDIO_RATE";
DISC_TITLE="$(echo "$DISC_TITLE" | tr -d '(){}[]+!?:')";
$DDK $SCT $PL $n 13 "$DISC_TITLE";
TOTAL="$[$($DDK text total | tr -d 's' | awk '{ print $2 }')+$(echo $ID_LENGTH | cut -f1 -d.)]";
HH="$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]";
MM="$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/60]-$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]*60]]";
SS="$[TOTAL-$[$[TOTAL/60]*60]]";
[ "$HH" -lt "10" ] && HH="0$HH"; [ "$MM" -lt "10" ] && MM="0$MM"; [ "$SS" -lt "10" ] && SS="0$SS";
$DDK setText total "Total: ${TOTAL}s - $HH:$MM:$SS";
VBITS="$($DDK text vbit | tr -d ':[alpha]:')";
ABITS="$($DDK text abit | tr -d ':[alpha]:')";
SIZE="$(echo "scale=2; ${TOTAL}*$[VBITS]/8+${TOTAL}*2*$[ABITS]/13" | bc -l)";
$DDK setText size "Estimado: $(echo "scale=2; ${SIZE}/1024" | bc -l )MB";
enall true;
fi;
}
for A in $ARCHIVES; do
F="$(echo "$A" | sed -e 's/##SPACE##/ /g')";
case $A in
*.[iI][sS][oO]|*hd[a-z]|*sr[0-9]|*scd[0-9])
if lsdvd -q "$F" 2>/dev/null; then
addfiles "$F";
else
kdialog --error "Erro.\nNao foi possivel abrir o arquivo talvez nao seja imagem de um DVD.";
fi
;;
*)
addfiles "$F";
;;
esac
done
enall true;
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Inserir arquivos na lista. (F7)</string>
</property>
</widget>
<widget class="Label" row="8" column="4" rowspan="1" colspan="2">
<property name="name">
<cstring>Label7_2</cstring>
</property>
<property name="maximumSize">
<size>
<width>50</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>A. Bits:</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
</widget>
<widget class="ExecButton" row="4" column="14">
<property name="name">
<cstring>play</cstring>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property>
<property name="text">
<string></string>
</property>
<property name="accel">
<number>4153</number>
</property>
<property name="iconSet">
<iconset>image4</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
ADLAY="`echo "0.1*@adelay.text" | bc -l`";
fcalc(){
TOTAL="$(echo "scale=$2; $1" | bc -l)";
[ "$2" != "0" ] && echo $TOTAL || echo $TOTAL | cut -d. -f1;
}
DDK="dcop @dcopid KommanderIf";
enall(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enall false;
if [ "$IN" != "-1" ]; then
IN="$($DDK currentRow Playlist)";
APC="$($DDK cellText Playlist $IN 5)";
VF1="$($DDK cellText Playlist $IN 3 | cut -d: -f2)";
HF1="$($DDK cellText Playlist $IN 3 | cut -d: -f1)";
case $($DDK selection tela) in
NTSC*|PAL*)
VF2="$($DDK selection tela | awk '{ print $2 }' | cut -dx -f2)";
HF2="$($DDK selection tela | awk '{ print $2 }' | cut -dx -f1)";
;;
*)
VF2="$($DDK selection tela | cut -dx -f2)";
HF2="$($DDK selection tela | cut -dx -f1)";
;;
esac
NV="$(fcalc "$HF2/$APC" 0)";
if [ "@wide.checked" == "0" -a "@fill.checked" == "0" ] || [ "@wide.checked" == "1" -a "@fill.checked" == "1" ]; then
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then ASPECT="16/9"; else ASPECT="4/3"; fi;
EXPAND="expand=$HF1:::::$ASPECT,scale=$HF2:$VF2";
elif [ "@wide.checked" == "1" -a "@fill.checked" == "0" ]; then
ASPECT="16/9";
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then
EXPAND="expand=$HF1:::::$ASPECT,scale=$HF2:$VF2";
else
VF="$(fcalc "9*$HF1/16" 0)";
EXPAND="crop=$HF1:$VF,scale=$HF2:$VF2";
fi;
elif [ "@wide.checked" == "0" -a "@fill.checked" == "1" ]; then
ASPECT="4/3";
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then
EXPAND="expand=$HF1:::::$ASPECT,scale=$HF2:$VF2";
else
VF="$(fcalc "3*$HF1/4" 0)";
EXPAND="crop=$HF1:$VF,scale=$HF2:$VF2";
fi;
fi
ENDR="$($DDK cellText Playlist $IN 14)";
FNAME="$($DDK cellText Playlist $IN 0)";
FILE="$ENDR/$FNAME";
MPL="mplayer -channels 6 -af resample=48000,hrtf -noautosub -ontop -idx -vo xv -identify -osdlevel 2 -softvol -softvol-max 500";
ALANG="$($DDK cellText Playlist $IN 11)";
case $ALANG in
[a-z][a-z])
ALANG=" -alang $ALANG";
;;
[0-9])
ALANG=" -aid $ALANG";
;;
nenhum|todos)
ALANG="";
;;
esac
SLANG="$($DDK cellText Playlist $IN 12)";
case $SLANG in
[a-z][a-z])
SLANG="-slang $SLANG -subfont-autoscale 2";
;;
[0-9])
SLANG="-sid $SLANG -subfont-autoscale 2";
;;
*[sS][rR][tT])
cp -a "$($DDK cellText Playlist $IN 14)/$SLANG" /tmp/subcmp@pid.srt;
SLANG="-utf8 -sub /tmp/subcmp@pid.srt -subfont-autoscale 2";
;;
*)
SLANG='';
;;
esac;
case "$FNAME" in
*.[wW][mM][vV] | *.[mM][kK][vV] | *.[fF][lL][vV] | *.[oO][gG][mM] | *.[rR][mM][vV] | *.[rR][mM][vV][bB] | *.[rR][pP][mM])
$MPL -vf $EXPAND:0,harddup "$FILE" $SLANG 2>/dev/null;
;;
*.[mM][pP][eE][gG] | *.[mM][pP][gG4] | *.[aA][vV][iI] | *.[vV][oO][bB])
$MPL -vf $EXPAND:0,harddup "$FILE" $ALANG $SLANG 2>/dev/null;
;;
*)
case "$FNAME" in *.[iI][sS][oO]) FILE="$ENDR/$FNAME"; ;; *) FILE="$ENDR"; ;; esac;
TLE="$(lsdvd "$FILE" 2>/dev/null | awk '/Longest track:/{ print $3 }')";
$MPL dvd://"$TLE" -dvd-device "$FILE" -vf $EXPAND:0,harddup $ALANG $SLANG 2>/dev/null;
;;
esac
enall true;
fi
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Reproduz e previzualiza o arquivo escolhido.(F10)</string>
</property>
</widget>
<widget class="ExecButton" row="2" column="14">
<property name="name">
<cstring>adiciona2</cstring>
</property>
<property name="minimumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>40</width>
<height>40</height>
</size>
</property>
<property name="focusPolicy">
<enum>NoFocus</enum>
</property>
<property name="text">
<string></string>
</property>
<property name="accel">
<number>4151</number>
</property>
<property name="iconSet">
<iconset>image5</iconset>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
DDK="dcop @dcopid KommanderIf";
SCT="setCellText";
PL="Playlist";
enall(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enall false;
FILES="$(kdialog --getexistingdirectory "$HOME")";
TITLE="$(lsdvd -q "$FILES" | awk '/Longest track:/{ print $3 }')";
if [ -n "$FILES" -a -n "$TITLE" ]; then
n="$($DDK rowCount $PL)"; [ ! -n "$n" ] && n="0";
DISC_TITLE="$(echo "$FILES" | awk -F'/' '{ print $NF }')";
$DDK insertRow $PL $n 1;
$DDK $SCT $PL $n 0 "$DISC_TITLE";
V="$(du -s -h -k "$FILES" | awk '{ print $1 }')";
$DDK $SCT $PL $n 1 "$V";
$DDK $SCT $PL $n 14 "$FILES";
DISC_TITLE="$(lsdvd -q "$FILES" | awk '/Disc.*Title:/{for (i=3;i<=NF;i++) { print $i }}')";
ID_FILE="$(mplayer dvd://$TITLE -dvd-device "$FILES" -vo null -ao null -endpos 0 -identify 2>/dev/null 2>&1 | awk '/ID_AUDIO|ID_VIDEO|ID_DEMUXER|ID_LENGTH|ID_AID_.*_LANG/')";
ID_DVD_AUDIO="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Audio.*Language/{ print $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 " " $1 $2 "_" $4 "_" $5 "_" $7 "_" $9 }')";
ID_DVD_SUBS="$(lsdvd -q -x -t$TITLE "$FILES" | tr -d ':,-' | awk '/Subtitle.*Language/{ print $1 $2 "_" $4 "_" $5 " " $1 $2 "_" $4 "_" $5 }')";
declare -t $ID_FILE;
c=0; for n in $ID_DVD_AUDIO; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_AUDIO="$(kdialog --menu "Linguagens encontradas:" $ID_DVD_AUDIO | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 11 "$(echo $ID_DVD_AUDIO | awk '{ print $2 }')";
ID_AUDIO_CODEC="$(echo $ID_DVD_AUDIO | awk '{ print $4 }')";
ID_AUDIO_RATE="$(echo $ID_DVD_AUDIO | awk '{ print $5 }')";
c=0; for n in $ID_DVD_SUBS; do c="$[c+1]"; done;
if [ "$[c/2]" != "1" ]; then ID_DVD_SUBS="$(kdialog --menu "Legendas encontradas:" nenhum nenhum $ID_DVD_SUBS | tr '_' ' ')"; fi;
$DDK $SCT $PL $n 12 "$(echo $ID_DVD_SUBS | awk '{ print $2 }')";
$DDK $SCT $PL $n 2 "$ID_LENGTH";
$DDK $SCT $PL $n 3 "$ID_VIDEO_WIDTH:$ID_VIDEO_HEIGHT";
$DDK $SCT $PL $n 4 "$ID_VIDEO_FPS";
$DDK $SCT $PL $n 5 "$ID_VIDEO_ASPECT";
$DDK $SCT $PL $n 6 "$ID_VIDEO_CODEC";
$DDK $SCT $PL $n 7 "$[ID_VIDEO_BITRATE/1000]";
$DDK $SCT $PL $n 8 "$ID_AUDIO_CODEC";
$DDK $SCT $PL $n 9 "$[ID_AUDIO_BITRATE/1000]";
$DDK $SCT $PL $n 10 "$ID_AUDIO_RATE";
$DDK $SCT $PL $n 13 "$DISC_TITLE";
TOTAL="$[$($DDK text total | awk '{ print $2 }')+$(echo $ID_LENGTH | cut -f1 -d.)]";
HH="$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]";
MM="$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/60]-$[$[$[TOTAL-$[TOTAL-$[$[TOTAL/60]*60]]]/3600]*60]]";
SS="$[TOTAL-$[$[TOTAL/60]*60]]";
[ "$HH" -lt "10" ] && HH="0$HH"; [ "$MM" -lt "10" ] && MM="0$MM"; [ "$SS" -lt "10" ] && SS="0$SS";
$DDK setText total "Total: $TOTAL s - $HH:$MM:$SS";
VBITS="$($DDK text vbit | tr -d ':[alpha]:')";
ABITS="$($DDK text abit | tr -d ':[alpha]:')";
SIZE="$(echo "scale=2; ${TOTAL}*$[VBITS]/8+${TOTAL}*2*$[ABITS]/13" | bc -l)";
$DDK setText size "Estimado: $(echo "scale=2; ${SIZE}/1024" | bc -l )MB";
enall true;
fi;
enall true;
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Inserir uma pasta contendo um dvd na lista.(F8)</string>
</property>
</widget>
<widget class="SpinBoxInt" row="8" column="3">
<property name="name">
<cstring>vbit</cstring>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>30</height>
</size>
</property>
<property name="suffix">
<string>k</string>
</property>
<property name="maxValue">
<number>9800</number>
</property>
<property name="minValue">
<number>200</number>
</property>
<property name="lineStep">
<number>10</number>
</property>
<property name="value">
<number>3000</number>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Video bit rate: Min=800, Max=9800</string>
</property>
</widget>
<widget class="ExecButton" row="8" column="11" rowspan="1" colspan="2">
<property name="name">
<cstring>convert</cstring>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>C&onverter</string>
</property>
<property name="accel">
<number>4149</number>
</property>
<property name="default">
<bool>true</bool>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="populationText">
<string></string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@Konsole6.cancel;
@Konsole6.clear;
@Konsole6.execute;
@DISPLAY.setText("PREPARANDO O INICIO DOS PROCESSOS.");
@PP_1.setText(0);
@PP_2.setText(0);
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Da inicio a convercao.(F6)</string>
</property>
</widget>
<widget class="Label" row="0" column="0" rowspan="1" colspan="15">
<property name="name">
<cstring>Label6</cstring>
</property>
<property name="text">
<string>Arquivos a serem convertidos:</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
</widget>
<widget class="ComboBox" row="8" column="1">
<property name="name">
<cstring>tela</cstring>
</property>
<property name="minimumSize">
<size>
<width>110</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>30</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Padroes de cor e tela.</string>
</property>
</widget>
<widget class="ComboBox" row="8" column="7" rowspan="1" colspan="2">
<item>
<property name="text">
<string>128</string>
</property>
</item>
<item>
<property name="text">
<string>160</string>
</property>
</item>
<item>
<property name="text">
<string>192</string>
</property>
</item>
<item>
<property name="text">
<string>224</string>
</property>
</item>
<item>
<property name="text">
<string>448</string>
</property>
</item>
<property name="name">
<cstring>abit</cstring>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>30</height>
</size>
</property>
<property name="editable">
<bool>true</bool>
</property>
<property name="currentItem">
<number>2</number>
</property>
<property name="populationText">
<string>@sizecalc.execute</string>
</property>
<property name="associations" stdset="0">
<stringlist>
<string></string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Audio bit rate.</string>
</property>
</widget>
<widget class="ExecButton" row="8" column="13" rowspan="1" colspan="2">
<property name="name">
<cstring>canceler</cstring>
</property>
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>&Cancelar</string>
</property>
<property name="accel">
<number>276824131</number>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>@exec("for p in `ps -A | awk '/[m]encoder/{ print $1 }'`; do if grep -q CNV@pid /proc/$p/cmdline ; then kill $p; fi; done")
@setGlobal("EXECNO", "1")
</string>
</stringlist>
</property>
<property name="toolTip" stdset="0">
<string>Cancela a execucao.(Alt+C)</string>
</property>
</widget>
<widget class="TabWidget" row="7" column="0" rowspan="1" colspan="15">
<property name="name">
<cstring>TabWidget1</cstring>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>180</height>
</size>
</property>
<property name="tabPosition">
<enum>Bottom</enum>
</property>
<property name="tabShape">
<enum>Triangular</enum>
</property>
<widget class="QWidget">
<property name="name">
<cstring>tab</cstring>
</property>
<attribute name="title">
<string>S&aidas do Shell</string>
</attribute>
<grid>
<property name="name">
<cstring>unnamed</cstring>
</property>
<property name="margin">
<number>0</number>
</property>
<property name="spacing">
<number>0</number>
</property>
<widget class="Konsole" row="0" column="0">
<property name="name">
<cstring>Konsole6</cstring>
</property>
<property name="maximumSize">
<size>
<width>32767</width>
<height>180</height>
</size>
</property>
<property name="paletteForegroundColor">
<color>
<red>0</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="associations" stdset="0">
<stringlist>
<string>#!/bin/bash
SPUMUX=`ls /usr/bin/spumux 2> /dev/null`;
MPGINFO=`ls /usr/bin/mpginfo 2> /dev/null`;
ADLAY="`echo "0.1*@adelay.text" | bc -l`";
NUM="0"
UN="0"; LIST=""; VL="0"; ST="setText"; SE="setEnabled";
DL="/tmp/dvdconvert-@pid.log"; DZ="$HOME/WORKDVD/dvdconvert1-@pid"; EXDA="/tmp/dvdauthor-@pid.sh";
M1="TODOS OS PROCESSOS CONCLUIDOS."; M2="TODOS OS PROCESSOS CANCELADOS.";
if [ "$[@steps.checked]" == "1" ]; then TWO_STEPS="1 2"; else TWO_STEPS="0"; fi
rm -f "$DL";
fcalc(){
TOTAL="$(echo "scale=$2; $1" | bc -l)";
[ "$2" != "0" ] && echo $TOTAL || echo $TOTAL | cut -d. -f1;
}
result(){
if [ "$2" == "0" ]; then
echo "[Concluido]";
echo -e "Gerando capitulos ... \t \c";
CHAP="$(make_chap 1)";
echo "<vob file=\"${FOT}.mpg\" chapters=\"$CHAP\" pause=\"0\" />" >> ${DZ}.xml;
MSEND="$M1";
echo "[ok]";
else
echo "[Parado]";
$DDK cancel Timer1;
MSEND="$M2";
enable_all true;
$DDK $SE canceler false;
$DDK $ST DISPLAY "$MSEND";
$DDK $ST PP_1 0;
$DDK $ST PP_2 0;
rm -f ${DZ}.xml 2>&1 &>$DL;
rm -f /tmp/*@pid.* 2>/dev/null;
echo "Pra mais informacoes, veja: $DL";
break;
fi;
CHAP="$(make_chap $1)";
}
make_chap(){
CP=0; SP=0;
case $1 in
1)
TC="$($DDK cellText $PL $IN 2)";
NC="$(fcalc "$TC/300" 0)";
RC="$(fcalc "$TC/$NC" 3)";
for ((LC=1;LC<=$(($NC-1));LC++)); do TA="$(fcalc "$RC*$LC" 3)"; CP="$CP $TA"; done
;;
2)
C="$(lsdvd -qx -t"$TLE" "$FILE" 2>/dev/null | awk '/Chapter:.*Length:/{ print $4 }' | tr -d ',')";
for d in $C; do SP="$SP+$(echo $d | awk -F: '{ print $1 "*3600+" $2 "*60+" $3 }')"; TA="$(fcalc "$SP" 3)"; CP="$CP $TA"; done;
;;
esac
echo $CP | tr ' ' ',' | sed 's/,,/,/g';
}
mkdvd(){
mkdir -p "$HOME/WORKDVD/" 2>&1 &>$DL;
case $1 in
1)
echo -e "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<dvdauthor>\n<vmgm>\n<fpc>subtitle=65; jump title 1;</fpc>\n</vmgm>\n<titleset>\n<titles>\n<audio samplerate=\"48khz\" format=\"$ACOD\" />\n<video resolution=\"${HF2}x${VF2}\" format=\"$TYPE\" />\n<pgc>" > ${DZ}.xml;
;;
2)
echo -e '<post>call vmgm menu 1;</post>\n</pgc>\n</titles>\n</titleset>\n</dvdauthor>' >> ${DZ}.xml;
;;
3)
if [ -e "/usr/bin/dvdauthor" ]; then
$DDK setGlobal L1 "B $($DDK text PP_2)";
$DDK execute Timer1;
echo -e "Gerando DVD em $HOME/WORKDVD ... \t \c";
$EXDA -o "$HOME/WORKDVD/DVD@pid/" -x "${DZ}.xml" 2>&1 &>$DL;
[ "$?" == "0" ] && echo "[Concluido]" || echo "[Parado]";
$DDK cancel Timer1;
else
echo "Pacote dvdauthor nao encontrado.";
fi
;;
esac
}
addsubs(){
if [ "$1" == "0" ]; then
if [ "@titles.checked" == "1" -a -n "$SPUMUX" ]; then
echo -e "1\n00:00:02,800 --> 00:00:11,801\n$TITLE\n" | tr '_' ' ' > /tmp/subtitle@pid.srt;
echo "<subpictures><stream><textsub filename=\"/tmp/subtitle@pid.srt\" characterset=\"UTF-8\" fontsize=\"25.0\" font=\"Georgia_Bold_Italic.ttf\" horizontal-alignment=\"center\" vertical-alignment=\"top\" top-margin=\"30\" subtitle-fps=\"25\" movie-width=\"$HF2\" movie-height=\"$VF2\" /></stream></subpictures>" > /tmp/spuxml@pid.xml;
spumux -s 0 -m dvd "/tmp/spuxml@pid.xml" < "${FOT}.mpg" > /tmp/videofinal@pid.mpg 2>/dev/null;
mv "/tmp/videofinal@pid.mpg" "${FOT}.mpg" 2>/dev/null 2>&1 &>$DL;
rm -f /tmp/spuxml@pid.xml /tmp/subtitle@pid.srt 2>/dev/null 2>&1 &>$DL;
fi
if [ -e "/tmp/subcmp@pid.srt" ]; then
echo "<subpictures><stream><textsub filename=\"/tmp/subcmp@pid.srt\" characterset=\"UTF-8\" fontsize=\"25.0\" font=\"Georgia_Bold_Italic.ttf\" horizontal-alignment=\"center\" vertical-alignment=\"top\" top-margin=\"30\" subtitle-fps=\"25\" movie-width=\"$HF2\" movie-height=\"$VF2\" /></stream></subpictures>" > /tmp/spuxml@pid.xml;
spumux -s 0 -m dvd "/tmp/spuxml@pid.xml" < "${FOT}.mpg" > /tmp/videofinal@pid.mpg 2>/dev/null;
mv "/tmp/videofinal@pid.mpg" "${FOT}.mpg" 2>/dev/null 2>&1 &>$DL;
rm -f /tmp/spuxml@pid.xml /tmp/subcmp@pid.srt 2>/dev/null 2>&1 &>$DL;
fi
fi
}
matroska_packer(){
if [ "$END" == "0" ]; then
echo "[Concluido]";
echo -e "Empacotando matroska ... \t \c";
/usr/bin/ffmpeg -i "/tmp/video_tmp@pid.avi" -vcodec copy -acodec copy -f matroska "$1" 2>/dev/null 2>&1 &>$DL;
if [ "$?" == "0" ]; then
echo "[Concluido]";
else
echo "[Erro ou cancelado]";
break;
fi
else
echo "[Erro ou cancelado]";
break;
fi
}
export LPOINT="0";
DDK="dcop @dcopid KommanderIf";
PL="Playlist";
SL="selection";
$DDK $SE canceler true;
enable_all(){
for m in GB{0,1,2,3,4,5,6,7,8} convert adiciona adiciona2 adiciona3 $PL play remove tela vbit abit; do
$DDK $SE $m $1;
done
}
enable_all false;
while : ; do NAME="$($DDK cellText $PL $UN 0)"; [ ! -n "$NAME" ] && break; UN=$[UN+1]; done;
$DDK $ST PP_1 0;
$DDK $ST PP_2 0;
$DDK setMaximum PP_1 100;
$DDK setMaximum PP_2 $[100*UN];
ABIT="$($DDK $SL abit)";
VBIT="$($DDK text vbit)";
TYPE="$($DDK $SL tela | awk '{ print $1 }'| tr [:upper:] [:lower:])";
case $TYPE in
ntsc*|pal*)
VF2="$($DDK selection tela | awk '{ print $2 }' | cut -dx -f2)";
HF2="$($DDK selection tela | awk '{ print $2 }' | cut -dx -f1)";
;;
*)
VF2="$($DDK selection tela | cut -dx -f2)";
HF2="$($DDK selection tela | cut -dx -f1)";
;;
esac
SRATE="48000";
if [ "$TYPE" == "ntsc" ]; then
KEY="18"; FPS="30000/1001";
if [ "$HF2:$VF2" == "720:480" -o "$HF2:$VF2" == "704:480" ]; then
VCOD="mpeg2video"; ACOD="ac3"; CH="-channels 6"; ILACE=":ilme:ildct";
else
VCOD="mpeg1video"; ACOD="mp2"; CH="-channels 2"; ILACE="";
fi;
else
KEY="15"; FPS="25";
if [ "$HF2:$VF2" == "720:576" -o "$HF2:$VF2" == "704:576" ]; then
VCOD="mpeg2video"; ACOD="ac3"; CH="-channels 6"; ILACE=":ilme:ildct";
else
VCOD="mpeg1video"; ACOD="mp2"; CH="-channels 2"; ILACE="";
fi;
fi
echo "$[UN] arquivos postos para convercao.";
if [ "$[UN]" != "0" ]; then
mkdvd 1;
for ((IN=0;IN<$[UN];IN++)); do
APC="$($DDK cellText $PL $IN 5)";
VF1="$($DDK cellText $PL $IN 3 | cut -d: -f2)";
HF1="$($DDK cellText $PL $IN 3 | cut -d: -f1)";
NV="$(fcalc "$HF2/$APC" 0)";
$DDK setGlobal L2 "0";
if [ "@wide.checked" == "0" -a "@fill.checked" == "0" ] || [ "@wide.checked" == "1" -a "@fill.checked" == "1" ]; then
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then ASP="16/9"; else ASP="4/3"; fi;
EXPAND="expand=$HF1:::::$ASP,scale=$HF2:$VF2";
elif [ "@wide.checked" == "1" -a "@fill.checked" == "0" ]; then
ASP="16/9";
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then
EXPAND="expand=$HF1:::::$ASP,scale=$HF2:$VF2";
else
VF="$(fcalc "9*$HF1/16" 0)";
EXPAND="crop=$HF1:$VF,scale=$HF2:$VF2";
fi;
elif [ "@wide.checked" == "0" -a "@fill.checked" == "1" ]; then
ASP="4/3";
if [ "$NV" -lt "405" -o "$NV" == "405" ]; then
EXPAND="expand=$HF1:::::$ASP,scale=$HF2:$VF2";
else
VF="$(fcalc "3*$HF1/4" 0)";
EXPAND="crop=$HF1:$VF,scale=$HF2:$VF2";
fi;
fi
ENDR="$($DDK cellText Playlist $IN 14)";
TITLE="$($DDK cellText Playlist $IN 13)";
FNAME="$($DDK cellText Playlist $IN 0)";
FILE="$ENDR/$FNAME";
ALANG="$($DDK cellText $PL $IN 11)";
case $ALANG in
[a-z][a-z])
ALANG=" -alang $ALANG";
;;
[0-9])
ALANG=" -aid $ALANG";
;;
*)
ALANG="";
;;
esac
SLANG="$($DDK cellText Playlist $IN 12)";
case $SLANG in
[a-z][a-z])
SLANG="-slang $SLANG -subfont-autoscale 2";
;;
[0-9])
SLANG="-sid $SLANG -subfont-autoscale 2";
;;
*srt)
cp -a "$($DDK cellText Playlist $IN 14)/$SLANG" /tmp/subcmp@pid.srt;
if [ -n "$SPUMUX" ]; then
SLANG="";
SFILE="/tmp/subcmp@pid.srt"
else
SLANG="-utf8 -sub /tmp/subcmp@pid.srt -subfont-autoscale 2";
fi
;;
*ass)
cp -a "$($DDK cellText Playlist $IN 14)/$SLANG" /tmp/subcmp@pid.ass;
if [ -n "$SPUMUX" ]; then
SLANG="";
SFILE="/tmp/subcmp@pid.ass"
else
SLANG="-utf8 -sub /tmp/subcmp@pid.ass -subfont-autoscale 2";
fi
;;
*)
SLANG="";
;;
esac;
MP3F="";
if [ "@audioonly.checked" == "1" ]; then
MP3F="$($DDK cellText $PL $IN 14)/$($DDK cellText $PL $IN 13).mp3";
FOT="/tmp/videofile@pid.avi";
PARAM2="-of avi";
PARAM3="mp3lame -lameopts vbr=2:br=128:mode=1 -af resample=44100,volume=4";
PARAM0="copy";
PARAM1="";
elif [ "@h264.checked" == "1" ]; then
EXPAND="";
PARAM0="x264 -x264encopts bitrate=$[VBIT]:turbo:subq=6:threads=4";
if [ "@fill.checked" == "1" -a "@wide.checked" == "0" ]; then EXPAND=",expand=720:::::4/3 -force-avi-aspect 4/3";
elif [ "@fill.checked" == "0" -a "@wide.checked" == "1" ]; then EXPAND=",crop=720:406 -force-avi-aspect 16/9"; fi
PARAM1="-vf pp=linblenddeint,scale=$HF2:-2,harddup$EXPAND";
PARAM2="-of avi";
PARAM3="mp3lame -lameopts vbr=2:br=128:mode=1 -af resample=44100,volume=4";
FPS="24";
FOT="$($DDK cellText $PL $IN 14)/$($DDK cellText $PL $IN 13)_CNV@pid";
elif [ "@XVID.checked" == "1" ]; then
EXPAND="";
PARAM0="xvid -xvidencopts bitrate=$[VBIT]:turbo:threads=4";
if [ "@fill.checked" == "1" -a "@wide.checked" == "0" ]; then EXPAND=",expand=720:::::4/3 -force-avi-aspect 4/3";
elif [ "@fill.checked" == "0" -a "@wide.checked" == "1" ]; then EXPAND=",crop=720:406 -force-avi-aspect 16/9"; fi
PARAM1="-vf pp=linblenddeint,scale=$HF2:-2,harddup$EXPAND";
PARAM2="-of avi";
PARAM3="mp3lame -lameopts vbr=2:br=128:mode=1 -af resample=44100,volume=4";
FPS="24";
FOT="$($DDK cellText $PL $IN 14)/$($DDK cellText $PL $IN 13)_CNV@pid";
else
PARAM2="-of mpeg -mpegopts format=dvd:tsaf";
FOT="$($DDK cellText $PL $IN 14)/$($DDK cellText $PL $IN 13)_CNV@pid";
[ @high.checked == 1 ] && HQ=":trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp:mv0:vqmin=1:lmin=1:dc=10";
if [ @onlycopy.checked == 1 ]; then
PARAM3="copy";
PARAM0="copy";
PARAM1="";
else
PARAM3="lavc";
PARAM0="lavc";
PARAM1="-vf pp=linblenddeint,$EXPAND:0,harddup -srate $SRATE $CH -af resample=$SRATE,volnorm,volume=4,lavcresample=$SRATE -lavcopts vcodec=$VCOD$ILACE:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=$VBIT:keyint=$KEY$HQ:turbo:vstrict=0:acodec=$ACOD:abitrate=$ABIT:aspect=$ASP";
fi
fi
EXMP="mencoder -noautosub -idx -audio-delay $ADLAY -oac $PARAM3 -ovc $PARAM0$VP_PARAM $PARAM2 $PARAM1 -ofps $FPS -o";
EXDA="dvdauthor";
$DDK setGlobal L1 "A $($DDK text PP_2)";
$DDK execute Timer1;
if [ "@h264.checked" == "1" ]; then
case "$FILE" in
*.[wW][mM][vV] | *.[rR][mM][vV] | *.[rR][mM][vV][bB] | *.[rR][pP][mM] | *.[fF][lL][vV] | *.[oO][gG][mM])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="/tmp/video_tmp@pid.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="/tmp/video_tmp@pid.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" -aid 0 -subfont-autoscale 2 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
matroska_packer "${FOT}.mkv";
;;
*.[mM][pP][eE][gG] | *.[mM][pP][gG4] | *.[aA][vV][iI] | *.[vV][oO][bB])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="/tmp/video_tmp@pid.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="/tmp/video_tmp@pid.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" $ALANG $SLANG 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
matroska_packer "${FOT}.mkv";
;;
*.[mM][kK][vV])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="/tmp/video_tmp@pid.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="/tmp/video_tmp@pid.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" -sid 0 -subfont-autoscale 2 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
matroska_packer "${FOT}.mkv";
;;
*)
case "$FNAME" in
*.[iI][sS][oO])
FILE="$ENDR/$FNAME";
;;
*)
mkdir -p $HOME/WORKDVD/ 2>/dev/null;
FILE="$ENDR";
FOT="$HOME/WORKDVD/${FNAME}_CNV@pid";
;;
esac;
TLE="$(lsdvd "$FILE" 2>/dev/null | awk '/Longest track:/{ print $3 }')";
if [ "@wide.checked" == "0" -a "@fill.checked" == "0" ]; then
DVDNCROP="$(mplayer -ss 100 -endpos 1 -vo null -ao null -vf cropdetect dvd://"$TLE" -dvd-device "$FILE" 2>/dev/null 2>&1 | tr -d '().' | awk '/Crop area/{ print $(NF-1) " " $NF }' | sort | uniq)";
fi
if [ "@chaponly.checked" == "1" ]; then
mkdir -p "$HOME/WORKDVD/${FNAME}/" 2>/dev/null;
endc=""; oldc=""; ON="1";
for c in `chaplin -d "$FILE" -t "$TLE" -c 2>/dev/null | awk '/chapter.*begin:/{ print $4 }'`; do
if [ -n "$oldc" ]; then
echo -e "Convertendo: $FILE [$TITLE] Chapter: $ON ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="/tmp/video_tmp@pid.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="/tmp/video_tmp@pid.avi"; fi; fi
$EXMP "$OU_PARAM" dvd://"$TLE" -dvd-device "$FILE" $ALANG $DVDNCROP -ss $oldc -endpos `echo "$c-$oldc" | bc -l` 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
matroska_packer "$HOME/WORKDVD/${FNAME}/${FNAME}_CNV@pid$(echo $[10000+ON] | cut -c2-).mkv";
ON="$[ON+1]";
fi
oldc="$c";
done
else
echo -e "Convertendo: $FILE [$TITLE] ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="/tmp/video_tmp@pid.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="/tmp/video_tmp@pid.avi"; fi; fi
$EXMP "$OU_PARAM" dvd://"$TLE" -dvd-device "$FILE" $ALANG $DVDNCROP 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
matroska_packer "${FOT}.mkv";
fi
;;
esac
elif [ "@XVID.checked" == "1" ]; then
case "$FILE" in
*.[wW][mM][vV] | *.[rR][mM][vV] | *.[rR][mM][vV][bB] | *.[rR][pP][mM] | *.[fF][lL][vV] | *.[oO][gG][mM])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="${FOT}.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="${FOT}.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" $ALANG $SLANG 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
if [ "$END" == "0" ]; then echo "[Concluido]"; else echo "[Parado]"; $DDK cancel Timer1; break; fi;
;;
*.[mM][pP][eE][gG] | *.[mM][pP][gG4] | *.[aA][vV][iI] | *.[vV][oO][bB])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="${FOT}.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="${FOT}.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" $ALANG $SLANG 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
if [ "$END" == "0" ]; then echo "[Concluido]"; else echo "[Parado]"; $DDK cancel Timer1; break; fi;
;;
*.[mM][kK][vV])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="${FOT}.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="${FOT}.avi"; fi; fi
$EXMP "$OU_PARAM" "$FILE" -sid 0 -subfont-autoscale 2 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
if [ "$END" == "0" ]; then echo "[Concluido]"; else echo "[Parado]"; $DDK cancel Timer1; break; fi;
;;
*)
case "$FNAME" in
*.[iI][sS][oO])
FILE="$ENDR/$FNAME";
;;
*)
mkdir -p $HOME/WORKDVD/ 2>/dev/null;
FILE="$ENDR";
FOT="$HOME/WORKDVD/${FNAME}_CNV@pid";
;;
esac;
TLE="$(lsdvd "$FILE" 2>/dev/null | awk '/Longest track:/{ print $3 }')";
if [ "@wide.checked" == "0" -a "@fill.checked" == "0" ]; then
DVDNCROP="$(mplayer -ss 100 -endpos 1 -vo null -ao null -vf cropdetect dvd://"$TLE" -dvd-device "$FILE" 2>/dev/null 2>&1 | tr -d '().' | awk '/Crop area/{ print $(NF-1) " " $NF }' | sort | uniq)";
fi
if [ "@chaponly.checked" == "1" ]; then
mkdir -p "$HOME/WORKDVD/${FNAME}/" 2>/dev/null;
endc=""; oldc=""; ON="1";
for c in `chaplin -d "$FILE" -t "$TLE" -c 2>/dev/null | awk '/chapter.*begin:/{ print $4 }'`; do
if [ -n "$oldc" ]; then
echo -e "Convertendo: $FILE [$TITLE] Chapter: $ON ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="$HOME/WORKDVD/${FNAME}/${FNAME}_CNV@pid$(echo $[10000+ON] | cut -c2-).avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="$HOME/WORKDVD/${FNAME}/${FNAME}_CNV@pid$(echo $[10000+ON] | cut -c2-).avi"; fi; fi
$EXMP "$OU_PARAM" dvd://"$TLE" -dvd-device "$FILE" $ALANG $DVDNCROP -ss $oldc -endpos `echo "$c-$oldc" | bc -l` 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
ON="$[ON+1]";
if [ "$END" == "0" ]; then echo "[Concluido]"; else echo "[Parado]"; $DDK cancel Timer1; break; fi;
fi
oldc="$c";
done
else
echo -e "Convertendo: $FILE [$TITLE] ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="${FOT}.avi";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="${FOT}.avi"; fi; fi
$EXMP "$OU_PARAM" dvd://"$TLE" -dvd-device "$FILE" $ALANG $DVDNCROP 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
if [ "$END" == "0" ]; then echo "[Concluido]"; else echo "[Parado]"; $DDK cancel Timer1; break; fi;
fi
;;
esac
else
case "$FILE" in
*.[wW][mM][vV] | *.[rR][mM][vV] | *.[rR][mM][vV][bB] | *.[rR][pP][mM] | *.[fF][lL][vV] | *.[oO][gG][mM])
echo -e "Convertendo: $FILE ... \t \c";
for n in $TWO_STEPS; do
if [ "$[n]" == "0" ]; then VP_PARAM=""; OU_PARAM="${FOT}.mpg";
else echo -e "Pass $[n]...\t\c"; VP_PARAM=":vpass=$[n]"; if [ "$[n]" == "1" ]; then OU_PARAM="/dev/null"; else OU_PARAM="${FOT}.mpg"; fi; fi
$EXMP "$OU_PARAM" "$FILE" $SLANG 2>/dev/null 2>&1 &>$DL;
END="$?";
[ "$END" != "0" ] && break; [ "$END" == "0" -a "$[n]" != "0" ] && $DDK setGlobal L2 "$($DDK text PP_1)";
done
result 1 $END;
if [ "$?" == "0" ]; then
if [ "@titles.checked" == "1" -a -n "$SPUMUX" -a ! -n "$MP3F" ]; then
e
POSTFIX AUTOMÁTICO COM MYSQL E IPTABLES - APAGANDO MSG ANTIGAS DA MBOX - TODOS OS USUARIOS
rc.mailMyIp - Informa seu IP externo para o Gmail
Script de busca (google em shell)
Ferramenta para o CBQ - parte 1
PDC Samba + LDAP no Debian Lenny
Nenhum comentário foi encontrado.
Como extrair chaves TOTP 2FA a partir de QRCODE (Google Authenticator)
Linux em 2025: Segurança prática para o usuário
Desktop Linux em alta: novos apps, distros e privacidade marcam o sábado
IA chega ao desktop e impulsiona produtividade no mundo Linux
Novos apps de produtividade, avanços em IA e distros em ebulição agitam o universo Linux
Digitando underscore com "shift" + "barra de espaços"
Como ativar a lixeira e recuperar aquivos deletados em um servidor Linux
Como mudar o nome de dispositivos Bluetooth via linha de comando
esqueci a senha do boot do notebook dell vostro 3300 (0)
PIP3 - erro ao instalar módulo do mariadb para o Python (7)
estou na 22.1 e não é atualizado pra 22.4 via "sudo full-upgrade&... (2)









