Rechercher dans ce blog

dimanche 13 décembre 2015

Empêcher OS X de monter un volume au démarrage / Prevent OS X to mount a disk at startup

Prevent a partition from mounting in OS X


diskutil info /Volumes/disk-to-not-be-auto-mounted

Get 

Volume UUID:              EADFE3D8-33C0-3D52-8D66-E5EA0748F81D

vi  /etc/fstab


UUID=EADFE3D8-33C0-3D52-8D66-E5EA0748F81D none hfs rw,no auto




vendredi 11 décembre 2015

ffmpeg encode settings mémo


ffmpeg encoding settings memo


To test settings : 

ffplay -i 'in-1920p'-vf "crop=1888:1056:0:0,scale=1280:720"

mac os x aac encoding  ffmpeg gpl

-strict -2 -codec:a aac -b:a 56k

From 720p

To Divx VGA


ffmpeg -i 'in-720p.mov' -c:v libxvid -filter:v crop=in_w-320:in_h,scale=640:480 -qscale:v 4 -ac 1 -codec:a libmp3lame -b:a 64k out-VGA.avi

to Divx 480p


ffmpeg -i 'in-720p.mov' -c:v libxvid -filter:v crop=in_w-200:in_h,scale=720:480 -qscale:v 4 -ac 1 -codec:a libmp3lame -b:a 64k out-480P.avi

to MP4 480p


ffmpeg -i 'in-720p.mov' -codec:v libx264 -preset slow -crf 18 -filter:v crop=in_w-200:in_h,scale=720:480 -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mp4

(Quality crf 18=high - 23=normal)

to MP4 480p main profile


fmpeg -i 'in-720p.mov' -codec:v libx264 -preset slow -filter:v crop=in_w-200:in_h,scale=720:480 -crf 18 -pix_fmt yuv420p -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mSap4

From HD 1920p

De 1080p à 720p même format d'image 16/9 : crop inutile.

De 1080p à 480p : crop=1616:1080:0:0

Normalement 1620 car 720/480= 1,5 et 1,5x1080=1620 mais pas divisible par 16. Donc j'arrondis à 1616.

De 1080p à VGA (640x480) : crop=1440:1080:0:0


Attention si crop nécessaire 

Maintient de dar et sar à 1
-aspect 16:9

SAINT JACUT MATIN SOIR

To 720p mp4


bin/ffmpeg28 -i /Users/moi/Desktop/sources\ vues\ backup/2012-09-28\ 07_12_19\ \(id\).mov -codec:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -profile:v main -vf rotate=-1.5*PI/180:bilinear=1,format=yuv420p,crop=1856:1008:48:48,scale=1280:720 -aspect 16:9 -an saint-jacut_1_nosound-nots-720P-H264-aac-crf18-main-yuv420p.mp4

bin/ffmpeg28 -i "/Users/moi/Desktop/sources vues backup/2012-09-28 14_15_01 (id).mov" -codec:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -profile:v main -vf rotate=-1.5*PI/180:bilinear=1,format=yuv420p,crop=1856:1008:48:48,scale=1280:720 -aspect 16:9 -t 05:18:12  -an saint-jacut_2_nosound-nots-720P-H264-aac-crf18-main-yuv420p.mp4

Saint Jacut marée montante

Le crop est calculé pour couper l'image en bas 1056 (pour retirer la barrière), puis à droite pour conserver le rapport h/l selon le format de sortie. Le crop est calculé également pour être divisible par 16

To mp4 720p


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1888:1056:0:0,scale=1280:720 -crf 18 -pix_fmt yuv420p -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-720p.mp4

To mp4 480p


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1584:1056:0:0,scale=720:480 -crf 18 -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-480p.mp4

To mp4 480p no audio


ffmpeg -i 'in-1920p.mov' -codec:v libx264 -preset slow -filter:v crop=1584:1056:0:0,scale=720:480 -crf 18 -profile:v main -an out-480p.mp4

To mp4 VGA


ffmpeg -i 'in-1980p.mov' -codec:v libx264 -preset slow -filter:v crop=1408:1056:0:0,scale=640:480 -crf 18  -profile:v main -ac 1 -codec:a libfdk_aac -b:a 56k out-VGA.mp4

To mp4 VGA no audio


ffmpeg -i 'in-1980p.mov' -codec:v libx264 -preset slow -filter:v crop=1408:1056:0:0,scale=640:480 -crf 18  -profile:v main -an out-VGA.mp4

no sound => -an

From HD SONY 1440 to VGA with rotation (machines à laver)


ffmpeg -i '/in-1440.mov' -c:v libxvid -filter:v hflip,vflip,format=yuv420p,scale=640:480 -qscale 4 -ac 1 -codec:a libmp3lame -b:a 64k out-VGA.avi


Méthodes de rotation - ffmpeg options


* rotate=PI:bilinear=0,format=yuv420p

* hflip,vflip,format=yuv420p

* transpose=2,transpose=2,format=yuv420p" -metadata:s:v rotate=0

* cropdetect=24:16:0

Start and End time position to encoding


ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss START -t LENGTH OUTFILE.mp4
where START is starting positing in seconds or in format hh:mm:ss LENGTH is the chunk length in seconds or in format hh:mm:ss

So you will need to run this command few times depending on how long your video. If let's say your video is 31 minutes long and you want so split into 15 min chunks here is how you run it:

ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss 0 -t 00:15:00 OUTFILE-1.mp4

ffmpeg -i ORIGINALFILE.mp4 -acodec copy -vcodec copy -ss 00:15:00 -t 00:15:00 OUTFILE-2.mp4

Concat demuxer

The concat demuxer was added to FFmpeg 1.1. You can read about it in the documentation.

Instructions

Create a file mylist.txt with all the files you want to have concatenated in the following form (lines starting with a # are ignored):
# this is a comment
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
Note that these can be either relative or absolute paths. Then you can stream copy or re-encode your files:
ffmpeg -f concat -i mylist.txt -c copy output

----

Constant Rate Factor (CRF) - ffmpeg options profiles...


This method allows the encoder to attempt to achieve a certain output quality for the whole file when output file size is of less importance. This provides maximum compression efficiency with a single pass. Each frame gets the bitrate it needs to keep the requested quality level. The downside is that you can't tell it to get a specific filesize or not go over a specific size or bitrate.

1. Choose a CRF value

The range of the quantizer scale is 0-51: where 0 is lossless, 23 is default, and 51 is worst possible. A lower value is a higher quality and a subjectively sane range is 18-28. Consider 18 to be visually lossless or nearly so: it should look the same or nearly the same as the input but it isn't technically lossless.

The range is exponential, so increasing the CRF value +6 is roughly half the bitrate while -6 is roughly twice the bitrate. General usage is to choose the highest CRF value that still provides an acceptable quality. If the output looks good, then try a higher value and if it looks bad then choose a lower value.

Note: The CRF quantizer scale mentioned on this page only applies to 8-bit x264 (10-bit x264 quantizer scale is 0-63). You can see what you are using by referring to the ffmpeg console output during encoding (yuv420p or similar for 8-bit, and yuv420p10le or similar for 10-bit). 8-bit is more common among distributors.

2. Choose a preset

A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize). This means that, for example, if you target a certain file size or constant bit rate, you will achieve better quality with a slower preset. Similarly, for constant quality encoding, you will simply save bitrate by choosing a slower preset.

The general guideline is to use the slowest preset that you have patience for. Current presets in descending order of speed are: ultrafast,superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. The default preset is medium. Ignore placebo as it is not useful (see FAQ). You can see a list of current presets with -preset help (see example below), and what settings they apply with x264 --fullhelp.

