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.

Nessun commento: