mercredi 30 novembre 2016

Creating a bootable usb key from a cd image

if you want to create a bootable usb key from a cd isoimage, first check that your iso is ready for that

$ fdisk -l Porteus-MATE-v3.1-i486.iso

Disque Porteus-MATE-v3.1-i486.iso : 250 Mo, 250468352 octets
255 têtes, 63 secteurs/piste, 30 cylindres, total 489196 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
Identifiant de disque : 0x00000000

Le disque Porteus-MATE-v3.1-i486.iso ne contient pas une table de partitions valable


The last line indicates that the iso doesn't contain a partition table and that may prohibit your key from being bootable on some systems.

To correct that, first install the isolinux package on your system:
$ apt-get install syslinux


then add the partition table
$ isohybrid Porteus-MATE-v3.1-i486.iso

Then check


$ fdisk -l Porteus-MATE-v3.1-i486.iso

Disque Porteus-MATE-v3.1-i486.iso : 250 Mo, 250609664 octets
64 têtes, 32 secteurs/piste, 239 cylindres, total 489472 secteurs
Unités = secteurs de 1 * 512 = 512 octets
Taille de secteur (logique / physique) : 512 octets / 512 octets
taille d'E/S (minimale / optimale) : 512 octets / 512 octets
Identifiant de disque : 0x515facbe

             Périphérique Amorçage  Début         Fin      Blocs    Id. Système
Porteus-MATE-v3.1-i486.iso1   *           0      489471      244736   17  HPFS/NTFS masquée


To copy the image
$ dd if=Porteus-MATE-v3.1-i486.iso of=/dev/sdX

 

jeudi 25 août 2016

Streaming SONY CX900 video via ustream

Tech requirements

-Blackmagick Decklink Minirecorder or other acquisition card + software
-FFMPEG compiled with blackmagick support :

./configure --enable-decklink --enable-shared --extra-cflags="-I/usr/include/blackmagic" –enable-libx264 --enable-libvpx --enable-libvorbis --enable-gpl
put your camera on and connect it to the decklink card through the hdmi cable
verify your settings are ok with media express.
The you can launch the FFmpeg command

ffmpeg -thread_queue_size 4096 -f decklink -i 'DeckLink Mini Recorder@11' -vf scale=1280:720 -r 10 -f flv -an -vcodec libx264 -threads 4 -preset fast -b:v 700k -pix_fmt yuv420p -y rtmp://<your url...>/<Your key...>
your url and key are given in the brodcast settings of the your ustream dashboard

 
Here I use 10 frame/second to broadcast good image quality at a quite low bitrate. You can adjust your settings size bitrate etc... according to your specific needs and bandwidth
https://support.ustream.tv/hc/en-us/articles/207852117-Internet-connection-and-recommended-encoding-settings

To view the stream a link is provided by ustream when you created your tv channel.
You can watch whatever I try to stream here http://ustre.am/1xdhZ Septembre 10 between 20:00 and 23:00 Paris time.

vendredi 6 mars 2015

ffmpeg blackmagic

we assume the blackmagic module and SDK are properly installed

1-download the ffmpeg source from http://www.ffmpeg.org/download.html
2-configure for blackmagic and h264

./configure --enable-decklink --enable-shared \
--extra-cflags="-I/usr/include/blackmagic" \
–-extra-ldflags="-L/usr/include/blackmagic" \
--enable-libx264 –enable-gpl

make
sudo make install

export LD_LIBRARY_PATH=/usr/local/lib

To check the name of your device
ffmpeg -f decklink -list_devices 1 -i dummy


you  get something like
[decklink @ 0x260d3c0] Blackmagic DeckLink devices:
[decklink @ 0x260d3c0]     'DeckLink Mini Recorder'
Then

you can read and stream your camera e.g.

ffmpeg  -f decklink -i 'DeckLink Mini Recorder@11' -threads 4 -vcodec libx264  -preset ultrafast -pix_fmt yuv420p  -b 20000k  -tune zerolatency -an -f rtp rtp://10.10.0.2:1234/


There will be minimal latency (~1s in my case) using a wifi-n connection and rtp
as expected, udp gives more latency several seconds


https://www.ffmpeg.org/ffmpeg-devices.html#Examples-6


vendredi 5 septembre 2014

duplicate standard output

To duplicate std output of a program (here my_prog) in bash

./my_prog | tee logfile.txt

lundi 28 juillet 2014

Script to test if ethernet interface eth3 is up

#!/bin/bash
var="down"
while [[ $var != "up" ]]
do
    var=$(</sys/class/net/eth3/operstate )
    echo $var
done

mercredi 26 février 2014

Downloading big files from camera

On Mint downloading files from a camera using the gphoto2 automount and caja can be very slow on big files. An efficient alternative is to use gphotofs.

First create a directory for further mounting of the camera


sudo mkdir /media/mtp 
sudo chmod 777 -R /media/mtp

Then  unmount the device automatically mounted by gphoto2 and then you can mount your camera as follows

sudo gphotofs /media/mtp -o allow_other

To unmount

sudo fusermount -u /media/mtp

Then you can use a terminal and copy files, e.g.

cd /media/mtp/*
cp */*.MOV~/Images

This process is much faster than with caja

lundi 24 février 2014

swap blue and red

to exchange red and blue channel in an image file with imagemagick, I found this command

convert salle_test3.png -separate -swap 0,2 -set colorspace RGB -combine -set colorspace sRGB salle_test.png



The reason for specifying the colors pace is not clear to me. Not doing so however clearly changes the lightness of the image.