You can optionally use -tune to change settings based upon the specifics of your input. Current tunings include: film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. For example, if your input is animation then use the animation tuning, or if you want to preserve grain then use the grain tuning. If you are unsure of what to use or your input does not match any of tunings then omit the -tune option. You can see a list of current tunings with -tune help, and what settings they apply with x264 --fullhelp.

Profiles

Another optional setting is -profile:v which will limit the output to a specific H.264 profile. This can generally be omitted unless the target device only supports a certain profile (see Compatibility). Current profiles include: baseline, main, high, high10, high422, high444. Note that usage of -profile:v is incompatible with lossless encoding.

To list all possible internal preset and tunes:

ffmpeg -f lavfi -i nullsrc -c:v libx264 -preset help -f mp4 -


------------

ffmpeg map option


from : https://trac.ffmpeg.org/wiki/Map

In all following examples, we will use an example input file like this one:
# fmpeg -i input.mkv

ffmpeg version ... Copyright (c) 2000-2012 the FFmpeg developers
...
Input #0, matroska,webm, from 'input.mkv':
  Duration: 01:39:44.02, start: 0.000000, bitrate: 5793 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p, 1920x800, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s (default)
    Stream #0:2(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s
    Stream #0:3(ger): Subtitle: text (default)
At least one output file must be specified

#

Example 1

Now, let's say we want to:
  • copy video stream
  • encode german audio stream to mp3 (128kbps) and aac (96kbps) (creating 2 audio streams in the output)
  • drop english audio stream
  • copy subtitle stream
This can be done using the following FFmpeg command line:
ffmpeg -i input.mkv \
    -map 0:0 -map 0:1 -map 0:1 -map 0:3 \
    -c:v copy \
    -c:a:0 libmp3lame -b:a:0 128k \
    -c:a:1 libfaac -b:a:1 96k \
    -c:s copy \
    output.mkv
Note there is no "-map 0:2" and that "-map 0:1" has been specified twice.
Using "-map 0:0 -map 0:1 -map 0:1 -map 0:3" we told FFmpeg to select/map specified input streams to output in that order.
So, our output will now have the following streams:
Output #0, matroska, to 'output.mkv':
    Stream #0:0(eng): Video ...
    Stream #0:1(ger): Audio ...
    Stream #0:2(ger): Audio ...
    Stream #0:3(ger): Subtitle ...
