Visualizzazione post con etichetta Command Line. Mostra tutti i post
Visualizzazione post con etichetta Command Line. Mostra tutti i post

lunedì 31 agosto 2009

Geniale!

Quante cose si possono fare con uno scriptino in bash.....

Se solo mi fosse venuto in mente....

mercoledì 13 maggio 2009

Appunti di command line: spazio disco

Elenco ordinato dei file > 1G

df -h ; echo 'Sopra 1G:' ; du -h | egrep '^[0-9.]*G' | sort -k1 -g

Elenco ordinato dei file > 10G

df -h ; echo 'Sopra 10G:' ; du -h | egrep '^[0-9]{2,}*G' | sort -k1 -g

Appunti di command line: Date

- ora:
$ date
Wed Oct 8 16:20:15 CEST 2008

- dalla data al timestamp:
$ date +%s --date="01 Jan 2004 12:00 am"
1072911600

- dal timestamp alla data:
$date -d @1072911600
Thu Jan 1 00:00:00 CET 2004

- scelgo il formato
$ date "+%Y-%m-%d" -d @1072911600
2004-01-01

venerdì 10 aprile 2009

Appunti di command line: Media

Un'altro quaderno di appunti per technosfiammati...

Registrare uno streaming su file

1- esempio di url dello stream: mms://192.168.0.1/trullallero
2- file di destinazione: test.avi

mplayer -dumpstream -dumpfile test.avi mms://192.168.0.1/trullallero

Convertire AVI in MPEG usando MEncoder

To change MEncoder's output file format, use the -of mpeg option.

Example:

mencoder input.avi -of mpeg -ovc lavc -lavcopts vcodec=mpeg1video \
-oac copy other_options -o output.mpg

Creating an MPEG-1 file suitable to be played on systems with minimal multimedia support, such as default Windows installs:

mencoder input.avi -of mpeg -mpegopts format=mpeg1:tsaf:muxrate=2000 \
-o output.mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vbitrate=1152:keyint=15:mbd=2:aspect=4/3

Same, but using libavformat MPEG muxer:

mencoder input.avi -o VCD.mpg -ofps 25 -vf scale=352:288,harddup -of lavf \
-lavfopts format=mpg -oac lavc -lavcopts acodec=mp2:abitrate=224 -ovc lavc \
-lavcopts vcodec=mpeg1video:vrc_buf_size=327:keyint=15:vrc_maxrate=1152:vbitrate=1152:vmax_b_frames=0

Convertire file MP3 in WAV

Il comando da usare per convertire il singolo file e':

$ lame --decode file.mp3

Se si vogliono convertire tutti di una dir

$ ls | sed -e "s/'/\\\'/g; s/(/\\\(/g; s/)/\\\)/g; s/ /\\\ /g" | awk '{print "lame --decode "$0;}'

Nota: il `sed -e "s/'/\\\'/g; s/(/\\\(/g; s/)/\\\)/g; s/ /\\\ /g"` aggiunge un backslash agli spazi, ai singoli apici ed alle ().
Esempio:
$ echo te\)s\'t.txt
$ te)s't.txt

$ echo te\)s\'t.txt | sed -e "s/'/\\\'/g; s/(/\\\(/g; s/)/\\\)/g; s/ /\\\ /g"
$ te\)s\'t.txt

Se invece tutti i file si chiamano senza apici o cose strane, basta:
$ ls | awk '{print "lame --decode "$0;}'

Altra nota: preferisco farmi dare l'output e poi fare copia incolla, almeno controllo.