♫♪♫♪ ╔╦╦╦═╦╗╔═╦═╦══╦═╗ ♫♪♫♪♫♪ ♫♪♫♪ ║║║║╩╣╚╣═╣║║║║║╩╣ ♫♪♫♪♫♪ ♫♪♫♪ ╚══╩═╩═╩═╩═╩╩╩╩═╝ ♫♪♫♪♫♪
This is a list of my short command line tips to get some various, sometimes advanced, functions on GNU/Linux systems, especially on Debian.
rename more than 1 file
rename 's/\_wav_/\_/g' *.pdf rename 's/\./\_/g' *.pdf; rename 's/\_pdf/\.pdf/' *
replace a string in a file:
sed -ie 's/old/new/' *.txt sed -i -e 's/cellar/deefuzz/g' deefuzz_cellar_mp3_234.xml
find and remove:
find ./ -iname "*.pyc" -exec rm {} \; find . -name ".svn" -type d -exec rm -rf {} \; find . -name 'test*' -mtime +30 -type f -print0 |xargs -0 rm -f sudo find . -mtime +480 -exec rm {} \;
find and copy some files:
find -iname *.pdf -exec cp \{\} /data/pellerin/castem/pdf/ \;
find and link some files:
find /data/these/simuls/ -iname *.pdf > pdf.log -exec ln -s {} \; find /home/momo/data/these/simuls/castax_isov_pdf/t02/* -iname *.pdf -exec ln -s {} \;
_:
for i in ./*; do cd $i; rename 's/\./\_/g' *; cd ..; done for i in ./*; do cd $i; rename 's/\_pdf/\.pdf/' *; cd ..; done
_:
#isof=( 46_1 25_1 ) #isof=( 35 55 107 191 ) isof=( p_ c_ r_ vy_ vx_ tr_ hv_ hx_ hy_ ) #isof=( paxe vaxe iaxe v_sor p_sor p_ent v_ent t_par pp00 pp05 pp10 pp12 vp00 vp10 residus v_col p_col tpar ppar q- ) nf=${#isof[*]} for (( j = 0; j <= ($nf - 1); j++ )); do if [ ! -d ${isof[$j]} ]; then mkdir ${isof[$j]} fi mv *${isof[$j]}* ${isof[$j]} done
_:
sudo chmod -R 664 *; sudo chmod -R +rX *
_:
lgrind -i -lmatlab ttt.m > ttt.tex lgrind -i -lf ttt.dgibi > ttt.tex
_:
convmv -r --notest -f iso-8859-1 -t UTF-8 *
_:
expand -t4 acpi.py > acpi2.py
_:
mogrify -format pbm *.png for i in *.pbm; do ocrad --charset=iso-8859-15 -o $i.txt $i; done
_:
for i in *.wav; do sox $i -s -w $i.wav; mv $i.wav converted/$i; done sox Jano_B-Homosapiens.mp3 -r 44100 -b 16 -s -t wav - | flac - -o Jano_B-Homosapiens.flac
_:
convert -density 150x150 telecaster_video01.eps telecaster_video01.png for i in `ls *.eps`; do convert -density 200x200 $i $i.png; done
_:
gcc -Wall -o random rand2.c gcc -Wall recapture.c -o recapture -ljack -lpthread -lrt -lsndfile
_:
sudo hdparm -c1 -d1 -a256 -u1 /dev/hdc
_:
dvdbackup -F -n DVD_TITLE -i/dev/dvd -o/home/karine/video/dvd/
_:
sudo apt-get install beagle; beagled --fg --debug best
_:
umount -l /dev/cdrom
_:
rar a -m0 -v100000 CellarMixLive_050615_mp3.rar CellarMixLive_050615_mp3.wav rar a -m3 -v15000 Ce llarMixLive_050615_mp3.rar CellarMixLive_050615_mp3.wav
Remote:
ssh -R 2222:localhost:22 parisson.com
ecasound -a:1 -i foo1.wav -a:2 -i foo2.wav -o jack_alsa cat f*.wav | ecasound -i stdin -o concat.wav
Le dᅵpᅵt maᅵtre de chez debian
wget http://ftp-master.debian.org/ziyi_key_2006.asc -O - | sudo apt-key add -
gpg --keyserver hkp://wwwkeys.eu.pgp.net --recv-keys 1F41B907 gpg --armor --export 1F41B907 | sudo apt-key add -
wget http://volatile.debian.net/ziyi-2005.asc -O - | sudo apt-key add -
echo "deb http://debian.parisson.org binary/" | sudo tee -a /etc/apt/sources.list
_:
dt=10 prog1="psextract.sh" prog2="/home/pellerin/castax/bin/psextract.sh /data/pellerin/castem/t02 8 /home/pellerin/castax_res/castax_isov_pdf/t02" while [ ! -z `pgrep $prog1` ]; do sleep $dt date echo "waiting for $prog1 to finish..." done && echo "$prog1 finished, launching $prog2" $prog2
root pass: sudo /usr/bin/mysqladmin -u root password 'washnc.....'
mysql> create database forum; mysql> GRANT ALL PRIVILEGES ON forum.* TO 'moderateur'@localhost mysql> identified by 'mot_de_passe_du_moderateur';
The following will create a database named "intranet".
mysqladmin -p create intranet
Next, create the database user account that will be used to access the database.
mysql -p --user=root intranet
mysql> GRANT ALL PRIVILEGES ON . TO intranet@localhost IDENTIFIED BY 'webcal01' WITH GRANT OPTION; mysql> FLUSH PRIVILEGES; mysql> QUIT
If you will be accessing MySQL from a different machine than the one running the web server, repeat the command above and replace 'localhost' with the hostname of the other machine.
Create the calendar tables using the supplied tables-mysql.sql file:
mysql -p intranet < tables-mysql.sql
In the above example, "intranet" is the name of your database.
Alternativement, sur toutes les plate-formes, vous pouvez aussi choisir le nouveau mot de passe en utilisant le client mysql :
Stoppez et redᅵmarrez mysqld avec l'option --skip-grant-tables comme dᅵcrit plus haut.
Connectez vous au serveur mysqld avec :
shell> mysql -u root mysql
Exᅵcutez la commande suivante dans le client mysql :
- mysql> UPDATE user SET Password=PASSWORD('nouveaumotdepasse')
-> WHERE User='root';
mysql> FLUSH PRIVILEGES;
Aprᅵs cela, vous devriez pouvoir vous connecter avec le nouveau mot de passe.
_:
ls -1 | grep .png > image_list.txt transcode -i image_list.txt -x imlist,null -g 720x480 --use_rgb -z -y ffmpeg,null -F mpeg4 -o test1.avi -H 0 -f 29.97 transcode -z -M 2 -x v4l,v4l -i /dev/video0 --import_v4l 0,38 -p /dev/dsp -y xvid -o test.avi -w 1500 -e 32000 -E 44100 -b 96 -s 7 -c 0-250 -g 360x288 -j 0,4 ffmpeg -i video.mp4 -vn -acodec pcm_s16le -ar 44100 -ac 1 bleriot11.wav ffmpeg -ss 80 -t 10 -i test_xvid.avi -f flv -vcodec flv -vb 500k -ab 96k -ar 44100 -y test.flv
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2
patch:
diff -uprN linux-2.6.15 linux-2.6.15-rt1 > patch-2.6.15-rt1-1 patch -p0 linux-2.6.15 > patch-2.6.15-rt1-1 api linux-source-2.... cd /usr/src/linux/
ou:
bzip2 -dc /usr/src/patch-2.6.31.4-rt14.bz2 | patch -p1 --dry-run
If you didn’t get any errors (which you shouldn’t) then do: bzip2 -dc /usr/src/patch-2.6.31.4-rt14.bz2 | patch -p1
Now the kernel source is patched with the real time preemption code by Ingo Molnar.
Next is the M-Audio USB Fast Track Pro patch: patch -p1 /usr/src/linux/sound/usb/usbaudio.c < /usr/src/usbaudio-ftp-2.6.31.4.patch
MT : export CONCURRENCY_LEVEL=4
Then run the following commands (please note that make dep is not needed any more for kernel 2.6):
make-kpkg clean fakeroot make-kpkg --revision=custom.1.0 --append-to-version=rt9.yomguy --initrd kernel_image kernel_headers modules_image
ou:
fakeroot make-kpkg --append-to-version=.rt8-yomguy --initrd kernel_image kernel_headers modules_image
ou:
fakeroot make-kpkg --initrd --append-to-version=-yomguy kernel_image kernel_headers
If the compilation stops with an error, run:
make clean
and then re-run the previous commands starting with:
make menuconfig
Change the kernel configuration where the error occurs. If no error occurs you will find the new kernel as a Debian package called kernel-image-2.6.8.1_custom.1.0_i386.deb under /usr/src:
cd ../
Now you have to install some packages that are needed by kernel 2.6. Add the following line to /etc/apt/sources.list:
deb http://www.backports.org/debian/ woody module-init-tools initrd-tools procps
Then run:
apt-get update apt-get install module-init-tools initrd-tools procps
If you are asked the following question: "If you really want to remove modutils type 'yes':" type yes.
It might also be necessary to update packages like bind9, quota, etc. - depending on your configuration. If you have problems with your existing packages try to get the appropriate package from www.backports.org. Install your new kernel:
dpkg -i kernel-image-2.6.8.1_custom.1.0_i386.deb
OPTION:
Create a ramdisk of your new kernel (otherwise your system will most likely not boot):
cd /boot/ mkinitrd -o /boot/initrd.img-2.6.8.1 2.6.8.1
LILO:
We are almost finished now. Edit the image=/vmlinuz stanza of your /etc/lilo.conf and add the line initrd=/boot/initrd.img-2.6.8.1:
### # Boot up Linux by default. # default=Linux # image=/vmlinuz label=Linux read-only initrd=/boot/initrd.img-2.6.8.1 # restricted # alias=1 ###
Run:
lilo
to update your boot loader and reboot your machine:
shutdown -r now
and if everything is ok your machine should come up with the new kernel. You can run:
uname -a
www.linuxjournal.com/article/8400
!! home user dir MUST be 770 !!
_:
sudo su gpg --keyserver hkp://keyring.debian.org --recv-keys F1D53D8C4F368D5D gpg --armor --export 010908312D230C5F | apt-key add -
_:
wget http://ftp-master.debian.org/ziyi_key_2006.asc
Avoir une partition avec de la place, par exemple /mnt/mirror (~20 Go):
# apt-get install debmirror
Pour creer / mettre a jour le miroir (pour les 3 distribs, par exemple) : $ debmirror /mnt/mirror --arch=i386 --dist=woody,sarge,sid -h ftp.fr.debian.org --nosource --verbose --progress Ensuite, dans /etc/apt/sources.list : deb file:/mnt/mirror sid main non-free contrib Et ᅵvidemment faire un apt-get update pour mettre ᅵ jour.
kismet airsnort aircrack wmwave wpasupplicant kwirelessmonitor macchanger swscanner wavemon wireless-tools wifi-radar iwconfig iwlist
api python2.3-zodb
Backup: python2.3 repozo.py -Bzv -r /nfs/place/where/backup/files/go -f /path/to/Data.fs
Recover python2.3 repozo.py -Rv -r /nfs/place/where/backup/files/go -o /path/to/Data.fs
ou
Backup:/home/momo/data/tmp/test sudo python2.3 /usr/lib/zope2.8/bin/repozo.py -Bzv -r /home/momo/backups/parisson_zope -f /var/lib/zope2.8/instance/parisson.com/var/Data.fs sudo python2.3 /usr/lib/zope2.7/bin/repozo.py -Bzv -r /home/momo/backups/ev/plone/ -f /var/lib/zope2.7/instance/plone_EV/var/Data.fs
Recover: sudo python2.3 /usr/lib/zope2.8/bin/repozo.py -Rvz -r /home/momo/backups/parisson_zope -o /var/lib/zope2.8/instance/parisson.com/var/Data.fs sudo python2.3 /usr/lib/zope2.7/bin/repozo.py -Rvz -r /home/momo/backups/ev/plone -o /var/lib/zope2.7/instance/plone_EV/var/Data.fs
SHELL
svn co http://svn.plone.org/svn/collective/dotipython/trunk/ipy_profile_zope.py . sudo su zope ./bin/zopectl shell ipython2.4 -p zope
>> for id,val in obj.objectItems(): ... try: val.getId() ... except POSKeyError: break
# "id" should now contain the id with the broken object.
>> obj.manage_delObjects(id) >> get_transaction().commit()
# The second line is necessary to save your change.
>> obj.manage_addUserFolder('acl_users') >> get_transaction().commit()
If you needed to re-create a bad DTMLMethod, it would be something like:
>> obj.manage_addDTMLMethod('method_id') >> get_transaction().commit()
_:
easy_install -U ZopeSkel paster create --list-templates paster create -t plone3_buildout myproject cd myproject python bootstrap.py ./bin/buildout vi buildout.cfg ./bin/instance fg
_:
sudo modprobe ov511 sudo modprobe ovcamchip
_:
encfs /path/.test /path/test (chmod 4755 /usr/bin/fusermount) sudo mount -a fusermount -u /path/test
_:
api realtime-lsm-source sudo module-assistant sudo modprobe realtime gid=29
_:
sudo /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl -update \ -config=/etc/awstats/awstats.conf \ -dir=/var/www/pypix.com/stats/ \ -awstatsprog=/usr/lib/cgi-bin/awstats.pl
_:
#header { background: url(/images/main_header_bg.gif) repeat-x 0 0; line-height: 0.8;}
song_format = $TRACK - $ARTIST - $ALBUM - $SONGNAME [ $GENRE - $LENGTH / $SIZE ] $NEW
_:
nvidia-installer --uninstall apt-get install xserver-xorg-dev
ou:
./nvidia***.run --x-module-path=/usr/lib/xorg/modules/
http://wiki.debian.org/NvidiaHowTo http://www.nvnews.net/vbulletin/showthread.php?t=75175 ftp://download.nvidia.com/
_:: sox file00.wav -r 7200 file.wav wavtopvf file.wav | pvftormd Rockwell 4 > standard.rmd
_:
ls -1 | wc -l
_:
sudo /usr/bin/flumotion-worker -D --daemonize-to /var/cache/flumotion -n default /etc/flumotion/workers/default.xml
_:
db2html -o html telemeta.sgml
_:
epstopdf sch_thev_1.ps pdfcrop --margins '5 10 5 20' --clip sch_thev_1.pdf sch_thev_1.pdf
_:
diff -urNp ./ /home/momo/zope2.9/pre-barreau/Products/PloneTranslations/i18n/ > /home/momo/backups/pre-barreau/i18n.patch
Exemple 10.6. openAnything
def openAnything(source): 1 # try to open with urllib (if source is http, ftp, or file URL) import urllib try: return urllib.urlopen(source) 2 except (IOError, OSError): pass # try to open with native open function (if source is pathname) try: return open(source) 3 except (IOError, OSError): pass # treat source as string import StringIO return StringIO.StringIO(str(source)) 4
_:
fakeroot make-jpkg jre-1_5_0_11-linux-i586.bin update-alternatives --config java
python manage.py syncdb python manage.py sql telemeta sqlite3 test.db .list .schema
ALTER TABLE "table_name" [alter specification]
[alter specification] is dependent on the type of alteration we wish to perform. For the uses cited above, the [alter specification] statements are:
- Add a column: ADD "column 1" "data type for column 1"
- Drop a column: DROP "column 1"
- Change a column name: CHANGE "old column name" "new column name" "data type for new column name"
- Change the data type for a column: MODIFY "column 1" "new data type"
_:
ps2epsi sch_exam_ex1.ps
_:
oggdec -o - test.ogg | lame -V 6 - test.mp3
_:
sudo apt-get install apache2 php5 mysql-server postfix icecast2 zope2.9 libapache2-mod-php5 arno-iptables-firewall python htop munin munin-node fail2ban python-imaging python-zodb
_:
sudo /usr/sbin/ab -n 1000000 -c 100 http://www.redevanceculturelle.net/
_:
yafc domain.com:/home get -rp *
_:
sudo airodump-ng --write yomix.cap --channel 9 eth1 sudo airodump-ng --write yomix.cap --bssid 00:14:A5:8B:AF:0A --channel 9 eth1 sudo aireplay-ng -3 -e yomix -a 00:0C:F1:3B:3D:B5 -b 00:0C:F1:3B:3D:B5 -h 00:0C:F1:3B:3D:B5 eth1 sudo aircrack-ng -z yomix.cap
_:
chroot ./ mount -t proc none /proc
_:
sudo openssl genrsa -out privkey.pem 2048 sudo openssl req -new -key privkey.pem -config /etc/ssl/openssl.cnf -days 3650 -out cert.csr cp server.key server.key.org openssl rsa -in server.key.org -out server.key
Mov to Flv
Pour passer du format .mov ᅵ .flv il suffit d'utiliser cette commande:
mencoder nom_de_la_video_encoder.mov -ofps 15 -ovc lavc -lavcopts vcodec=flv:acodec=mp3 -vop scale=largeur:hauteur -ffourcc FLV1 -oac mp3lame -o nom_de_sortie_de_la_video.flv
(Note : Expliquer l'utilitᅵ de -ofps xx) N'oublier pas de modifier la commande avec vos valeur de hauteur et de largeur .
Mkv to Avi Pour passer du format .mkv ᅵ .avi , il existe deux commande possible via mencoder:
mencoder nom_du_fichier.mkv -ovc copy -oac copy -o nom_du_fichier.avi for fichier in `ls *.mkv`; do mencoder $fichier -ovc copy -oac copy -o $fichier.avi; done mencoder -oac mp3lame -lameopts cbr=128 -ovc xvid -xvidencopts bitrate=900 nom_du_fichier.mkv -o nom_du_fichier_final.avi
_:
sudo apt-get install gettext cvs autotools-dev libxml2-dev libwxgtk2.6-dev wx-common libsoundtouch1-dev libsndfile1-dev libsamplerate0-dev dssi-dev libflac++-dev libvorbis-dev libasound2-dev export LD_LIBRARY_PATH=/usr/local/lib
RESET PASS Deep:/opt/webapps/invisible bruce$ ./manage.py shell Python 2.5 (r25:51918, Sep 19 2006, 08:49:13) Type "copyright", "credits" or "license" for more information.
IPython 0.7.2 -- An enhanced Interactive Python. ? -> Introduction to IPython's features. %magic -> Information about IPython's 'magic' % functions. help -> Python's own help system. object? -> Details about 'object'. ?object also works, ?? prints more.
In [1]: from django.contrib.auth.models import User
In [2]: users = User.objects.all()
In [3]: users Out[3]: [<User: admin>]
In [4]: users[0].set_password('whatever');
In [5]: users[0].save()
_:
svn propdel svn:executable mp3player.swf svn merge -r 119:head http://svn.parisson.org/svn/deefuzzer/trunk/ svn merge -r174:175 trunk/ tags/telecaster-0.4.0+rc1/ svn propedit svn:externals . deefuzzer http://svn.parisson.org/svn/deefuzzer/trunk
_:
diff -Naur olddir newdir > new-patch
MGE UPS SYSTEMS distributes the PSP package for Debian GNU/Linux through the APT method.
To install Personal Solution Pac on Debian or Ubuntu, add the following line in the "/etc/apt/sources.list"
- deb http://opensource.mgeups.com/stable/debian binary/
Then, type the following commands, in a console as root:
- apt-get update
- apt-get install mgeups-psp
Note that you can also use the graphical method through Synaptic, Adept, Kynaptic and Kpackage.
Launch Personal Solution Pac from the menu "System" and enter the root password when prompted.
_:
ffmpeg2theora -f avi -x 320 -y 240 --deinterlace -v 4 -a -1 -o test.ogg video.avi dvgrab --format raw - | ffmpeg2theora -f dv -x 320 -y 240 --deinterlace -v 4 -a -1 -o /dev/stdout | oggfwd yourserver yourport yourpass /yourmountpoint.ogg sudo dvgrab - | vlc --no-sub-autodetect-file - :demux=rawdv ":sout=#transcode{vcodec=mp4v,vb=256,scale=1,deinterlace}:duplicate{dst=display,dst=std{access=http,mux=ts,dst=:1234}}" dvgrab -buffers 1 - | ffmpeg -f dv -i - -f jack -i ffmpeg -vcodec libtheora -b 400k -s 768x480 -aspect 16:9 -acodec libvorbis -ab 64000 -f ogg - -map 0.0 -map 1.0 | oggfwd -d "pb_video_live" -g "Teaching" -n "pb_video_live" localhost 8000 source2parisson /pb_video_live.ogg & sleep 3 jack_connect jack_rack:out_1 ffmpeg:input_1 jack_connect jack_rack:out_2 ffmpeg:input_2
cinelerra dvd-slideshow dvdrip libmjpegtools0 libquicktimehv mandvd mjpegtools ogmrip-mpeg pytube subtitleripper transcode
file:///home/momo/doc/python/diveintopython-5.4/html/regular_expressions/summary.html
- ^ reconnaᅵt le dᅵbut d'une chaᅵne.
- $ reconnaᅵt la fin d'une chaᅵne.
- b reconnaᅵt la limite d'un mot.
- d reconnaᅵt un chiffre.
- D reconnaᅵt un caractᅵre non-numᅵrique.
- x? reconnaᅵt un caractᅵre x optionnel (autrement dit, il reconnaᅵt un x zᅵro ou une fois).
- x* reconnaᅵt zᅵro ou plus x.
- x+ reconnaᅵt un ou plusieurs x.
- x{n,m} reconnaᅵt un caractᅵre x au moins n fois, mais pas plus de m fois.
- (a|b|c) reconnaᅵt soit a soit b soit c.
- en gᅵnᅵral est un groupe identifiᅵ. Vous pouvez obtenir la valeur de ce qui a ᅵtᅵ reconnu ᅵ l'aide de la mᅵthode groups() de l'objet retournᅵ par re.search.
/boot | 300 MB |
/ 20 GB /home 136.7 GB swap 3 GB
SSD on /dev/sda:
root 10 Go XFS BOOTABLE home 35 Go XFS data 15 Go XFS
USB Disk on /dev/sdb:
root 5 Go XFS home 10 Go XFS
Master machine system /dev/sda to USB external Ghost /dev/sdb (Check hdparm / sdparm before):
su mkdir /mnt/root mount /dev/sdb1 /mnt/root mount /dev/sdb2 /mnt/root/home rsync -a --delete --one-file-system / /mnt/root/ rsync -a --delete /home/ /mnt/root/home/ sync umount /mnt/root/home umount /mnt/root
Live Install ISO on USB Disk /dev/sdb BOOT
Ghost on USB Disk /dev/sdc
Destination SSD /dev/sda:
(AUTO) su mkdir /mnt/root mount /dev/sda1 /mnt/root mount /dev/sda2 /mnt/root/home mount /dev/sdc1 /mnt/ghost_root mount /dev/sdc2 /mnt/ghost_home rsync -a /mnt/ghost_root/ /mnt/root/ rsync -a /mnt/ghost_home/ /mnt/root/home/ sync umount /mnt/ghost_root/ umount /mnt/ghost_home/ mount -o bind /dev /mnt/root/dev mount -t proc none /mnt/root/proc chroot /mnt/root/ ls /dev/disk/by-uuid
quit
http://linux.derkeiler.com/Mailing-Lists/Debian/2008-05/msg01890.html
keep your packages:
sudo dpkg --get-selections > packages.txt sudo dpkg --set-selections < packages.txt sudo apt-get dselect-upgrade
libxine1-ffmpeg
python2.4 pil zodb elementree iw.fss ?
_:
rsync -ra --update sudo rsync -a --include="*/" --include="*/Maildir/*" --exclude="*" /home/ root@jimi.parisson.com:/home/tmp/
_:
sdparm --command=ready /dev/sdc # check ready state sdparm --command=start /dev/sdc # start a sleeping disk sdparm --command=stop /dev/sdc # put a disk in standby sdparm -al -f /dev/sdc # list all known mode flags sdparm -6 -p po --clear=STANDBY /dev/sdc # turn off standby feature sdparm -6 -p po --defaults /dev/sdc # establish it again
Tetherbot tunnel:
./adb forward tcp:4444 localabstract:Tunnel android create avd -n my_android1.5 -t 2 emulator -avd my_android1.5
Running Scripts Externally
Start python terminal:
$ adb forward tcp:4321 tcp:<AP_PORT> $ export AP_PORT=4321 $ python2.6 Python 2.6 Type "help", "copyright", "credits" or "license" for more information. >>> import android # The ASE android.py module should be on your sys.path. >>> droid = android.Android() >>> droid.makeToast("Hello from my computer!") >>> droid.speak('Hello')
_:
sh cnxtinstall.run -- --tty pppd call free
Convert a video to MP4 compatible with Android / Iphone:
ffmpeg -i inputfilename.ext -aspect 3:2 -s 480x320 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -sameq -pass 1 outputfilename.mp4 Here is the command for a 4:3 aspect ratio video. ffmpeg -i inputfilename.ext -aspect 3:2 -s 400x300 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -padtop 10 -padbottom 10 -padleft 40 -padright 40 -sameq -pass 1 outputfilename.mp4 And here is the command for a 16:9 aspect ratio video. ffmpeg -i inputfilename.ext -aspect 3:2 -s 480x270 -vcodec h264 -b 480k -r 23.976 -acodec aac -ab 96k -padtop 24 -padbottom 26 -sameq -pass 1 outputfilename.mp4
Extracting all frames from a video file is easily achieved with FFmpeg.
Here's a simple command line that will create 25 PNG images from every second of footage in the input DV file. The images will be saved in the current directory.:
ffmpeg -i input.dv -r 25 -f image2 images%05d.png
The newly created files will all start with the word "images" and be numbered consecutively, including five pre-appended zeros. e.g. images000001.png.
From a video that was 104 seconds long, for a random example, this command would create 2600 PNG files! Quite messy in the current directory, so instead use this command to save the files in a sub-directory called extracted_images:
ffmpeg -i input.dv -r 25 -f image2 extracted_images/images%05d.png
Moving on, let's say you just wanted 25 frames from the first 1 second, then this line will work:
ffmpeg -i input.dv -r 25 -t 00:00:01 -f image2 images%05d.png
The -t flag in FFmpeg specifies the length of time to transcode. This can either be in whole seconds or hh:mm:ss format.
Making things a little more complex we can create images from all frames, beginning at the tenth second, and continuing for 5 seconds, with this line:
ffmpeg -i input.dv -r 25 -ss 00:00:10 -t 00:00:05 -f image2 images%05d.png
The -ss flag is used to denote start position, again in whole seconds or hh:mm:ss format.
Maybe extracting an image from every single frame in a video, resulting in a large number of output files, is not what you need. Here's how to create a single indicative poster frame, of the video clip, from the first second of footage:
ffmpeg -i input.dv -r 1 -t 00:00:01 -f image2 images%05d.png
Notice that the -r flag is now set to 1.
If you want the poster frame from a different part of the clip, then specify which second to take it from using the -ss tag, in conjunction with the line above.
Lastly, if you wanted to create a thumbnail story board, showing action throughout the entire length of the video clip, you'll need to specify the output image dimensions. Use the following line:
ffmpeg -i input.dv -r 1 -f image2 -s 120x96 images%05d.png
My original file was 720x576, so the image dimensions are a whole division of this.
reStructured text to HTML:
rst2html -stg tips.txt tips.html rst2s5 --theme medium-black tips.txt tips.html rst2html -stg --stylesheet="lsr.css" --traceback tips.txt tips.html
apply the same wav file for all items (mysql):
update media_items set filename = 'items/test.wav';
merge multiple dirs
funionfs -o dirs=1001:mama -o allow_other NONE media
user_pref("network.protocol-handler.app.http", "/usr/bin/google-chrome"); user_pref("network.protocol-handler.app.https", "/usr/bin/google-chrome");
postqueue -p postcat -q 9DF7520804A
c:ping 192.168.0.2 c:arp -a
Xorg -configure Xorg -config xorg.conf.new
$ cd /var/cache/git/
$ mkdir project.git
$ cd project.git
$ git init
$ echo "Short project's description" > .git/description
$ git config --global user.name "Your Name"
$ git config --global user.email "you@example.com"
$ git commit -a
$ git push upload master
sudo swapoff -a && sudo swapon -a
Jackd, performances and harddisks
2010.11.30 So you have your sample loading working in a separate thread to your realtime audio code and the interface i/o communication is also tucked away in it’s own thread. You have a lock free mechanism for communicating between all threads and still, sometimes – when loading data from disk jackd chucks your program off for blocking – usually during a live performance, and you have to fumble around restarting the audio server. What’s going on?
Well, it turns out that when your hard drive goes to sleep, the spin up resulting from a disk access request (such as mid-performance sample loading) can cause the kernel to block, which causes jackd to panic and either stop entirely or detach your client. This is even with jackd running with the –nozombies switch, so it must be the watchdog thread at work.
The solution is simply to prevent your drive spinning down when you are performing, by adding “hdparm -S 0 /dev/yourharddisk” to your live audio startup script. Thanks to ClaudiusMaximus for helping me fix this at Piksel – it’s been bothering me for ages.
Categories : howto slub