After we selected which streams we would like in our output, using "-map" option, we specified codecs for each stream in our output.
Video and subtitle stream have just been copied and german audio stream has been encoded to 2 new audio streams, mp3 and aac.
We used "-c:a:0" to specify codec for the output's first AUDIO stream and "-c:a:1" to specify codec for the output's second AUDIO stream.
Note that "a:0" refers to the output's first AUDIO stream (#0:1 in our case), "a:1" refers to the output's 2nd AUDIO stream (#0:2 in our case), etc.
The result will be:
Output #0, matroska, to 'output.mkv':
    Stream #0:0(eng): Video ...
    Stream #0:1(ger): Audio ...
    Stream #0:2(ger): Audio ...
    Stream #0:3(ger): Subtitle ...
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (dca -> libmp3lame)
  Stream #0:2 -> #0:2 (dca -> libfaac)
  Stream #0:3 -> #0:3 (copy)

Example 2

Let's say that we want to reorder input streams backwards, so that we have output like this:
    Stream #0:0(ger): Subtitle: text (default)
    Stream #0:1(eng): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s
    Stream #0:2(ger): Audio: dts (DTS), 48000 Hz, 5.1(side), s16, 1536 kb/s (default)
    Stream #0:3(eng): Video: h264 (High), yuv420p, 1920x800, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
This can simply be done using the following command line:
ffmpeg -i input.mkv -map 0:3 -map 0:2 -map 0:1 -map 0:0 -c copy output.mkv
Note that we specified all the input streams, but in the reverse order, which causes that order to be respected in the output.
The option "-c copy" tells FFmpeg to use "copy" on all streams.

Example 3

If we want to extract only audio streams, from input file, then we can do it like this:
ffmpeg -i input.mkv -map 0:1 -map 0:2 -c copy output.mkv

Example 4

If we want to re-encode just the video streams, but copy all the other streams (like audio, subtitles, attachments, etc), we might use something like this:
ffmpeg -i input.mkv -map 0 -c copy -c:v mpeg2video output.mkv
It will tell ffmpeg to:
  • read the input file 'input.mkv'
  • select all the input streams (first input = 0) to be processed (using "-map 0")
  • mark all the streams to be just copied to the output (using "-c copy")
  • mark just the video streams to be re-encoded (using "-c:v mpeg2video")
  • write the output file 'output.mkv'

jeudi 10 décembre 2015

FIX avidemux2 2.5.4 mac os x lion 10.7

To fix crash avidemux 2.5.4 at startup on lion 10.7


Simply delete


in ressource/lib

libxml2.2.dylib
libiconv.2.dylib

mercredi 9 décembre 2015

Commandes Vidéo diverses ffmpeg mencoder avisplit avimerge transcode

How can I fix AVI files with a broken index or bad interleaving?


To avoid having to use -idx to be able to seek in AVI files with a broken index or -ni to play AVI files with bad interleaving, use the command

mencoder -forceidx -nobps  -ovc copy -oac copy -o outidx.avi input.avi

to copy the video and audio streams into a new AVI file while regenerating the index and correctly interleaving the data.

Of course this cannot fix possible bugs in the video and/or audio streams

transcode -i input.avi -P 1 --avi_limit 128 -b 128  -o out.avi

Réaligner chunks vidéo et audio pour qu'il n'y ait pas de désynchronisation après le split


transcode -i input.avi -P1 -N 0x55 -y raw -o out.avi

Split

avisplit -i out.avi -o base -s 512

TOUT EN UNE SEULE OPERATION avec transcode

transcode -i input.avi -P1 -N 0x55 -y raw -o out --avi_limit 512

ffmpeg -threads N


ffmpeg -i input.mp4 -y -threads 2 -map 0.0:0.0 -f avi -vcodec copy -b 940 -aspect 4:3 -s 640x480 -r pal -g 240 -me epzs -qmin 2 -qmax 15 -acodec mp3 -ab 128 -ar 48000 -ac 2 -map 0.1:0.1 -benchmark out.avi

MUXING


mencoder -oac copy -ovc copy  -o output_movie.avi \
    -audiofile input_audio.mp2 input_video.avi

mencoder -of lavf -ovc copy -oac mp3lame -forceidx -lameopts cbr:br=128 -o outmencoder.avi -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames input.mp4

Pour joindre 2 fichiers avi


L'option -c set pour dropper des frames s'il manque de l'audio

avimerge -o bigvideo.avi -c -i avi1 avi2 avi3

launchtl can be used to disable and re-enable crash reporting or mDNSResponder or services mac os x

launchtl can be used to disable and re-enable crash reporting.  


To disable crash  reporting:


           launchctl unload -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
           sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist

     To re-enable crash reporting:

           launchctl load -w /System/Library/LaunchAgents/com.apple.ReportCrash.plist
           sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.ReportCrash.Root.plist


Disable mDNSResponder


sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist

Disable  Apple Push Notification Service (apsd) on OS X 10.8

launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist


Secret SSH

Secret SSH 



SecretSSH est un petit programme en perl qui permet juste de montrer la
faisabilité d'une idée amusante : cacher sshd et l'activer à distance à
la demande.

Il permet de répondre à ma manière aux personnes qui ont peur du
débordement de buffer ou de la trappe dans un serveur SSH ;-)

L'activation de sshd se fait sur la réception d'un paquet TCP possédant des
caractéristiques particulières. Ainsi, le démon sshd n'est pas toujours en
écoute sur le réseau et à distance il est impossible (?) de le trouver.

