1
I found a shell-script and modified it to meet my need and stayed like this:
#!/bin/bash
[ "$1" ] && cd "$1"
ls -1 *.TS
[ "$?" -ne 0 ] && echo 'Sem arquivos TS nesse diretório' && exit 0
for ARQUIVO in $(ls -1 *.TS)
do
ARQ_DESTINO="${ARQUIVO%%.TS}.avi"
echo "Convertendo $ARQUIVO para $ARQ_DESTINO"
ffmpeg -i "$ARQUIVO" -vcodec libxvid -b 2000k \
-acodec libmp3lame -ac 2 -ar 44100 -ab 128k "$ARQ_DESTINO"
done
Only I don’t know how to make this script enter the subdirectories and take each file .ts
and convert to .avi
, in this case up there it only does in the directory in which the script is.
How can I do with this script to do this process?
Stayed like this:
#!/bin/bash
[ "$1" ] && cd "$1"
find . -name "*.TS" | while read -r ARQUIVO; 
do
 ARQ_DESTINO="${ARQUIVO%%.TS}.avi"
 echo "Convertendo $ARQUIVO para $ARQ_DESTINO"
 ffmpeg -i "$ARQUIVO" -vcodec libxvid -b 2000k \
 -acodec libmp3lame -ac 2 -ar 44100 -ab 128k "$ARQ_DESTINO"
done
. Mais did not work on execution. I think my code has some error only can. Returns this error:Enter command: <target>|all <time>|-1 <command>[ <argument>]
Parse error, at least 3 arguments were expected, only 1 given in string
– JB_
@JB_ On the line of
ffmpeg
add at the end< /dev/null
, for example:ffmpeg ... -ab 128k "$ARQ_DESTINO" < /dev/null
– stderr
Very good, worked. Fixed the problem. < /dev/null was the final solution. Thanks.
– JB_