13 changed files with 802 additions and 15 deletions
@ -0,0 +1,141 @@
@@ -0,0 +1,141 @@
|
||||
\chapter{Musical Instrument Digital Interface} |
||||
\label{MIDI} \index{MIDI} |
||||
|
||||
Dans un premier temps, je vais me concentrer sur les |
||||
services \textsc{midi} offerts par la couche ALSA d'un |
||||
système Linux. |
||||
Ensuite, |
||||
nous passerons aux |
||||
\textit{raw devices} (page \pageref{midi:raw}). |
||||
|
||||
% --------------------------------------------------------- |
||||
\section{Outils de base} |
||||
|
||||
\subsection{aseqdump} |
||||
\index{aseqdump} |
||||
|
||||
Cet outil permet de voir de façon relativement claire |
||||
\textbf{tous} les évènements \textsc{midi} qui rentre |
||||
par un chemin donné, et, en première étape, |
||||
surtout de lister ces chemins. |
||||
|
||||
\begin{verbatim} |
||||
tth@plop:~/Muzak/Samples$ aseqdump -l |
||||
Port Client name Port name |
||||
0:0 System Timer |
||||
0:1 System Announce |
||||
14:0 Midi Through Midi Through Port-0 |
||||
\end{verbatim} |
||||
|
||||
|
||||
|
||||
\subsection{aconnect} |
||||
|
||||
Maintenant que nous savons ce qui rentre dans notre machine, |
||||
il est temps de savoir comment le faire ressortir. Il faut |
||||
donc créer une connexion quelque part au tréfond des tables |
||||
obscures de la kernelle. |
||||
|
||||
% --------------------------------------------------------- |
||||
\section{ALSA tips} |
||||
\index{ALSA} |
||||
|
||||
\textbf{cat /proc/asound/seq/clients} |
||||
\begin{verbatim} |
||||
Client info |
||||
cur clients : 4 |
||||
peak clients : 4 |
||||
max clients : 192 |
||||
|
||||
Client 0 : "System" [Kernel] |
||||
Port 0 : "Timer" (Rwe-) |
||||
Port 1 : "Announce" (R-e-) |
||||
Connecting To: 15:0 |
||||
Client 14 : "Midi Through" [Kernel] |
||||
Port 0 : "Midi Through Port-0" (RWe-) |
||||
Client 15 : "OSS sequencer" [Kernel] |
||||
Port 0 : "Receiver" (-we-) |
||||
Connected From: 0:1 |
||||
Client 128 : "TiMidity" [User] |
||||
Port 0 : "TiMidity port 0" (-We-) |
||||
Port 1 : "TiMidity port 1" (-We-) |
||||
Port 2 : "TiMidity port 2" (-We-) |
||||
Port 3 : "TiMidity port 3" (-We-) |
||||
Output pool : |
||||
Pool size : 500 |
||||
Cells in use : 0 |
||||
Peak cells in use : 0 |
||||
Alloc success : 0 |
||||
Alloc failures : 0 |
||||
Input pool : |
||||
Pool size : 1000 |
||||
Cells in use : 0 |
||||
Peak cells in use : 0 |
||||
Alloc success : 0 |
||||
Alloc failures : 0 |
||||
\end{verbatim} |
||||
|
||||
|
||||
% --------------------------------------------------------- |
||||
\section{Raw devices} |
||||
\label{midi:raw} |
||||
|
||||
Plutôt que de passer par la couche ALSA, il est aussi possible |
||||
d'attaquer directement le \textit{device}, et de blaster soi-même |
||||
tous les petits octets directement sur le fil. Voici un petit |
||||
exemple en Python\footnote{Oui, je sais, c'est un langage de djeunz, |
||||
mais bon, ça fait plaisir à mon gamin}, facilement transposable |
||||
dans un langage plus sérieux : |
||||
|
||||
|
||||
\begin{lstlisting}[language=python] |
||||
#!/usr/bin/env python |
||||
|
||||
import time |
||||
|
||||
def note_on(note): |
||||
tx.write("%c%c%c" % (0x90, note, 100)) |
||||
tx.flush() |
||||
def note_off(note): |
||||
tx.write("%c%c%c" % (0x90, note, 0)) |
||||
tx.flush() |
||||
def progchange(prog): |
||||
tx.write("%c%c" % (0xc0, prog)) |
||||
tx.flush() |
||||
|
||||
tx = open("/dev/midi", "w") |
||||
for valeur in range(30,90): |
||||
progchange(valeur) |
||||
note_on(valeur) |
||||
time.sleep(1) |
||||
note_off(valeur) |
||||
time.sleep(1) |
||||
|
||||
tx.close() |
||||
\end{lstlisting} |
||||
|
||||
|
||||
% --------------------------------------------------------- |
||||
|
||||
\section{Et en Perl ?} |
||||
\index{Perl} |
||||
|
||||
En Perl\footnote{Oui, je sais, c'est un langage de vieux, |
||||
mais bon, il faut bien se faire plaisir de temps en temps\dots}, |
||||
il existe un certain nombre de modules très évolués pour |
||||
jouer avec les fichiers MIDI, ce qui est un domaine légèrement |
||||
différent, il faut le reconnaitre. |
||||
|
||||
\begin{verbatim} |
||||
MIDI (3pm) - read, compose, modify, and write MIDI files |
||||
MIDI::Event (3pm) - MIDI events |
||||
MIDI::Filespec (3pm) - MIDI File Specification |
||||
MIDI::Opus (3pm) - functions and methods for MIDI opuses |
||||
MIDI::Score (3pm) - MIDI scores |
||||
MIDI::Simple (3pm) - procedural/OOP interface for MIDI composition |
||||
MIDI::Track (3pm) - functions and methods for MIDI tracks |
||||
\end{verbatim} |
||||
|
||||
|
||||
% --------------------------------------------------------- |
||||
|
@ -0,0 +1,102 @@
@@ -0,0 +1,102 @@
|
||||
\chapter{X11} |
||||
\label{X11} |
||||
|
||||
%------------------------------------------------------------------- |
||||
\section{Les fontes} |
||||
|
||||
Comment fait-on pour connaitre la liste des polices installées ? |
||||
|
||||
\begin{verbatim} |
||||
$ fc-list | awk -F ":" '{print $1}' | sort -u |
||||
\end{verbatim} |
||||
|
||||
Comment faire pour visualiser la plénitude des formes de mes fontes ? |
||||
|
||||
|
||||
%------------------------------------------------------------------- |
||||
\section{Xephyr} |
||||
|
||||
|
||||
D'après la manpage : |
||||
\textit{Xephyr is a kdrive server that outputs to a window on a pre-existing |
||||
"host" X display. Think Xnest but with support for modern |
||||
extensions like composite, damage and randr.} |
||||
|
||||
Ça semble attirant à première vue, mais l'utilisation n'est pas |
||||
si simple qua ça. |
||||
Par exemple, quelle est la méthode à mettre en œuvre pour avoir |
||||
le clavier en Azerty\index{azerty} ? |
||||
|
||||
|
||||
%------------------------------------------------------------------- |
||||
\section{Numlock} |
||||
|
||||
|
||||
\begin{verbatim} |
||||
#include <X11/XKBlib.h> |
||||
#include <X11/extensions/XKB.h> |
||||
#include <X11/keysym.h> |
||||
int main(){ |
||||
Display *disp = XOpenDisplay (NULL); |
||||
if(disp == NULL) return 1; |
||||
unsigned int nl_mask = XkbKeysymToModifiers \ |
||||
(disp, XK_Num_Lock); |
||||
XkbLockModifiers (disp, XkbUseCoreKbd, nl_mask, nl_mask); |
||||
XCloseDisplay (disp); |
||||
return 0;} |
||||
\end{verbatim} |
||||
|
||||
%------------------------------------------------------------------- |
||||
% new 20 décembre 2012 à Mixart-Myrys |
||||
\section{xdotool} |
||||
\index{xdotool} |
||||
|
||||
D'après la manpage : |
||||
\textit{ |
||||
xdotool lets you programatically (or manually) simulate keyboard input |
||||
and mouse activity, move and resize windows, etc. It does this using |
||||
X11's XTEST extension and other Xlib functions. |
||||
} |
||||
|
||||
En gros, et pour faire simple, avec ce logiciel, |
||||
vous pouvez piloter des |
||||
applications X11, à la manière d'un wm, et ce, à partir de |
||||
la ligne de commande. |
||||
|
||||
Vous pourrez les déplacer, les redimensionner, leur envoyer des |
||||
évènements clavier, tout ce genre de choses. Il est donc possible |
||||
de coder «~des sortes d'animations~» uniquement basées sur le |
||||
protocole de X11. \textsl{Big win, bro !} |
||||
|
||||
La démarche d'utilisation n'étant pas immédiate, nous allons |
||||
commencer par un petit exemple : déplacer un Xlogo sur l'écran. |
||||
La première étape est le lancement de la cible en arrière-plan. |
||||
La seconde est la récupération de l'indentifiant |
||||
(interne à X11) de la fenêtre concernée. |
||||
|
||||
\begin{verbatim} |
||||
$ xlogo & |
||||
[3] 2674 |
||||
$ WIN=$(xdotool search -name xlogo) |
||||
$ echo $WIN |
||||
69206019 |
||||
$ |
||||
\end{verbatim} |
||||
|
||||
Voilà\footnote{en français dans le texte}, nous savons maintenant |
||||
à quelle fenêtre causer : par son numéro. |
||||
Le problême des multiples fenêtres du |
||||
même nom sera abordé ultérieurement. |
||||
Déplaçons donc notre widget\dots |
||||
|
||||
\begin{verbatim} |
||||
$ xdotool windowmove $WIN 10 10 |
||||
$ |
||||
\end{verbatim} |
||||
|
||||
C'est simple, non ? |
||||
|
||||
|
||||
|
||||
%------------------------------------------------------------------- |
||||
|
@ -0,0 +1,51 @@
@@ -0,0 +1,51 @@
|
||||
% |
||||
% nouveau 27 septembre 2020 |
||||
% |
||||
\chapter{Gnuplot} |
||||
\index{Gnuplot}\label{chap:Gnuplot} |
||||
|
||||
\section{Exemple : le phytotron} |
||||
\index{phytotron} |
||||
|
||||
|
||||
\begin{verbatim} |
||||
#!/bin/bash |
||||
|
||||
# THIS IS A KLUDGE |
||||
|
||||
nbsamp=3000 # nombre d'echantillon |
||||
|
||||
if [ $# -eq 1 ]; then |
||||
nbsamp=$1 |
||||
fi |
||||
|
||||
DATAFILE="serial/foo.dat" |
||||
IMAGE="graphe.png" |
||||
TMPFILE="/dev/shm/tmpdata" |
||||
|
||||
echo $nbsamp |
||||
wc -l ${DATAFILE} |
||||
|
||||
tail -${nbsamp} < ${DATAFILE} > ${TMPFILE} |
||||
|
||||
gnuplot << __EOC__ |
||||
set term png size 1600,800 |
||||
set output "${IMAGE}" |
||||
set ytics 2 |
||||
set xtics |
||||
set grid front |
||||
set title "* Temperatures du Phytotron *" |
||||
set xdata time |
||||
set timefmt "%s" |
||||
set format x "%b %d\n%H:%M" |
||||
set yrange [ 10.0 : 40.0 ] |
||||
plot "${TMPFILE}" using 1:3 title " inside" with lines, \ |
||||
"${TMPFILE}" using 1:4 title "ambient" with lines |
||||
__EOC__ |
||||
|
||||
display ${IMAGE} & |
||||
\end{verbatim} |
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
\chapter{Hardware} |
||||
\label{Hardware} |
||||
|
||||
|
||||
|
||||
\section{Diagnostics} |
||||
|
||||
dmesg, lshw, lsusb, lspci\dots |
||||
|
||||
% ----------------------------------------------------------- |
||||
\section{Ports série} |
||||
\index{rs232} |
||||
|
||||
Comment détecter si un \textit{device} correspond bien |
||||
à un port série ? |
||||
|
||||
\begin{lstlisting}[language=C] |
||||
#include <stdio.h> |
||||
#include <fcntl.h> |
||||
#include <termios.h> |
||||
|
||||
#define TTY "/dev/ttyS18" |
||||
|
||||
int main(void) { |
||||
int fd = open(TTY, O_RDWR | O_NOCTTY); |
||||
if (fd < 0) { |
||||
perror("open " TTY); |
||||
return 1; |
||||
} |
||||
|
||||
struct termios tio; |
||||
if (tcgetattr(fd, &tio)) { |
||||
perror("tcgetattr " TTY); |
||||
return 1; |
||||
} |
||||
|
||||
return 0; |
||||
} |
||||
\end{lstlisting} |
||||
|
||||
|
||||
|
||||
% ----------------------------------------------------------- |
||||
|
||||
|
||||
\section{Disques durs} |
||||
|
||||
Iozone ? Bonnie ? Smart\index{smart} ? |
||||
|
||||
\section{Interface réseaux} |
||||
|
||||
On a parfois besoin de savoir dans quel état est une interface |
||||
réseau (\textsc{up}, \textsc{running} dans la sortie de ifconfig). |
||||
Parfois, je n'aime pas trop \textit{parser} celle-ci à grand |
||||
coup de \textit{regexp}\index{regexp}, en particulier dans un |
||||
contexte de type Busybox\index{busybox}. Et pour ce cas-là, je |
||||
préfère utiliser un binaire brassé à la maison, et dont voici |
||||
un fragment de source : |
||||
|
||||
|
||||
\begin{lstlisting}[language=C] |
||||
int get_if_flags(char *ifname, short *p_flags) |
||||
{ |
||||
int fd; |
||||
int retcode; |
||||
struct ifreq req; |
||||
|
||||
#if DEBUG_LEVEL |
||||
fprintf(stderr, ">>> %s \"%s\" to %p\n", \ |
||||
__func__, ifname, p_flags); |
||||
#endif |
||||
|
||||
/* Sanity check */ |
||||
if ( strlen(ifname) > (IFNAMSIZ-1) ) |
||||
{ |
||||
fprintf(stderr, "name %s to long\n", ifname); |
||||
abort(); |
||||
} |
||||
|
||||
fd = socket(PF_INET, SOCK_DGRAM, 0); |
||||
if (fd < 0) |
||||
{ |
||||
perror("socket bla..."); |
||||
return -2; |
||||
} |
||||
|
||||
/* populate the struct for the request */ |
||||
memset(&req, 0, sizeof(req)); |
||||
strcpy(req.ifr_name, ifname); |
||||
|
||||
/* do the call */ |
||||
retcode = ioctl(fd, SIOCGIFFLAGS, &req); |
||||
if (retcode < 0) |
||||
{ |
||||
perror("ioctl SIOCGIFFLAGS"); |
||||
close(fd); |
||||
return -1; |
||||
} |
||||
#if DEBUG_LEVEL |
||||
/* display the result */ |
||||
fprintf(stderr, "flags = 0x%04x\n", req.ifr_flags); |
||||
#endif |
||||
|
||||
close(fd); |
||||
|
||||
*p_flags = req.ifr_flags; |
||||
return 0; |
||||
} |
||||
\end{lstlisting} |
||||
|
||||
Hélas, je n'ai pas pu trop tester ce truc sur beaucoup de systèmes, |
||||
et je vous propose de ne pas trop lui faire confiance pour une |
||||
application critique... |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,18 @@
@@ -0,0 +1,18 @@
|
||||
\chapter{Image} |
||||
\label{chap:image} |
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
\section{ImageMagick}\index{ImageMagick} |
||||
|
||||
Attention, ça va devenir \textsl{hardu}\dots |
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
|
@ -0,0 +1,56 @@
@@ -0,0 +1,56 @@
|
||||
\chapter{Photographie} |
||||
\index{Photo} |
||||
|
||||
Voir aussi ImageMagick dans le chapitre \ref{chap:image}, |
||||
|
||||
|
||||
\section{gphoto2} |
||||
\index{gphoto2} |
||||
|
||||
Notes écrites en se basant sur la version 2.4.5 (Ubuntu 10.04), |
||||
les choses peuvent être (rarement) différentes chez vous. |
||||
L'appareil photo que j'utilise actuellement est un |
||||
Canon \textit{PowerShot A520}. |
||||
|
||||
\begin{verbatim} |
||||
gphoto2 --list-ports |
||||
gphoto2 --list-cameras |
||||
\end{verbatim} |
||||
|
||||
Deux commandes pour obtenir la description des modes de connexion |
||||
possibles, et la liste des appareils gérés. |
||||
|
||||
|
||||
\begin{verbatim} |
||||
gphoto2 --auto-detect |
||||
gphoto2 --port usb:002,002 -P |
||||
\end{verbatim} |
||||
|
||||
Détection d'un éventuel appareil connecté, puis récupération |
||||
bestiale de toutes les photos (l'option \texttt{-P} peut |
||||
être remplacée par \texttt{--get-all-files}). |
||||
|
||||
L'option \texttt{--new} permet de se limiter au |
||||
téléchargement des nouvelles photos. |
||||
|
||||
Pour les drogués de la ligne de commande, l'option \texttt{--shell} |
||||
démarre un environnement interactif, qui permet d'explorer le |
||||
contenu de votre appareil, et d'interagir avec lui. |
||||
|
||||
|
||||
Il doit exister plein d'autres tricks'n'tips, il faut juste prendre |
||||
le temps de les découvrir. |
||||
|
||||
%---------------------------------------------------------------- |
||||
|
||||
\section{ufraw} |
||||
\index{ufraw} |
||||
|
||||
Ufraw (Unidentified Flying Raw) est un convertisseur de fichier images |
||||
\textit{RAW}, c'est à dire en général les données brutes en sortie |
||||
du capteur de l'appareil photo. |
||||
|
||||
%---------------------------------------------------------------- |
||||
|
||||
|
||||
|
@ -0,0 +1,24 @@
@@ -0,0 +1,24 @@
|
||||
\chapter{Processing} |
||||
\label{chap:processing} |
||||
|
||||
Processing\index{processing} est tout particulièrement adapté à la |
||||
création plastique |
||||
et graphique interactive et au graphisme de données, mais sa simplicité |
||||
d'utilisation en fait aussi un bon support pour l'apprentissage de la |
||||
logique de la programmation pour les non-programmeurs. |
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
\section{Installation} |
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
\section{Premiers pas} |
||||
|
||||
% ------------------------------------------------------------------- |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
\chapter{ssh} |
||||
\label{ssh} |
||||
|
||||
Secure Shell. |
||||
|
||||
D'après le site \texttt{openssh.org} : |
||||
\textit{OpenSSH is a {\em free} version of the SSH\index{SSH} connectivity |
||||
tools that technical users of the Internet rely on. Users of |
||||
telnet, rlogin, and ftp\index{ftp} may not realize that their password |
||||
is transmitted across the Internet unencrypted, but it |
||||
is. OpenSSH encrypts all traffic (including passwords) to |
||||
effectively eliminate eavesdropping, connection hijacking, and |
||||
other attacks. Additionally, OpenSSH provides secure tunneling |
||||
capabilities and several authentication methods, and supports |
||||
all SSH protocol versions.} |
||||
|
||||
|
||||
|
||||
\section{sshfs} |
||||
\index{sshfs} |
||||
|
||||
D'après la manpage Linux : \textit{SSHFS (Secure SHell FileSystem) |
||||
is a file system for Linux (and other operating systems with a FUSE |
||||
implementation, such as Mac OS X or FreeBSD) capable of operating |
||||
on files on a remote computer using just a secure shell login on the |
||||
remote computer. On the local computer where the SSHFS is mounted, |
||||
the implementation makes use of the FUSE (Filesystem in Userspace) |
||||
kernel module. The practical effect of this is that the end user can |
||||
seamlessly interact with remote files being securely served over SSH |
||||
just as if they were local files on his/her computer. On the remote |
||||
computer the SFTP subsystem of SSH is used.} |
||||
|
||||
Hélas, ça ne marche pas trop bien depuis un |
||||
OpenBSD\index{OpenBSD}\footnote{OpenBSD 5.5 sur sparc64} : |
||||
|
||||
\begin{verbatim} |
||||
~ $ uname -a |
||||
OpenBSD vierge.thsf.net 5.5 GENERIC#159 sparc64 |
||||
~ $ sshfs tth@10.20.0.23:/tvbruits 23/ |
||||
fuse_mount: Permission denied |
||||
\end{verbatim} |
||||
|
||||
Grace à \texttt{<semarie>}\footnote{du Groupuscule des Contributeurs |
||||
d'Unix}\index{gcu} : pour un montage en |
||||
tant que yuser il faut deux choses : |
||||
les bons droits sur \texttt{/dev/fuse*} et un |
||||
\texttt{sysctl kern.usermount=1} bien senti. |
||||
|
||||
La semaine prochaine, nous verrons le \textit{mapping} entre les |
||||
UID\index{UID} locaux et distants. |
||||
|
||||
|
||||
|
@ -0,0 +1,76 @@
@@ -0,0 +1,76 @@
|
||||
\chapter{Formater du texte} |
||||
|
||||
Manipuler du texte, afin de le modifier, de le mettre en forme, |
||||
de le présenter de façon harmonieuse, tout le monde l'a déja |
||||
fait, avec des outils divers et variés et des résultats parfois |
||||
(ou souvent) hasardeux. |
||||
|
||||
\section{fmt et ses copains} |
||||
\index{fmt}\index{tr} |
||||
|
||||
Nous allons voir quelques outils de base, simple et efficace, |
||||
mais qui ont parfois quelques limitations. Le premier est |
||||
\texttt{fmt} qui permet de remettre en forme un texte. |
||||
|
||||
\begin{verbatim} |
||||
tth@plop:~/Ecriture/Ordinateur$ cat texte.txt |
||||
Ce morceau de texte n'est pas |
||||
bien |
||||
formaté. |
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. |
||||
Phasellus nunc sapien, porta id pellentesque at, elementum et felis. |
||||
Curabitur condimentum |
||||
ante in metus |
||||
iaculis quis congue diam commodo. |
||||
tth@plop:~/Ecriture/Ordinateur$ fmt texte.txt |
||||
Ce morceau de texte n'est pas bien formaté. |
||||
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus |
||||
nunc sapien, porta id pellentesque at, elementum et felis. Curabitur |
||||
condimentum ante in metus iaculis quis congue diam commodo. |
||||
\end{verbatim} |
||||
|
||||
%------------------------------------------------------------- |
||||
|
||||
\section{roff} |
||||
\index{roff} |
||||
|
||||
\textbf{Roff} est l'outil qui a permis à quelques hackers légendaire |
||||
de justifier auprès de leur hiérarchie le développement d'une machine |
||||
de jeu, il est donc légitime d'en parler, non ? |
||||
|
||||
Après quelques minutes d'expérimentation, un premier souci arrive. |
||||
Il semble bien que \texttt{groff} ne sache pas lire les fichiers |
||||
encodés en \textbf{utf8}\index{utf8}. Il faut donc utiliser |
||||
un hack avec \texttt{recode} en prenant bien soin d'utiliser |
||||
une redirection vers \texttt{stdin} comme ceci : |
||||
|
||||
\begin{verbatim} |
||||
< $BASENAME.txt recode utf8..latin1 | groff -Tutf8 |
||||
\end{verbatim} |
||||
|
||||
%------------------------------------------------------------- |
||||
\section{yodl} |
||||
\index{yodl} |
||||
|
||||
\begin{quote} |
||||
Yodl is a package that implements a pre-document language and tools |
||||
to process it. The idea of Yodl is that you write up a document in a |
||||
pre-language, then use the tools (e.g. yodl2html) to convert it to some |
||||
final document language. Current converters are for HTML, man, LaTeX SGML |
||||
and texinfo, a poor-man's text converter and an experimental xml converter. |
||||
\end{quote} |
||||
|
||||
%------------------------------------------------------------- |
||||
\section{zoem} |
||||
\index{zoem} |
||||
|
||||
\begin{quote} |
||||
Zoem is a language for transforming text. It supports the creation of |
||||
light-weight mark-up languages as macro packages built on top of zoem. |
||||
PUD (Portable Unix Documentation) provides two such mini-languages and |
||||
is shipped with zoem. The PUD languages are for generating manpages and |
||||
FAQ documents in both HTML and troff. |
||||
\end{quote} |
||||
|
@ -0,0 +1,108 @@
@@ -0,0 +1,108 @@
|
||||
\chapter{Vidéo} |
||||
\label{chap:video} |
||||
|
||||
|
||||
% -------------------------------------------------------------------- |
||||
|
||||
\section{mplayer} |
||||
\index{mplayer} |
||||
|
||||
Une belle grosse usinagaz... |
||||
|
||||
\texttt{mplayer tv:// -tv |
||||
driver=v4l2:width=640:height=480:fps=25:device=/dev/video0} |
||||
|
||||
\texttt{mencoder tv:// -tv driver=v4l2:width=640:height=480:fps=25:device=/dev/ |
||||
video0:forceaudio:alsa=1:adevice=default -ovc lavc -oac mp3lame -lameopts |
||||
cbr:br=64:mode=3 -o} |
||||
|
||||
Pour faire une planche contact d'une vidéo : |
||||
\texttt{mplayer -benchmark -nosound -quiet -zoom -vf scale=320:-3 -vo |
||||
jpeg:outdir=/tmp -sstep 60 monfichier.ts} |
||||
|
||||
% -------------------------------------------------------------------- |
||||
|
||||
\section{ffmpeg} |
||||
\index{ffmpeg} |
||||
|
||||
D'après certaines rumeurs des intertubes, ce serait un peu le remplaçant |
||||
de mencoder pour pas mal de trucs... |
||||
|
||||
Pour convertir une sextape prise avec un \textit{iMachin} : |
||||
|
||||
\texttt{ffmpeg -i tthsf.mov -target film-dvd sextape.mpeg} |
||||
|
||||
Extraire le son d'une vidéo Youtube : |
||||
|
||||
\texttt{ffmpeg -i myvideo.flv -f mp3 -vn -acodec copy myvideo.mp3} |
||||
|
||||
\texttt{ffmpeg -i fichiervideo.flv -vn -ar 44100 -ac 2 -f wav fichierson.wav} |
||||
|
||||
\texttt{mplayer -vo png -ss 3:46 -frames 20 stairs.mp4} |
||||
\# Write out 20 png format frames from a video starting at 3 minutes, 46 seconds. |
||||
|
||||
Tu peux générer les images de transition avec |
||||
ImageMagick\index{ImageMagick} : |
||||
\texttt{convert a.png b.png -alpha set -channel A |
||||
-evaluate set 10\% +channel |
||||
-compose src-atop -composite -alpha off out.png} |
||||
|
||||
Tu peux assez facilement insérer ça dans une boucle et piper |
||||
les images à ffmpeg : |
||||
|
||||
\begin{verbatim} |
||||
for image in ...; do |
||||
next=... dépend de tes noms de fichiers |
||||
for a in {0..24}; do |
||||
convert $image $next -alpha set -channel A -evaluate set $[i*4]% \ |
||||
+channel -compose src-atop -composite -alpha off png:- |
||||
done |
||||
done | |
||||
ffmpeg -f image2pipe -c png -i - ... |
||||
\end{verbatim} |
||||
|
||||
Plus quelques trucs en vrac : |
||||
|
||||
\begin{verbatim} |
||||
fichier .avi -> mpeg ( qualité DVD ) |
||||
ffmpeg -i fichier.avi -target pal-dvd fichier.mpeg |
||||
|
||||
fichier .avi -> mpeg ( qualité DVD, bitrate 7Mbps, 16/9 ) |
||||
ffmpeg -i fichier.avi -target pal-dvd -aspect 16:9 -b 7000000 |
||||
fichier.mpeg |
||||
|
||||
fichier .avi -> mpeg ( qualité dvd, en 2 passes, 16/9 ) |
||||
ffmpeg -i fichier.avi -target pal-dvd -aspect 16:9 -pass 1 |
||||
fichier_tempo.mpeg |
||||
ffmpeg -i fichier.avi -target pal-dvd -aspect 16:9 -pass 2 |
||||
fichier_final.mpeg |
||||
|
||||
préciser le "framerate" ( images par secondes : ici 25 ) |
||||
ffmpeg -i fichier.avi -r 25 fichier.mpeg |
||||
|
||||
préciser la taille ( défaut = taille du source ( option -s )) |
||||
ffmpeg -i fichier.avi -s 720x576 fichier.mpeg |
||||
|
||||
les deux précédents : |
||||
ffmpeg -i fichier.avi -r 25 -s 640x480 fichier.mpeg |
||||
|
||||
préciser le coef de qualité ( qscale : 1 = le mieux / 3 = correcte ) |
||||
ffmpeg -i fichier.dv -target pal-dvd -qscale 2 Fichier.mpeg |
||||
\end{verbatim} |
||||
|
||||
|
||||
% -------------------------------------------------------------------- |
||||
|
||||
\section{Autres trucs} |
||||
|
||||
\index{rtmp} |
||||
|
||||
\texttt{flvstreamer -r rtmp://lacantine.live-fstreams.cdn02.rambla.be:1935/live-lacantine/live-lacantine-2 | mplayer -} |
||||
|
||||
% -------------------------------------------------------------------- |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,32 @@
@@ -0,0 +1,32 @@
|
||||
% -------------------------------------------------------------------- |
||||
% nouveau juillet 2014 à mixart-myrys |
||||
% -------------------------------------------------------------------- |
||||
|
||||
\chapter{Webcam} |
||||
\label{webcam} |
||||
\index{webcam} |
||||
|
||||
Sous Linux, c'est quand même un peu tordu, dans le même genre |
||||
que la pile son, quoi... Nous allonc commencer par le plus |
||||
simple : juste tenter de prendre une photo avec une |
||||
\textsl{webcam} classique en USB, et d'enregistrer cette |
||||
image. |
||||
|
||||
\section{vgrabbj} |
||||
\index{vgrabbj} |
||||
|
||||
D'après la manpage : |
||||
« \textit{ |
||||
vgrabbj is a program that will grab images from any v4l-capable device |
||||
which supports one of the rgb24, rgb32, yuv420, yuv420p, yuyv, or |
||||
yuv422 palettes and saves the image as a .jpg, .png, or .pnm file. |
||||
} » |
||||
|
||||
Quelques options à connaitre : \texttt{-S} échange des |
||||
deux composantes R et B; \texttt{-s <device>} affiche |
||||
les capacités du périphérique v4l\index{v4l}. |
||||
|
||||
|
||||
% -------------------------------------------------------------------- |
||||
% -------------------------------------------------------------------- |
||||
|
Loading…
Reference in new issue