Il est possible d'envisager un tel programme pour administrer une machine
aidant à la détection d'intrusion avec SNORT par exemple. Il est alors
possible de fermer tous les services sur cette machine même le port 22/tcp.

Le programme suivant n'est qu'une illustration permettant de montrer ce qui
est faisable mais il est fourni sans aucune garantie.

Pour tester secretssh (fourni ci-dessous) :

. Sur le serveur (en tant que root) : ./secretssh.pl

. Sur le client (en tant que root) : ./secretssh.pl [login@]server

secretssh nécessite perl RawIP qui peut être téléchargé à l'adresse :
http://quake.skif.net/RawIP/files/Net-RawIP-0.09c.tar.gz

Dans la configuration initiale, le client envoi un paquet SYN tcp sur le
port 80 du serveur avec le champ id, l'adresse ip source, le port source et
le numéro de séquence fixés à certaines valeurs. A la réception de ce paquet
le serveur lance sshd en mode debug sur le port 2222/tcp. Le client se connecte
ensuite via ssh sur le port 2222/tcp du serveur. Ce port n'est accessible sur
le serveur que pour une seule connexion ssh.


#------------------------------------------------------------------------------
#!/usr/local/bin/perl
# secretssh - sa/hsc

# RawIP homepage: http://quake.skif.net/RawIP/files/Net-RawIP-0.09c.tar.gz
use Net::RawIP;
## CONF (you should edit all these params) #####
my $key_port_dst = '80';
my $key_ip_src = '192.168.66.66';
my $key_port_src = '1666';
my $key_ip_id = '666';
my $key_tcp_seq = '66666666';
my $verbose = 0;
my $bindport = 2222;
my $SSH = '/usr/local/bin/ssh';
my $SSHD = '/usr/local/sbin/sshd';
## MAIN ########################################
print " --== Secret SSH - sa/hsc ==--\n";
$a = new Net::RawIP;
my $remote = shift || "";
if( $remote=~/\S/ ) { #client
my $login="";
if($remote=~/^(\S+@)(\S+)$/) {$login=$1; $remote=$2;}
$a->set({ip=>{id=>$key_ip_id,saddr=>$key_ip_src,daddr =>$remote},
tcp=>{dest=>$key_port_dst,source=>$key_port_src,syn=>1,seq=>$key_tcp_seq}});
$a->send;
$verbose ? exec "$SSH", '-v', '-p', "$bindport", "${login}${remote}"
: exec "$SSH", '-p', "$bindport", "${login}${remote}";
}
else { #server
my $dev = Net::RawIP::lookupdev($tout);
print "Server using $dev and port $bindport ...\n" if($verbose);
$pcap=$a->pcapinit($dev,"tcp and src host $key_ip_src and src port $key_port_src".
" and ip[4:2] = $key_ip_id and ip[24:4] = $key_tcp_seq",1500,30);
loop $pcap,-1,\&Bindsshd,\@a;
}
## FUNC #########################################
sub Bindsshd { system "$SSHD", '-d', '-p', "$bindport"; }
## EOF ##########################################
#------------------------------------------------------------------------------

exemples acl chmod Mac OS X et extended attributs xattr manipulations

Exemples acl chmod Mac OS X et extended attributs xattr manipulations

Examples acl chmod Mac OS X

# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
# chmod +a "admin allow write" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: admin allow write
# chmod +a "guest deny read" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: guest deny read
2: admin allow write
# chmod +a "admin allow delete" file1
# ls -le
-rw-r--r--+ 1 juser wheel 0 Apr 28 14:06 file1
owner: juser
1: guest deny read
2: admin allow write,delete



Use the xattr command. You can inspect the extended attributes:

$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
com.apple.quarantine
and use the -d option to delete one extended attribute:
$ xattr -d com.apple.quarantine s.7z
$ xattr s.7z
com.apple.metadata:kMDItemWhereFroms
you can also use the -c option to remove all extended attributes:

$ xattr -c s.7z
$ xattr s.7z